00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
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 #include "relation-pskel.hxx"
00040
00041 #include "tag-pskel.hxx"
00042
00043 #include "member-pskel.hxx"
00044
00045
00046
00047
00048 void relation_pskel::
00049 tag_parser (::tag_pskel& p)
00050 {
00051 this->tag_parser_ = &p;
00052 }
00053
00054 void relation_pskel::
00055 member_parser (::member_pskel& p)
00056 {
00057 this->member_parser_ = &p;
00058 }
00059
00060 void relation_pskel::
00061 id_parser (::xml_schema::long_pskel& p)
00062 {
00063 this->id_parser_ = &p;
00064 }
00065
00066 void relation_pskel::
00067 uid_parser (::xml_schema::long_pskel& p)
00068 {
00069 this->uid_parser_ = &p;
00070 }
00071
00072 void relation_pskel::
00073 user_parser (::xml_schema::string_pskel& p)
00074 {
00075 this->user_parser_ = &p;
00076 }
00077
00078 void relation_pskel::
00079 timestamp_parser (::xml_schema::date_time_pskel& p)
00080 {
00081 this->timestamp_parser_ = &p;
00082 }
00083
00084 void relation_pskel::
00085 changeset_parser (::xml_schema::int_pskel& p)
00086 {
00087 this->changeset_parser_ = &p;
00088 }
00089
00090 void relation_pskel::
00091 version_parser (::xml_schema::int_pskel& p)
00092 {
00093 this->version_parser_ = &p;
00094 }
00095
00096 void relation_pskel::
00097 visible_parser (::xml_schema::boolean_pskel& p)
00098 {
00099 this->visible_parser_ = &p;
00100 }
00101
00102 void relation_pskel::
00103 parsers (::tag_pskel& tag,
00104 ::member_pskel& member,
00105 ::xml_schema::long_pskel& id,
00106 ::xml_schema::long_pskel& uid,
00107 ::xml_schema::string_pskel& user,
00108 ::xml_schema::date_time_pskel& timestamp,
00109 ::xml_schema::int_pskel& changeset,
00110 ::xml_schema::int_pskel& version,
00111 ::xml_schema::boolean_pskel& visible)
00112 {
00113 this->tag_parser_ = &tag;
00114 this->member_parser_ = &member;
00115 this->id_parser_ = &id;
00116 this->uid_parser_ = &uid;
00117 this->user_parser_ = &user;
00118 this->timestamp_parser_ = ×tamp;
00119 this->changeset_parser_ = &changeset;
00120 this->version_parser_ = &version;
00121 this->visible_parser_ = &visible;
00122 }
00123
00124 relation_pskel::
00125 relation_pskel ()
00126 : tag_parser_ (0),
00127 member_parser_ (0),
00128 id_parser_ (0),
00129 uid_parser_ (0),
00130 user_parser_ (0),
00131 timestamp_parser_ (0),
00132 changeset_parser_ (0),
00133 version_parser_ (0),
00134 visible_parser_ (0),
00135 v_state_stack_ (sizeof (v_state_), &v_state_first_),
00136 v_state_attr_stack_ (sizeof (v_state_attr_), &v_state_attr_first_)
00137 {
00138 }
00139
00140
00141
00142
00143 void relation_pskel::
00144 tag (const std::pair<std::string, std::string>&)
00145 {
00146 }
00147
00148 void relation_pskel::
00149 member (const std::pair<std::string, std::shared_ptr<osm::Element> >&)
00150 {
00151 }
00152
00153 void relation_pskel::
00154 id (long long)
00155 {
00156 }
00157
00158 void relation_pskel::
00159 uid (long long)
00160 {
00161 }
00162
00163 void relation_pskel::
00164 user (const ::std::string&)
00165 {
00166 }
00167
00168 void relation_pskel::
00169 timestamp (const ::xml_schema::date_time&)
00170 {
00171 }
00172
00173 void relation_pskel::
00174 changeset (int)
00175 {
00176 }
00177
00178 void relation_pskel::
00179 version (int)
00180 {
00181 }
00182
00183 void relation_pskel::
00184 visible (bool)
00185 {
00186 }
00187
00188 #include <cassert>
00189
00190
00191
00192 bool relation_pskel::
00193 _start_element_impl (const ::xml_schema::ro_string& ns,
00194 const ::xml_schema::ro_string& n,
00195 const ::xml_schema::ro_string* t)
00196 {
00197 XSD_UNUSED (t);
00198
00199 v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00200 v_state_descr_* vd = vs.data + (vs.size - 1);
00201
00202 if (vd->func == 0 && vd->state == 0)
00203 {
00204 if (this->::xml_schema::complex_content::_start_element_impl (ns, n, t))
00205 return true;
00206 else
00207 vd->state = 1;
00208 }
00209
00210 while (vd->func != 0)
00211 {
00212 (this->*vd->func) (vd->state, vd->count, ns, n, t, true);
00213
00214 vd = vs.data + (vs.size - 1);
00215
00216 if (vd->state == ~0UL)
00217 vd = vs.data + (--vs.size - 1);
00218 else
00219 break;
00220 }
00221
00222 if (vd->func == 0)
00223 {
00224 if (vd->state != ~0UL)
00225 {
00226 unsigned long s = ~0UL;
00227
00228 if (n == "tag" && ns.empty ())
00229 s = 0UL;
00230 else if (n == "member" && ns.empty ())
00231 s = 1UL;
00232
00233 if (s != ~0UL)
00234 {
00235 vd->count++;
00236
00237 vd = vs.data + vs.size++;
00238 vd->func = &relation_pskel::choice_0;
00239 vd->state = s;
00240 vd->count = 0;
00241
00242 this->choice_0 (vd->state, vd->count, ns, n, t, true);
00243 }
00244 else
00245 {
00246 if (vd->count < 1UL)
00247 this->_expected_element (
00248 "", "tag",
00249 ns, n);
00250 return false;
00251 }
00252 }
00253 else
00254 return false;
00255 }
00256
00257 return true;
00258 }
00259
00260 bool relation_pskel::
00261 _end_element_impl (const ::xml_schema::ro_string& ns,
00262 const ::xml_schema::ro_string& n)
00263 {
00264 v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00265 v_state_descr_& vd = vs.data[vs.size - 1];
00266
00267 if (vd.func == 0 && vd.state == 0)
00268 {
00269 if (!::xml_schema::complex_content::_end_element_impl (ns, n))
00270 assert (false);
00271 return true;
00272 }
00273
00274 assert (vd.func != 0);
00275 (this->*vd.func) (vd.state, vd.count, ns, n, 0, false);
00276
00277 if (vd.state == ~0UL)
00278 vs.size--;
00279
00280 return true;
00281 }
00282
00283 void relation_pskel::
00284 _pre_e_validate ()
00285 {
00286 this->v_state_stack_.push ();
00287 static_cast< v_state_* > (this->v_state_stack_.top ())->size = 0;
00288
00289 v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00290 v_state_descr_& vd = vs.data[vs.size++];
00291
00292 vd.func = 0;
00293 vd.state = 0;
00294 vd.count = 0;
00295 }
00296
00297 void relation_pskel::
00298 _post_e_validate ()
00299 {
00300 v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
00301 v_state_descr_* vd = vs.data + (vs.size - 1);
00302
00303 ::xml_schema::ro_string empty;
00304 while (vd->func != 0)
00305 {
00306 (this->*vd->func) (vd->state, vd->count, empty, empty, 0, true);
00307 assert (vd->state == ~0UL);
00308 vd = vs.data + (--vs.size - 1);
00309 }
00310
00311 if (vd->count < 1UL)
00312 this->_expected_element (
00313 "", "tag");
00314
00315 this->v_state_stack_.pop ();
00316 }
00317
00318 void relation_pskel::
00319 choice_0 (unsigned long& state,
00320 unsigned long& count,
00321 const ::xml_schema::ro_string& ns,
00322 const ::xml_schema::ro_string& n,
00323 const ::xml_schema::ro_string* t,
00324 bool start)
00325 {
00326 XSD_UNUSED (count);
00327 XSD_UNUSED (ns);
00328 XSD_UNUSED (n);
00329 XSD_UNUSED (t);
00330
00331 switch (state)
00332 {
00333 case 0UL:
00334 {
00335 if (start)
00336 {
00337 this->::xml_schema::complex_content::context_.top ().parser_ = this->tag_parser_;
00338
00339 if (this->tag_parser_)
00340 this->tag_parser_->pre ();
00341 }
00342 else
00343 {
00344 if (this->tag_parser_)
00345 {
00346 const std::pair<std::string, std::string>& tmp (this->tag_parser_->post_tag ());
00347 this->tag (tmp);
00348 }
00349
00350 state = ~0UL;
00351 }
00352
00353 break;
00354 }
00355 case 1UL:
00356 {
00357 if (start)
00358 {
00359 this->::xml_schema::complex_content::context_.top ().parser_ = this->member_parser_;
00360
00361 if (this->member_parser_)
00362 this->member_parser_->pre ();
00363 }
00364 else
00365 {
00366 if (this->member_parser_)
00367 {
00368 const std::pair<std::string, std::shared_ptr<osm::Element> >& tmp (this->member_parser_->post_member ());
00369 this->member (tmp);
00370 }
00371
00372 state = ~0UL;
00373 }
00374
00375 break;
00376 }
00377 }
00378 }
00379
00380
00381
00382 bool relation_pskel::
00383 _attribute_impl_phase_one (const ::xml_schema::ro_string& ns,
00384 const ::xml_schema::ro_string& n,
00385 const ::xml_schema::ro_string& s)
00386 {
00387 if (n == "id" && ns.empty ())
00388 {
00389 if (this->id_parser_)
00390 {
00391 this->id_parser_->pre ();
00392 this->id_parser_->_pre_impl ();
00393 this->id_parser_->_characters (s);
00394 this->id_parser_->_post_impl ();
00395 long long tmp (this->id_parser_->post_long ());
00396 this->id (tmp);
00397 }
00398
00399 static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->id = true;
00400 return true;
00401 }
00402
00403 if (n == "uid" && ns.empty ())
00404 {
00405 if (this->uid_parser_)
00406 {
00407 this->uid_parser_->pre ();
00408 this->uid_parser_->_pre_impl ();
00409 this->uid_parser_->_characters (s);
00410 this->uid_parser_->_post_impl ();
00411 long long tmp (this->uid_parser_->post_long ());
00412 this->uid (tmp);
00413 }
00414
00415 return true;
00416 }
00417
00418 if (n == "user" && ns.empty ())
00419 {
00420 if (this->user_parser_)
00421 {
00422 this->user_parser_->pre ();
00423 this->user_parser_->_pre_impl ();
00424 this->user_parser_->_characters (s);
00425 this->user_parser_->_post_impl ();
00426 const ::std::string& tmp (this->user_parser_->post_string ());
00427 this->user (tmp);
00428 }
00429
00430 return true;
00431 }
00432
00433 if (n == "timestamp" && ns.empty ())
00434 {
00435 if (this->timestamp_parser_)
00436 {
00437 this->timestamp_parser_->pre ();
00438 this->timestamp_parser_->_pre_impl ();
00439 this->timestamp_parser_->_characters (s);
00440 this->timestamp_parser_->_post_impl ();
00441 const ::xml_schema::date_time& tmp (this->timestamp_parser_->post_date_time ());
00442 this->timestamp (tmp);
00443 }
00444
00445 return true;
00446 }
00447
00448 if (n == "changeset" && ns.empty ())
00449 {
00450 if (this->changeset_parser_)
00451 {
00452 this->changeset_parser_->pre ();
00453 this->changeset_parser_->_pre_impl ();
00454 this->changeset_parser_->_characters (s);
00455 this->changeset_parser_->_post_impl ();
00456 int tmp (this->changeset_parser_->post_int ());
00457 this->changeset (tmp);
00458 }
00459
00460 return true;
00461 }
00462
00463 if (n == "version" && ns.empty ())
00464 {
00465 if (this->version_parser_)
00466 {
00467 this->version_parser_->pre ();
00468 this->version_parser_->_pre_impl ();
00469 this->version_parser_->_characters (s);
00470 this->version_parser_->_post_impl ();
00471 int tmp (this->version_parser_->post_int ());
00472 this->version (tmp);
00473 }
00474
00475 return true;
00476 }
00477
00478 if (n == "visible" && ns.empty ())
00479 {
00480 if (this->visible_parser_)
00481 {
00482 this->visible_parser_->pre ();
00483 this->visible_parser_->_pre_impl ();
00484 this->visible_parser_->_characters (s);
00485 this->visible_parser_->_post_impl ();
00486 bool tmp (this->visible_parser_->post_boolean ());
00487 this->visible (tmp);
00488 }
00489
00490 return true;
00491 }
00492
00493 return false;
00494 }
00495
00496 void relation_pskel::
00497 _pre_a_validate ()
00498 {
00499 this->v_state_attr_stack_.push ();
00500 v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());
00501
00502 as.id = false;
00503 }
00504
00505 void relation_pskel::
00506 _post_a_validate ()
00507 {
00508 v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());
00509
00510 if (!as.id)
00511 this->_expected_attribute (
00512 "", "id");
00513
00514 this->v_state_attr_stack_.pop ();
00515 }
00516
00517
00518
00519
00520
00521