src/gen/country.gen.cpp

См. документацию.
00001 #include <country.h>
00002 
00003 namespace country{
00004 DOCIMPL_APPLYXPATH_FUNC_BEGIN()
00005      DOCIMPL_APPLYXPATH_MATCH(Country)
00006 DOCIMPL_APPLYXPATH_FUNC_END()
00007 
00008 DOCIMPL_ELEMENT_BEGIN()
00009      DOCIMPL_ELEMENT_PUSH_IF_EQUAL(Country)
00010 DOCIMPL_ELEMENT_END()
00011 
00012 DOCIMPL_ELEMENTS_FUNC_BEGIN(Country)
00013           DOCIMPL_ELEMENTS_SUBSEQUENCER(nm, string)
00014           DOCIMPL_ELEMENTS_SUBSEQUENCER(population, decimal)
00015 DOCIMPL_ELEMENTS_FUNC_END()
00016 
00017 }
00018 APPLYXPATH_FUNC_BEGIN(country::Country)
00019      APPLYXPATH_SEQUENCE(nm)
00020      APPLYXPATH_SEQUENCE(population)
00021 APPLYXPATH_FUNC_END()
00022 
00023 
00024 
00025 TO_XML_FUNC_BEGIN(country::Country,Country)
00026      TO_XML_HAS_ELEMENTS_BEGIN()
00027           TO_XML_SEQUENCER(nm,nm)
00028           TO_XML_SEQUENCER(population,population)
00029      TO_XML_HAS_ELEMENTS_END()
00030 TO_XML_FUNC_END()
00031 
00032 
00033 
00034 void xpath_iterator<country::Country>::ApplyByPath(XPath::const_iterator xp, XPath::const_iterator xe, xpath_iterator_functor& f) {
00035      if(value == NULL)
00036           return;
00037      if(xp == xe) {
00038           f.apply(*this);
00039           return;
00040      }
00041      if(xp->type == XP_ELEMENT) {
00042           XPath::const_iterator xpp = xp;
00043           if(xpp != xe)
00044                xpp++;
00045           else
00046                return;
00047           if(xp->text == "nm" || xp->text == "*") {
00048                typeof(value->nms.begin()) i = value->nms.begin(), ie = value->nms.end();
00049                if(xpp != xe) {
00050                     xpath_iterator<country::nm> it(this, NULL);
00051                     for(;i != ie;i++) {
00052                          it.setValue(*i);
00053                          it.ApplyByPath(xpp, xe, f);
00054                     }
00055                } else {
00056                     xpath_iterator<country::nm> it(this, NULL);
00057                     for(;i != ie;i++){ 
00058                          it.setValue(*i);
00059                          f.apply(it);
00060                     }
00061                }
00062           }
00063           if(xp->text == "population" || xp->text == "*") {
00064                typeof(value->populations.begin()) i = value->populations.begin(), ie = value->populations.end();
00065                if(xpp != xe) {
00066                     xpath_iterator<country::population> it(this, NULL);
00067                     for(;i != ie;i++) {
00068                          it.setValue(*i);
00069                          it.ApplyByPath(xpp, xe, f);
00070                     }
00071                } else {
00072                     xpath_iterator<country::population> it(this, NULL);
00073                     for(;i != ie;i++){ 
00074                          it.setValue(*i);
00075                          f.apply(it);
00076                     }
00077                }
00078           }
00079           if(xp->text == ".." && parent != NULL)
00080                parent->ApplyByPath(xpp, xe, f);
00081      }
00082 }
00083 
00084 void xpath_iterator<country::Country>::getValueByPath(XPath::const_iterator xp, XPath::const_iterator xe, XPathResult& res) {
00085      if(value == NULL)
00086           return;
00087      if(xp == xe) {
00088           res.push_back(value);
00089           return;
00090      }
00091      if(xp->type == XP_ELEMENT) {
00092           XPath::const_iterator xpp = xp;
00093           if(xpp != xe)
00094                xpp++;
00095           else
00096                return;
00097           if(xp->text == "nm" || xp->text == "*") {
00098                typeof(value->nms.begin()) i = value->nms.begin(), ie = value->nms.end();
00099                if(xpp != xe) {
00100                     xpath_iterator<country::nm> it(this, NULL);
00101                     for(;i != ie;i++) {
00102                          it.setValue(*i);
00103                          it.getValueByPath(xpp, xe, res);
00104                     }
00105                } else {
00106                     for(;i != ie;i++)
00107                          res.push_back(*i);
00108                }
00109           }
00110           if(xp->text == "population" || xp->text == "*") {
00111                typeof(value->populations.begin()) i = value->populations.begin(), ie = value->populations.end();
00112                if(xpp != xe) {
00113                     xpath_iterator<country::population> it(this, NULL);
00114                     for(;i != ie;i++) {
00115                          it.setValue(*i);
00116                          it.getValueByPath(xpp, xe, res);
00117                     }
00118                } else {
00119                     for(;i != ie;i++)
00120                          res.push_back(*i);
00121                }
00122           }
00123           if(xp->text == ".." && parent != NULL)
00124                parent->getValueByPath(xpp, xe, res);
00125      }
00126 }
00127 
00128 bool xpath_iterator<country::Country>::checkPathCondition(XPath::const_iterator xp, XPath::const_iterator xe) {
00129      if(value == NULL)
00130           return false;
00131      if(xp == xe)
00132           return true;
00133      if(xp->type == XP_ELEMENT) {
00134           XPath::const_iterator xpp = xp;
00135           if(xpp != xe)
00136                xpp++;
00137           else
00138                return false;
00139           if(xp->text == "nm" || xp->text == "*") {
00140                typeof(value->nms.begin()) i = value->nms.begin(), ie = value->nms.end();
00141                if(xpp != xe) {
00142                     xpath_iterator<country::nm> it(this, NULL);
00143                     for(;i != ie;i++) {
00144                          it.setValue(*i);
00145                          if(it.checkPathCondition(xpp, xe))
00146                               return true;
00147                     }
00148                } else
00149                     return !(i == ie);
00150           }
00151           if(xp->text == "population" || xp->text == "*") {
00152                typeof(value->populations.begin()) i = value->populations.begin(), ie = value->populations.end();
00153                if(xpp != xe) {
00154                     xpath_iterator<country::population> it(this, NULL);
00155                     for(;i != ie;i++) {
00156                          it.setValue(*i);
00157                          if(it.checkPathCondition(xpp, xe))
00158                               return true;
00159                     }
00160                } else
00161                     return !(i == ie);
00162           }
00163           if(xp->text == ".." && parent != NULL)
00164                return parent->checkPathCondition(xpp, xe);
00165           return false;
00166      }
00167      return false;
00168 }
00169 
00170 void xpath_iterator<country::Country>::to_xml(std::ostream& out) {
00171      if(value)
00172 		::to_xml(*value, NULL, out);
00173 }
00174 

Документация по XDataServer. Последние изменения: Thu Jul 12 11:49:42 2007. Создано системой  doxygen 1.5.2