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