00001 #include <xml_loader.h>
00002 #include <xml_types.h>
00003 #include <xml_defines.h>
00004 #include <document.h>
00005
00006 namespace result{
00007 class DocumentImpl;
00008 class extension;
00009 class ext;
00010 class extension_subcl;
00011 class location;
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 }
00061 void to_xml(const result::extension&);
00062 void to_xml(const result::ext&);
00063 void to_xml(const result::extension_subcl&);
00064 void to_xml(const result::location&);
00065
00066 void applyXPath (result::extension * obj, XPath::iterator xp, XPath::iterator ite, XPathResult& res );
00067 void applyXPath (result::ext * obj, XPath::iterator xp, XPath::iterator ite, XPathResult& res );
00068 void applyXPath (result::extension_subcl * obj, XPath::iterator xp, XPath::iterator ite, XPathResult& res );
00069 void applyXPath (result::location * obj, XPath::iterator xp, XPath::iterator ite, XPathResult& res );
00070
00071 namespace result{
00072 typedef location extension_subt;
00073
00074 #ifndef _class_ext
00075 #define _class_ext
00076 class ext {
00077 friend void ::applyXPath(ext*, XPath::iterator, XPath::iterator, XPathResult& );
00078 friend class xpath_iterator<ext>;
00079 ATTRIBUTE(xboolean, isTrue)
00080 ATTRIBUTE(xENTITIES, ents)
00081
00082 public: ext() {
00083 }
00084 public: ext( const char** atts) {
00085 for(const char** c = atts; *c != NULL; c++) {
00086 IGNORE_IF_NULL
00087 INIT_IF_MATCH(isTrue)
00088 INIT_IF_MATCH(ents)
00089 }
00090 }
00091 public: ext(const xboolean& visTrue ,const xENTITIES& vents) :_isTrue (visTrue) ,_ents (vents) {
00092 }
00093 };
00094 #endif //_class_ext
00095
00096
00097 #ifndef _class_extension_subcl
00098 #define _class_extension_subcl
00099 class extension_subcl {
00100 friend void ::applyXPath(extension_subcl*, XPath::iterator, XPath::iterator, XPathResult& );
00101 friend class xpath_iterator<extension_subcl>;
00102
00103 public: extension_subcl() {
00104 }
00105 public: extension_subcl( const char** atts) {
00106 }
00107 };
00108 #endif //_class_extension_subcl
00109
00110
00111 #ifndef _class_extension
00112 #define _class_extension
00113 class extension {
00114 friend void ::applyXPath(extension*, XPath::iterator, XPath::iterator, XPathResult& );
00115 friend class xpath_iterator<extension>;
00116
00117
00118
00119 public: LIST<result::location*> locations;
00120
00121 public: LIST<result::extension_subt*> extension_subts;
00122
00123 public: LIST<result::ext*> exts;
00124
00125 extension_subcl* extension_subcls;
00126
00127 ATTRIBUTE(xstring, point)
00128 ATTRIBUTE(xdouble, number)
00129 ATTRIBUTE(xstring, id)
00130 ATTRIBUTE(xstring, name)
00131
00132 public: extension() {
00133 extension_subcls = NULL;
00134 }
00135 public: extension( const char** atts) {
00136 extension_subcls = NULL;
00137 for(const char** c = atts; *c != NULL; c++) {
00138 IGNORE_IF_NULL
00139 INIT_IF_MATCH(point)
00140 INIT_IF_MATCH(number)
00141 INIT_IF_MATCH(id)
00142 INIT_IF_MATCH(name)
00143 }
00144 }
00145 public: extension(const xstring& vpoint ,const xdouble& vnumber ,const xstring& vid ,const xstring& vname) :_point (vpoint) ,_number (vnumber) ,_id (vid) ,_name (vname) {
00146 extension_subcls = NULL;
00147 }
00148 };
00149 #endif //_class_extension
00150
00151 #ifndef _class_location
00152 #define _class_location
00153 class location {
00154 friend void ::applyXPath(location*, XPath::iterator, XPath::iterator, XPathResult& );
00155 friend class xpath_iterator<location>;
00156 ATTRIBUTE(xstring, path)
00157 ATTRIBUTE(xstring, path1)
00158
00159 public: location() {
00160 }
00161 public: location( const char** atts) {
00162 for(const char** c = atts; *c != NULL; c++) {
00163 IGNORE_IF_NULL
00164 INIT_IF_MATCH(path)
00165 INIT_IF_MATCH(path1)
00166 }
00167 }
00168 public: location(const xstring& vpath ,const xstring& vpath1) :_path (vpath) ,_path1 (vpath1) {
00169 }
00170 };
00171 #endif //_class_location
00172
00173
00174
00175 class DocumentImpl: public Document {
00176 static void extension_element ( xml_loader *th, const char *name, const char **atts );
00177 static void ext_element ( xml_loader *th, const char *name, const char **atts );
00178 static void extension_subcl_element ( xml_loader *th, const char *name, const char **atts );
00179 static void location_element ( xml_loader *th, const char *name, const char **atts );
00180 public:
00181 virtual XPathResult applyXPath(XPath);
00182 virtual void element ( xml_loader *th, const char *name, const char **atts );
00183 };
00184 }
00185
00186
00187 template<>
00188 class xpath_iterator<result::extension> : public abstract_xpath_iterator {
00189 result::extension* value;
00190 public:
00191 xpath_iterator(abstract_xpath_iterator* par, result::extension* val): abstract_xpath_iterator(par), value(val) {
00192 }
00193 virtual void ApplyByPath(XPath::const_iterator, XPath::const_iterator, xpath_iterator_functor& f);
00194 virtual void getValueByPath(XPath::const_iterator xp, XPath::const_iterator xe, XPathResult& res);
00195 virtual bool checkPathCondition(XPath::const_iterator, XPath::const_iterator);
00196 void setValue(result::extension* val) {
00197 value = val;
00198 }
00199 virtual void to_xml(std::ostream& out = std::cout);
00200 };
00201
00202 template<>
00203 class xpath_iterator<result::ext> : public abstract_xpath_iterator {
00204 result::ext* value;
00205 public:
00206 xpath_iterator(abstract_xpath_iterator* par, result::ext* val): abstract_xpath_iterator(par), value(val) {
00207 }
00208 virtual void ApplyByPath(XPath::const_iterator, XPath::const_iterator, xpath_iterator_functor& f);
00209 virtual void getValueByPath(XPath::const_iterator xp, XPath::const_iterator xe, XPathResult& res);
00210 virtual bool checkPathCondition(XPath::const_iterator, XPath::const_iterator);
00211 void setValue(result::ext* val) {
00212 value = val;
00213 }
00214 virtual void to_xml(std::ostream& out = std::cout);
00215 };
00216
00217 template<>
00218 class xpath_iterator<result::extension_subcl> : public abstract_xpath_iterator {
00219 result::extension_subcl* value;
00220 public:
00221 xpath_iterator(abstract_xpath_iterator* par, result::extension_subcl* val): abstract_xpath_iterator(par), value(val) {
00222 }
00223 virtual void ApplyByPath(XPath::const_iterator, XPath::const_iterator, xpath_iterator_functor& f);
00224 virtual void getValueByPath(XPath::const_iterator xp, XPath::const_iterator xe, XPathResult& res);
00225 virtual bool checkPathCondition(XPath::const_iterator, XPath::const_iterator);
00226 void setValue(result::extension_subcl* val) {
00227 value = val;
00228 }
00229 virtual void to_xml(std::ostream& out = std::cout);
00230 };
00231
00232 template<>
00233 class xpath_iterator<result::location> : public abstract_xpath_iterator {
00234 result::location* value;
00235 public:
00236 xpath_iterator(abstract_xpath_iterator* par, result::location* val): abstract_xpath_iterator(par), value(val) {
00237 }
00238 virtual void ApplyByPath(XPath::const_iterator, XPath::const_iterator, xpath_iterator_functor& f);
00239 virtual void getValueByPath(XPath::const_iterator xp, XPath::const_iterator xe, XPathResult& res);
00240 virtual bool checkPathCondition(XPath::const_iterator, XPath::const_iterator);
00241 void setValue(result::location* val) {
00242 value = val;
00243 }
00244 virtual void to_xml(std::ostream& out = std::cout);
00245 };
00246