/home/martin/workspace/OpenStreetNav/src/xmlparse/xml/osm-pskel.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2005-2010 Code Synthesis Tools CC
00002 //
00003 // This program was generated by CodeSynthesis XSD, an XML Schema to
00004 // C++ data binding compiler.
00005 //
00006 // This program is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License version 2 as
00008 // published by the Free Software Foundation.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00018 //
00019 // In addition, as a special exception, Code Synthesis Tools CC gives
00020 // permission to link this program with the Xerces-C++ library (or with
00021 // modified versions of Xerces-C++ that use the same license as Xerces-C++),
00022 // and distribute linked combinations including the two. You must obey
00023 // the GNU General Public License version 2 in all respects for all of
00024 // the code used other than Xerces-C++. If you modify this copy of the
00025 // program, you may extend this exception to your version of the program,
00026 // but you are not obligated to do so. If you do not wish to do so, delete
00027 // this exception statement from your version.
00028 //
00029 // Furthermore, Code Synthesis Tools CC makes a special exception for
00030 // the Free/Libre and Open Source Software (FLOSS) which is described
00031 // in the accompanying FLOSSE file.
00032 //
00033 
00034 // Begin prologue.
00035 //
00036 //
00037 // End prologue.
00038 
00039 #include "osm-pskel.hxx"
00040 
00041 #include "bound-pskel.hxx"
00042 
00043 #include "node-pskel.hxx"
00044 
00045 #include "way-pskel.hxx"
00046 
00047 #include "relation-pskel.hxx"
00048 
00049 // osm_pskel
00050 //
00051 
00052 void osm_pskel::
00053 bound_parser (::bound_pskel& p)
00054 {
00055   this->bound_parser_ = &p;
00056 }
00057 
00058 void osm_pskel::
00059 node_parser (::node_pskel& p)
00060 {
00061   this->node_parser_ = &p;
00062 }
00063 
00064 void osm_pskel::
00065 way_parser (::way_pskel& p)
00066 {
00067   this->way_parser_ = &p;
00068 }
00069 
00070 void osm_pskel::
00071 relation_parser (::relation_pskel& p)
00072 {
00073   this->relation_parser_ = &p;
00074 }
00075 
00076 void osm_pskel::
00077 version_parser (::xml_schema::string_pskel& p)
00078 {
00079   this->version_parser_ = &p;
00080 }
00081 
00082 void osm_pskel::
00083 generator_parser (::xml_schema::string_pskel& p)
00084 {
00085   this->generator_parser_ = &p;
00086 }
00087 
00088 void osm_pskel::
00089 parsers (::bound_pskel& bound,
00090          ::node_pskel& node,
00091          ::way_pskel& way,
00092          ::relation_pskel& relation,
00093          ::xml_schema::string_pskel& version,
00094          ::xml_schema::string_pskel& generator)
00095 {
00096   this->bound_parser_ = &bound;
00097   this->node_parser_ = &node;
00098   this->way_parser_ = &way;
00099   this->relation_parser_ = &relation;
00100   this->version_parser_ = &version;
00101   this->generator_parser_ = &generator;
00102 }
00103 
00104 osm_pskel::
00105 osm_pskel ()
00106 : bound_parser_ (0),
00107   node_parser_ (0),
00108   way_parser_ (0),
00109   relation_parser_ (0),
00110   version_parser_ (0),
00111   generator_parser_ (0),
00112   v_state_stack_ (sizeof (v_state_), &v_state_first_),
00113   v_state_attr_stack_ (sizeof (v_state_attr_), &v_state_attr_first_)
00114 {
00115 }
00116 
00117 // osm_pskel
00118 //
00119 
00120 void osm_pskel::
00121 bound ()
00122 {
00123 }
00124 
00125 void osm_pskel::
00126 node (const osm::Node&)
00127 {
00128 }
00129 
00130 void osm_pskel::
00131 way (const osm::Way&)
00132 {
00133 }
00134 
00135 void osm_pskel::
00136 relation (const osm::Relation&)
00137 {
00138 }
00139 
00140 void osm_pskel::
00141 version (const ::std::string&)
00142 {
00143 }
00144 
00145 void osm_pskel::
00146 generator (const ::std::string&)
00147 {
00148 }
00149 
00150 void osm_pskel::
00151 post_osm ()
00152 {
00153 }
00154 
00155 #include <cassert>
00156 
00157 // Element validation and dispatch functions for osm_pskel.
00158 //
00159 bool osm_pskel::
00160 _start_element_impl (const ::xml_schema::ro_string& ns,
00161                      const ::xml_schema::ro_string& n,
00162                      const ::xml_schema::ro_string* t)
00163 {
00164   XSD_UNUSED (t);
00165 
00166   v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00167   v_state_descr_* vd = vs.data + (vs.size - 1);
00168 
00169   if (vd->func == 0 && vd->state == 0)
00170   {
00171     if (this->::xml_schema::complex_content::_start_element_impl (ns, n, t))
00172       return true;
00173     else
00174       vd->state = 1;
00175   }
00176 
00177   while (vd->func != 0)
00178   {
00179     (this->*vd->func) (vd->state, vd->count, ns, n, t, true);
00180 
00181     vd = vs.data + (vs.size - 1);
00182 
00183     if (vd->state == ~0UL)
00184       vd = vs.data + (--vs.size - 1);
00185     else
00186       break;
00187   }
00188 
00189   if (vd->func == 0)
00190   {
00191     if (vd->state != ~0UL)
00192     {
00193       unsigned long s = ~0UL;
00194 
00195       if (n == "bound" && ns.empty ())
00196         s = 0UL;
00197       else if ((n == "node" && ns.empty ()) ||
00198                (n == "way" && ns.empty ()) ||
00199                (n == "relation" && ns.empty ()))
00200         s = 1UL;
00201 
00202       if (s != ~0UL)
00203       {
00204         vd->count++;
00205         vd->state = ~0UL;
00206 
00207         vd = vs.data + vs.size++;
00208         vd->func = &osm_pskel::sequence_0;
00209         vd->state = s;
00210         vd->count = 0;
00211 
00212         this->sequence_0 (vd->state, vd->count, ns, n, t, true);
00213       }
00214       else
00215       {
00216         if (vd->count < 1UL)
00217           this->_expected_element (
00218             "", "bound",
00219             ns, n);
00220         return false;
00221       }
00222     }
00223     else
00224       return false;
00225   }
00226 
00227   return true;
00228 }
00229 
00230 bool osm_pskel::
00231 _end_element_impl (const ::xml_schema::ro_string& ns,
00232                    const ::xml_schema::ro_string& n)
00233 {
00234   v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00235   v_state_descr_& vd = vs.data[vs.size - 1];
00236 
00237   if (vd.func == 0 && vd.state == 0)
00238   {
00239     if (!::xml_schema::complex_content::_end_element_impl (ns, n))
00240       assert (false);
00241     return true;
00242   }
00243 
00244   assert (vd.func != 0);
00245   (this->*vd.func) (vd.state, vd.count, ns, n, 0, false);
00246 
00247   if (vd.state == ~0UL)
00248     vs.size--;
00249 
00250   return true;
00251 }
00252 
00253 void osm_pskel::
00254 _pre_e_validate ()
00255 {
00256   this->v_state_stack_.push ();
00257   static_cast< v_state_* > (this->v_state_stack_.top ())->size = 0;
00258 
00259   v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00260   v_state_descr_& vd = vs.data[vs.size++];
00261 
00262   vd.func = 0;
00263   vd.state = 0;
00264   vd.count = 0;
00265 }
00266 
00267 void osm_pskel::
00268 _post_e_validate ()
00269 {
00270   v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00271   v_state_descr_* vd = vs.data + (vs.size - 1);
00272 
00273   ::xml_schema::ro_string empty;
00274   while (vd->func != 0)
00275   {
00276     (this->*vd->func) (vd->state, vd->count, empty, empty, 0, true);
00277     assert (vd->state == ~0UL);
00278     vd = vs.data + (--vs.size - 1);
00279   }
00280 
00281   if (vd->count < 1UL)
00282     this->_expected_element (
00283       "", "bound");
00284 
00285   this->v_state_stack_.pop ();
00286 }
00287 
00288 void osm_pskel::
00289 sequence_0 (unsigned long& state,
00290             unsigned long& count,
00291             const ::xml_schema::ro_string& ns,
00292             const ::xml_schema::ro_string& n,
00293             const ::xml_schema::ro_string* t,
00294             bool start)
00295 {
00296   XSD_UNUSED (t);
00297 
00298   switch (state)
00299   {
00300     case 0UL:
00301     {
00302       if (n == "bound" && ns.empty ())
00303       {
00304         if (start)
00305         {
00306           this->::xml_schema::complex_content::context_.top ().parser_ = this->bound_parser_;
00307 
00308           if (this->bound_parser_)
00309             this->bound_parser_->pre ();
00310         }
00311         else
00312         {
00313           if (this->bound_parser_)
00314           {
00315             this->bound_parser_->post_bound ();
00316             this->bound ();
00317           }
00318 
00319           count = 0;
00320           state = 1UL;
00321         }
00322 
00323         break;
00324       }
00325       else
00326       {
00327         assert (start);
00328         count = 0;
00329         state = 1UL;
00330         // Fall through.
00331       }
00332     }
00333     case 1UL:
00334     {
00335       unsigned long s (~0UL);
00336 
00337       if (n == "node" && ns.empty ())
00338         s = 0UL;
00339       else if (n == "way" && ns.empty ())
00340         s = 1UL;
00341       else if (n == "relation" && ns.empty ())
00342         s = 2UL;
00343 
00344       if (s != ~0UL)
00345       {
00346         assert (start);
00347         count++;
00348 
00349         v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00350         v_state_descr_& vd = vs.data[vs.size++];
00351 
00352         vd.func = &osm_pskel::choice_0;
00353         vd.state = s;
00354         vd.count = 0;
00355 
00356         this->choice_0 (vd.state, vd.count, ns, n, t, true);
00357         break;
00358       }
00359       else
00360       {
00361         assert (start);
00362         if (count < 1UL)
00363           this->_expected_element (
00364             "", "node",
00365             ns, n);
00366         count = 0;
00367         state = ~0UL;
00368         // Fall through.
00369       }
00370     }
00371     case ~0UL:
00372       break;
00373   }
00374 }
00375 
00376 void osm_pskel::
00377 choice_0 (unsigned long& state,
00378           unsigned long& count,
00379           const ::xml_schema::ro_string& ns,
00380           const ::xml_schema::ro_string& n,
00381           const ::xml_schema::ro_string* t,
00382           bool start)
00383 {
00384   XSD_UNUSED (count);
00385   XSD_UNUSED (ns);
00386   XSD_UNUSED (n);
00387   XSD_UNUSED (t);
00388 
00389   switch (state)
00390   {
00391     case 0UL:
00392     {
00393       if (start)
00394       {
00395         this->::xml_schema::complex_content::context_.top ().parser_ = this->node_parser_;
00396 
00397         if (this->node_parser_)
00398           this->node_parser_->pre ();
00399       }
00400       else
00401       {
00402         if (this->node_parser_)
00403         {
00404           const osm::Node& tmp (this->node_parser_->post_node ());
00405           this->node (tmp);
00406         }
00407 
00408         state = ~0UL;
00409       }
00410 
00411       break;
00412     }
00413     case 1UL:
00414     {
00415       if (start)
00416       {
00417         this->::xml_schema::complex_content::context_.top ().parser_ = this->way_parser_;
00418 
00419         if (this->way_parser_)
00420           this->way_parser_->pre ();
00421       }
00422       else
00423       {
00424         if (this->way_parser_)
00425         {
00426           const osm::Way& tmp (this->way_parser_->post_way ());
00427           this->way (tmp);
00428         }
00429 
00430         state = ~0UL;
00431       }
00432 
00433       break;
00434     }
00435     case 2UL:
00436     {
00437       if (start)
00438       {
00439         this->::xml_schema::complex_content::context_.top ().parser_ = this->relation_parser_;
00440 
00441         if (this->relation_parser_)
00442           this->relation_parser_->pre ();
00443       }
00444       else
00445       {
00446         if (this->relation_parser_)
00447         {
00448           const osm::Relation& tmp (this->relation_parser_->post_relation ());
00449           this->relation (tmp);
00450         }
00451 
00452         state = ~0UL;
00453       }
00454 
00455       break;
00456     }
00457   }
00458 }
00459 
00460 // Attribute validation and dispatch functions for osm_pskel.
00461 //
00462 bool osm_pskel::
00463 _attribute_impl_phase_one (const ::xml_schema::ro_string& ns,
00464                            const ::xml_schema::ro_string& n,
00465                            const ::xml_schema::ro_string& s)
00466 {
00467   if (n == "version" && ns.empty ())
00468   {
00469     if (this->version_parser_)
00470     {
00471       this->version_parser_->pre ();
00472       this->version_parser_->_pre_impl ();
00473       this->version_parser_->_characters (s);
00474       this->version_parser_->_post_impl ();
00475       const ::std::string& tmp (this->version_parser_->post_string ());
00476       this->version (tmp);
00477     }
00478 
00479     static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->version = true;
00480     return true;
00481   }
00482 
00483   if (n == "generator" && ns.empty ())
00484   {
00485     if (this->generator_parser_)
00486     {
00487       this->generator_parser_->pre ();
00488       this->generator_parser_->_pre_impl ();
00489       this->generator_parser_->_characters (s);
00490       this->generator_parser_->_post_impl ();
00491       const ::std::string& tmp (this->generator_parser_->post_string ());
00492       this->generator (tmp);
00493     }
00494 
00495     return true;
00496   }
00497 
00498   return false;
00499 }
00500 
00501 void osm_pskel::
00502 _pre_a_validate ()
00503 {
00504   this->v_state_attr_stack_.push ();
00505   v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());
00506 
00507   as.version = false;
00508 }
00509 
00510 void osm_pskel::
00511 _post_a_validate ()
00512 {
00513   v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());
00514 
00515   if (!as.version)
00516     this->_expected_attribute (
00517       "", "version");
00518 
00519   this->v_state_attr_stack_.pop ();
00520 }
00521 
00522 // Begin epilogue.
00523 //
00524 //
00525 // End epilogue.
00526 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines