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