SchemeParser.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00025 //----------------------------------------------------------------------
00026 #ifndef ICL_CORE_SCHEME_PARSER_H_INCLUDED
00027 #define ICL_CORE_SCHEME_PARSER_H_INCLUDED
00028 
00029 #include "icl_core/BaseTypes.h"
00030 #include "icl_core/ImportExport.h"
00031 
00032 #include <vector>
00033 
00034 #include <boost/spirit/version.hpp>
00035 #if SPIRIT_VERSION < 0x2000
00036 # include <boost/spirit.hpp>
00037 # define BOOST_SPIRIT_NAMESPACE boost::spirit
00038 #else
00039 // Undefine the Boost Spirit version macros because they are redefined
00040 // in the include below!
00041 # undef SPIRIT_VERSION
00042 # undef SPIRIT_PIZZA_VERSION
00043 
00044 # include <boost/spirit/include/classic.hpp>
00045 # define BOOST_SPIRIT_NAMESPACE boost::spirit::classic
00046 #endif
00047 
00048 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00049 # include "icl_core/Deprecate.h"
00050 #endif
00051 
00052 namespace icl_core
00053 {
00054 
00055 struct Query
00056 {
00057     String name;
00058     String value;
00059 };
00060 
00061 typedef std::vector<Query> QueryList;
00062 
00063 enum SchemeType
00064 {
00065     FileScheme,   
00066     HttpScheme,   
00067     CameraScheme, 
00068     GpsScheme, 
00069     OtherScheme
00070 };
00071 
00072 struct Scheme
00073 {
00074     SchemeType scheme_type;
00075     String scheme_name;
00076     String specifier;
00077     String anchor;
00078     QueryList queries;
00079 };
00080 
00081 #ifdef __cplusplus
00082 ICL_CORE_IMPORT_EXPORT std::ostream& operator<<(std::ostream& stream, Scheme const& scheme);
00083 #endif // __cplusplus
00084 
00088 class AbstractFunctionObject
00089 {
00090 public:
00091     virtual ~AbstractFunctionObject()
00092     { }
00093     virtual void operator () (char const* str, char const* end) const = 0;
00094 };
00095 
00096 class SchemeFunction : public AbstractFunctionObject
00097 {
00098 public:
00099     virtual ~SchemeFunction()
00100     { }
00101     virtual void operator () (char const* str, char const* end) const;
00102     Scheme *m_scheme_handler;
00103 };
00104 
00105 class SpecifierFunction : public AbstractFunctionObject
00106 {
00107 public:
00108     virtual ~SpecifierFunction()
00109     { }
00110     virtual void operator () (char const* str, char const* end) const;
00111     Scheme *m_scheme_handler;
00112 };
00113 
00114 class AnchorFunction : public AbstractFunctionObject
00115 {
00116 public:
00117     virtual ~AnchorFunction()
00118     { }
00119     virtual void operator () (char const* str, char const* end) const;
00120     Scheme *m_scheme_handler;
00121 };
00122 
00123 class QueryKeyFunction : public AbstractFunctionObject
00124 {
00125 public:
00126     virtual ~QueryKeyFunction()
00127     { }
00128     virtual void operator () (char const* str, char const* end) const;
00129     QueryList *m_queries;
00130 };
00131 
00132 class QueryValueFunction : public AbstractFunctionObject
00133 {
00134 public:
00135     virtual ~QueryValueFunction()
00136     { }
00137     virtual void operator () (char const* str, char const* end) const;
00138     QueryList *m_queries;
00139 };
00140 
00145 class ICL_CORE_IMPORT_EXPORT SchemeParser
00146 {
00147 public:
00149     SchemeParser();
00150 
00152     ~SchemeParser();
00153 
00157     bool parseScheme(const String &str);
00158 
00162     const BOOST_SPIRIT_NAMESPACE::parse_info<> &getParseInfo() const;
00163 
00165     const icl_core::Scheme &getSchemeResult() const;
00166 
00169     static bool parseScheme(const String &str, Scheme &scheme_handler,
00170                             BOOST_SPIRIT_NAMESPACE::parse_info<> &info);
00171 
00173 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00174 
00178     ICL_CORE_VC_DEPRECATE_STYLE bool ParseScheme(const String &str) ICL_CORE_GCC_DEPRECATE_STYLE;
00179 
00184     ICL_CORE_VC_DEPRECATE_STYLE const BOOST_SPIRIT_NAMESPACE::parse_info<> &GetParseInfo() const ICL_CORE_GCC_DEPRECATE_STYLE;
00185 
00189     ICL_CORE_VC_DEPRECATE_STYLE const icl_core::Scheme &GetSchemeResult() const ICL_CORE_GCC_DEPRECATE_STYLE;
00190 
00194     ICL_CORE_VC_DEPRECATE_STYLE static bool ParseScheme(const String &str, Scheme &scheme_handler,
00195                                                         BOOST_SPIRIT_NAMESPACE::parse_info<> &info)
00196     ICL_CORE_GCC_DEPRECATE_STYLE;
00197 
00198 #endif
00199 
00200 
00201 private:
00202     BOOST_SPIRIT_NAMESPACE::parse_info<> m_info;
00203 
00204     icl_core::Scheme m_scheme;
00205 };
00206 
00207 } // namespace icl_core
00208 
00209 #endif // _icl_core_SchemeParser_h_


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:19