[111] | 1 | // file : xsd/cxx/tree/exceptions.hxx |
---|
| 2 | // author : Boris Kolpackov <boris@codesynthesis.com> |
---|
| 3 | // copyright : Copyright (c) 2005-2008 Code Synthesis Tools CC |
---|
| 4 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file |
---|
| 5 | |
---|
| 6 | /** |
---|
| 7 | * @file |
---|
| 8 | * |
---|
| 9 | * @brief Contains exception definitions for the C++/Tree mapping. |
---|
| 10 | * |
---|
| 11 | * This is an internal header and is included by the generated code. |
---|
| 12 | * You normally should not include it directly. |
---|
| 13 | * |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #ifndef XSD_CXX_TREE_EXCEPTIONS_HXX |
---|
| 17 | #define XSD_CXX_TREE_EXCEPTIONS_HXX |
---|
| 18 | |
---|
| 19 | #include <string> |
---|
| 20 | #include <vector> |
---|
| 21 | #include <ostream> |
---|
| 22 | |
---|
| 23 | #include <xsd/cxx/exceptions.hxx> // xsd::cxx::exception |
---|
| 24 | |
---|
| 25 | namespace xsd |
---|
| 26 | { |
---|
| 27 | namespace cxx |
---|
| 28 | { |
---|
| 29 | /** |
---|
| 30 | * @brief C++/Tree mapping runtime namespace. |
---|
| 31 | * |
---|
| 32 | * This is an internal namespace and normally should not be referenced |
---|
| 33 | * directly. Instead you should use the aliases for types in this |
---|
| 34 | * namespaces that are created in the generated code. |
---|
| 35 | * |
---|
| 36 | */ |
---|
| 37 | namespace tree |
---|
| 38 | { |
---|
| 39 | /** |
---|
| 40 | * @brief Root of the C++/Tree %exception hierarchy. |
---|
| 41 | * |
---|
| 42 | * You can catch this %exception in order to handle all C++/Tree |
---|
| 43 | * errors. |
---|
| 44 | * |
---|
| 45 | * @nosubgrouping |
---|
| 46 | */ |
---|
| 47 | template <typename C> |
---|
| 48 | class exception: public xsd::cxx::exception |
---|
| 49 | { |
---|
| 50 | public: |
---|
| 51 | /** |
---|
| 52 | * @brief Stream insertion operator for %exception. |
---|
| 53 | */ |
---|
| 54 | friend |
---|
| 55 | std::basic_ostream<C>& |
---|
| 56 | operator<< (std::basic_ostream<C>& os, const exception& e) |
---|
| 57 | { |
---|
| 58 | e.print (os); |
---|
| 59 | return os; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | protected: |
---|
| 63 | //@cond |
---|
| 64 | |
---|
| 65 | virtual void |
---|
| 66 | print (std::basic_ostream<C>&) const = 0; |
---|
| 67 | |
---|
| 68 | //@endcond |
---|
| 69 | }; |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * @brief Error %severity. |
---|
| 74 | * |
---|
| 75 | * @nosubgrouping |
---|
| 76 | */ |
---|
| 77 | class severity |
---|
| 78 | { |
---|
| 79 | public: |
---|
| 80 | /** |
---|
| 81 | * @brief Underlying enum type. |
---|
| 82 | */ |
---|
| 83 | enum value |
---|
| 84 | { |
---|
| 85 | /** |
---|
| 86 | * @brief Indicates the warning condition. |
---|
| 87 | */ |
---|
| 88 | warning, |
---|
| 89 | |
---|
| 90 | /** |
---|
| 91 | * @brief Indicates the %error condition. |
---|
| 92 | */ |
---|
| 93 | error |
---|
| 94 | }; |
---|
| 95 | |
---|
| 96 | /** |
---|
| 97 | * @brief Initialize an instance with the underlying enum value. |
---|
| 98 | * |
---|
| 99 | * @param v An underlying enum value. |
---|
| 100 | */ |
---|
| 101 | severity (value v) : v_ (v) {} |
---|
| 102 | |
---|
| 103 | /** |
---|
| 104 | * @brief Implicitly convert the instance to the underlying enum |
---|
| 105 | * value. |
---|
| 106 | * |
---|
| 107 | * @return The underlying enum value. |
---|
| 108 | */ |
---|
| 109 | operator value () const { return v_; } |
---|
| 110 | |
---|
| 111 | private: |
---|
| 112 | value v_; |
---|
| 113 | }; |
---|
| 114 | |
---|
| 115 | /** |
---|
| 116 | * @brief Error condition. |
---|
| 117 | * |
---|
| 118 | * @nosubgrouping |
---|
| 119 | */ |
---|
| 120 | template <typename C> |
---|
| 121 | class error |
---|
| 122 | { |
---|
| 123 | public: |
---|
| 124 | /** |
---|
| 125 | * @brief Initialize an instance with %error description. |
---|
| 126 | * |
---|
| 127 | * @param s An %error %severity. |
---|
| 128 | * @param res_id A resource %id where the %error occurred. |
---|
| 129 | * @param line A line number where the %error occurred. |
---|
| 130 | * @param column A column number where the %error occurred. |
---|
| 131 | * @param message A message describing the %error. |
---|
| 132 | */ |
---|
| 133 | error (tree::severity s, |
---|
| 134 | const std::basic_string<C>& res_id, |
---|
| 135 | unsigned long line, |
---|
| 136 | unsigned long column, |
---|
| 137 | const std::basic_string<C>& message); |
---|
| 138 | |
---|
| 139 | /** |
---|
| 140 | * @brief Get %error %severity. |
---|
| 141 | * |
---|
| 142 | * @return The %severity of this %error. |
---|
| 143 | */ |
---|
| 144 | tree::severity |
---|
| 145 | severity () const |
---|
| 146 | { |
---|
| 147 | return severity_; |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | /** |
---|
| 151 | * @brief Get resource %id. |
---|
| 152 | * |
---|
| 153 | * @return The %id of the resource where this %error occurred. |
---|
| 154 | */ |
---|
| 155 | const std::basic_string<C>& |
---|
| 156 | id () const |
---|
| 157 | { |
---|
| 158 | return id_; |
---|
| 159 | } |
---|
| 160 | |
---|
| 161 | /** |
---|
| 162 | * @brief Get %error line. |
---|
| 163 | * |
---|
| 164 | * @return The line number where this %error occurred. |
---|
| 165 | */ |
---|
| 166 | unsigned long |
---|
| 167 | line () const |
---|
| 168 | { |
---|
| 169 | return line_; |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | /** |
---|
| 173 | * @brief Get %error column. |
---|
| 174 | * |
---|
| 175 | * @return The column number where this %error occurred. |
---|
| 176 | */ |
---|
| 177 | unsigned long |
---|
| 178 | column () const |
---|
| 179 | { |
---|
| 180 | return column_; |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | /** |
---|
| 184 | * @brief Get %error message. |
---|
| 185 | * |
---|
| 186 | * @return The message for this %error. |
---|
| 187 | */ |
---|
| 188 | const std::basic_string<C>& |
---|
| 189 | message () const |
---|
| 190 | { |
---|
| 191 | return message_; |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | private: |
---|
| 195 | tree::severity severity_; |
---|
| 196 | std::basic_string<C> id_; |
---|
| 197 | unsigned long line_; |
---|
| 198 | unsigned long column_; |
---|
| 199 | std::basic_string<C> message_; |
---|
| 200 | }; |
---|
| 201 | |
---|
| 202 | // See exceptions.ixx for operator<< (error). |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | /** |
---|
| 206 | * @brief List of %error conditions. |
---|
| 207 | * |
---|
| 208 | * @nosubgrouping |
---|
| 209 | */ |
---|
| 210 | template <typename C> |
---|
| 211 | class diagnostics: public std::vector<error<C> > |
---|
| 212 | { |
---|
| 213 | }; |
---|
| 214 | |
---|
| 215 | // See exceptions.ixx for operator<< (diagnostics). |
---|
| 216 | |
---|
| 217 | /** |
---|
| 218 | * @brief Exception indicating a %parsing failure. |
---|
| 219 | * |
---|
| 220 | * @nosubgrouping |
---|
| 221 | */ |
---|
| 222 | template <typename C> |
---|
| 223 | class parsing: public exception<C> |
---|
| 224 | { |
---|
| 225 | public: |
---|
| 226 | virtual |
---|
| 227 | ~parsing () throw (); |
---|
| 228 | |
---|
| 229 | /** |
---|
| 230 | * @brief Default constructor. |
---|
| 231 | */ |
---|
| 232 | parsing (); |
---|
| 233 | |
---|
| 234 | /** |
---|
| 235 | * @brief Initialize an instance with a %list of %error conditions. |
---|
| 236 | * |
---|
| 237 | * @param d A %list of %error conditions. |
---|
| 238 | */ |
---|
| 239 | parsing (const tree::diagnostics<C>& d); |
---|
| 240 | |
---|
| 241 | public: |
---|
| 242 | /** |
---|
| 243 | * @brief Get the %list of %error conditions. |
---|
| 244 | * |
---|
| 245 | * @return The %list of %error conditions. |
---|
| 246 | */ |
---|
| 247 | const tree::diagnostics<C>& |
---|
| 248 | diagnostics () const |
---|
| 249 | { |
---|
| 250 | return diagnostics_; |
---|
| 251 | } |
---|
| 252 | |
---|
| 253 | /** |
---|
| 254 | * @brief Get %exception description. |
---|
| 255 | * |
---|
| 256 | * @return A C %string describing the %exception. |
---|
| 257 | */ |
---|
| 258 | virtual const char* |
---|
| 259 | what () const throw (); |
---|
| 260 | |
---|
| 261 | protected: |
---|
| 262 | //@cond |
---|
| 263 | |
---|
| 264 | virtual void |
---|
| 265 | print (std::basic_ostream<C>&) const; |
---|
| 266 | |
---|
| 267 | //@endcond |
---|
| 268 | |
---|
| 269 | private: |
---|
| 270 | tree::diagnostics<C> diagnostics_; |
---|
| 271 | }; |
---|
| 272 | |
---|
| 273 | |
---|
| 274 | /** |
---|
| 275 | * @brief Exception indicating that an expected element was not |
---|
| 276 | * encountered. |
---|
| 277 | * |
---|
| 278 | * @nosubgrouping |
---|
| 279 | */ |
---|
| 280 | template <typename C> |
---|
| 281 | class expected_element: public exception<C> |
---|
| 282 | { |
---|
| 283 | public: |
---|
| 284 | virtual |
---|
| 285 | ~expected_element () throw (); |
---|
| 286 | |
---|
| 287 | /** |
---|
| 288 | * @brief Initialize an instance with the expected element |
---|
| 289 | * description. |
---|
| 290 | * |
---|
| 291 | * @param name A name of the expected element. |
---|
| 292 | * @param ns A namespace of the expected element. |
---|
| 293 | */ |
---|
| 294 | expected_element (const std::basic_string<C>& name, |
---|
| 295 | const std::basic_string<C>& ns); |
---|
| 296 | |
---|
| 297 | |
---|
| 298 | public: |
---|
| 299 | /** |
---|
| 300 | * @brief Get the name of the expected element. |
---|
| 301 | * |
---|
| 302 | * @return The name of the expected element. |
---|
| 303 | */ |
---|
| 304 | const std::basic_string<C>& |
---|
| 305 | name () const |
---|
| 306 | { |
---|
| 307 | return name_; |
---|
| 308 | } |
---|
| 309 | |
---|
| 310 | /** |
---|
| 311 | * @brief Get the namespace of the expected element. |
---|
| 312 | * |
---|
| 313 | * @return The namespace of the expected element. |
---|
| 314 | */ |
---|
| 315 | const std::basic_string<C>& |
---|
| 316 | namespace_ () const |
---|
| 317 | { |
---|
| 318 | return namespace__; |
---|
| 319 | } |
---|
| 320 | |
---|
| 321 | /** |
---|
| 322 | * @brief Get %exception description. |
---|
| 323 | * |
---|
| 324 | * @return A C %string describing the %exception. |
---|
| 325 | */ |
---|
| 326 | virtual const char* |
---|
| 327 | what () const throw (); |
---|
| 328 | |
---|
| 329 | protected: |
---|
| 330 | //@cond |
---|
| 331 | |
---|
| 332 | virtual void |
---|
| 333 | print (std::basic_ostream<C>&) const; |
---|
| 334 | |
---|
| 335 | //@endcond |
---|
| 336 | |
---|
| 337 | private: |
---|
| 338 | std::basic_string<C> name_; |
---|
| 339 | std::basic_string<C> namespace__; |
---|
| 340 | }; |
---|
| 341 | |
---|
| 342 | |
---|
| 343 | /** |
---|
| 344 | * @brief Exception indicating that an unexpected element was |
---|
| 345 | * encountered. |
---|
| 346 | * |
---|
| 347 | * @nosubgrouping |
---|
| 348 | */ |
---|
| 349 | template <typename C> |
---|
| 350 | class unexpected_element: public exception<C> |
---|
| 351 | { |
---|
| 352 | public: |
---|
| 353 | virtual |
---|
| 354 | ~unexpected_element () throw (); |
---|
| 355 | |
---|
| 356 | /** |
---|
| 357 | * @brief Initialize an instance with the encountered and expected |
---|
| 358 | * element descriptions. |
---|
| 359 | * |
---|
| 360 | * @param encountered_name A name of the encountered element. |
---|
| 361 | * @param encountered_ns A namespace of the encountered element. |
---|
| 362 | * @param expected_name A name of the expected element. |
---|
| 363 | * @param expected_ns A namespace of the expected element. |
---|
| 364 | */ |
---|
| 365 | unexpected_element (const std::basic_string<C>& encountered_name, |
---|
| 366 | const std::basic_string<C>& encountered_ns, |
---|
| 367 | const std::basic_string<C>& expected_name, |
---|
| 368 | const std::basic_string<C>& expected_ns); |
---|
| 369 | |
---|
| 370 | public: |
---|
| 371 | /** |
---|
| 372 | * @brief Get the name of the encountered element. |
---|
| 373 | * |
---|
| 374 | * @return The name of the encountered element. |
---|
| 375 | */ |
---|
| 376 | const std::basic_string<C>& |
---|
| 377 | encountered_name () const |
---|
| 378 | { |
---|
| 379 | return encountered_name_; |
---|
| 380 | } |
---|
| 381 | |
---|
| 382 | /** |
---|
| 383 | * @brief Get the namespace of the encountered element. |
---|
| 384 | * |
---|
| 385 | * @return The namespace of the encountered element. |
---|
| 386 | */ |
---|
| 387 | const std::basic_string<C>& |
---|
| 388 | encountered_namespace () const |
---|
| 389 | { |
---|
| 390 | return encountered_namespace_; |
---|
| 391 | } |
---|
| 392 | |
---|
| 393 | /** |
---|
| 394 | * @brief Get the name of the expected element. |
---|
| 395 | * |
---|
| 396 | * @return The name of the expected element. |
---|
| 397 | */ |
---|
| 398 | const std::basic_string<C>& |
---|
| 399 | expected_name () const |
---|
| 400 | { |
---|
| 401 | return expected_name_; |
---|
| 402 | } |
---|
| 403 | |
---|
| 404 | /** |
---|
| 405 | * @brief Get the namespace of the expected element. |
---|
| 406 | * |
---|
| 407 | * @return The namespace of the expected element. |
---|
| 408 | */ |
---|
| 409 | const std::basic_string<C>& |
---|
| 410 | expected_namespace () const |
---|
| 411 | { |
---|
| 412 | return expected_namespace_; |
---|
| 413 | } |
---|
| 414 | |
---|
| 415 | /** |
---|
| 416 | * @brief Get %exception description. |
---|
| 417 | * |
---|
| 418 | * @return A C %string describing the %exception. |
---|
| 419 | */ |
---|
| 420 | virtual const char* |
---|
| 421 | what () const throw (); |
---|
| 422 | |
---|
| 423 | protected: |
---|
| 424 | //@cond |
---|
| 425 | |
---|
| 426 | virtual void |
---|
| 427 | print (std::basic_ostream<C>&) const; |
---|
| 428 | |
---|
| 429 | //@endcond |
---|
| 430 | |
---|
| 431 | private: |
---|
| 432 | std::basic_string<C> encountered_name_; |
---|
| 433 | std::basic_string<C> encountered_namespace_; |
---|
| 434 | std::basic_string<C> expected_name_; |
---|
| 435 | std::basic_string<C> expected_namespace_; |
---|
| 436 | }; |
---|
| 437 | |
---|
| 438 | |
---|
| 439 | /** |
---|
| 440 | * @brief Exception indicating that an expected attribute was not |
---|
| 441 | * encountered. |
---|
| 442 | * |
---|
| 443 | * @nosubgrouping |
---|
| 444 | */ |
---|
| 445 | template <typename C> |
---|
| 446 | class expected_attribute: public exception<C> |
---|
| 447 | { |
---|
| 448 | public: |
---|
| 449 | virtual |
---|
| 450 | ~expected_attribute () throw (); |
---|
| 451 | |
---|
| 452 | /** |
---|
| 453 | * @brief Initialize an instance with the expected attribute |
---|
| 454 | * description. |
---|
| 455 | * |
---|
| 456 | * @param name A name of the expected attribute. |
---|
| 457 | * @param ns A namespace of the expected attribute. |
---|
| 458 | */ |
---|
| 459 | expected_attribute (const std::basic_string<C>& name, |
---|
| 460 | const std::basic_string<C>& ns); |
---|
| 461 | |
---|
| 462 | public: |
---|
| 463 | /** |
---|
| 464 | * @brief Get the name of the expected attribute. |
---|
| 465 | * |
---|
| 466 | * @return The name of the expected attribute. |
---|
| 467 | */ |
---|
| 468 | const std::basic_string<C>& |
---|
| 469 | name () const |
---|
| 470 | { |
---|
| 471 | return name_; |
---|
| 472 | } |
---|
| 473 | |
---|
| 474 | /** |
---|
| 475 | * @brief Get the namespace of the expected attribute. |
---|
| 476 | * |
---|
| 477 | * @return The namespace of the expected attribute. |
---|
| 478 | */ |
---|
| 479 | const std::basic_string<C>& |
---|
| 480 | namespace_ () const |
---|
| 481 | { |
---|
| 482 | return namespace__; |
---|
| 483 | } |
---|
| 484 | |
---|
| 485 | /** |
---|
| 486 | * @brief Get %exception description. |
---|
| 487 | * |
---|
| 488 | * @return A C %string describing the %exception. |
---|
| 489 | */ |
---|
| 490 | virtual const char* |
---|
| 491 | what () const throw (); |
---|
| 492 | |
---|
| 493 | protected: |
---|
| 494 | //@cond |
---|
| 495 | |
---|
| 496 | virtual void |
---|
| 497 | print (std::basic_ostream<C>&) const; |
---|
| 498 | |
---|
| 499 | //@endcond |
---|
| 500 | |
---|
| 501 | private: |
---|
| 502 | std::basic_string<C> name_; |
---|
| 503 | std::basic_string<C> namespace__; |
---|
| 504 | }; |
---|
| 505 | |
---|
| 506 | |
---|
| 507 | /** |
---|
| 508 | * @brief Exception indicating that an unexpected enumerator was |
---|
| 509 | * encountered. |
---|
| 510 | * |
---|
| 511 | * @nosubgrouping |
---|
| 512 | */ |
---|
| 513 | template <typename C> |
---|
| 514 | class unexpected_enumerator: public exception<C> |
---|
| 515 | { |
---|
| 516 | public: |
---|
| 517 | virtual |
---|
| 518 | ~unexpected_enumerator () throw (); |
---|
| 519 | |
---|
| 520 | /** |
---|
| 521 | * @brief Initialize an instance with the encountered enumerator. |
---|
| 522 | * |
---|
| 523 | * @param e A value of the encountered enumerator. |
---|
| 524 | */ |
---|
| 525 | unexpected_enumerator (const std::basic_string<C>& e); |
---|
| 526 | |
---|
| 527 | public: |
---|
| 528 | /** |
---|
| 529 | * @brief Get the value of the encountered enumerator. |
---|
| 530 | * |
---|
| 531 | * @return The value of the encountered enumerator. |
---|
| 532 | */ |
---|
| 533 | const std::basic_string<C>& |
---|
| 534 | enumerator () const |
---|
| 535 | { |
---|
| 536 | return enumerator_; |
---|
| 537 | } |
---|
| 538 | |
---|
| 539 | /** |
---|
| 540 | * @brief Get %exception description. |
---|
| 541 | * |
---|
| 542 | * @return A C %string describing the %exception. |
---|
| 543 | */ |
---|
| 544 | virtual const char* |
---|
| 545 | what () const throw (); |
---|
| 546 | |
---|
| 547 | protected: |
---|
| 548 | //@cond |
---|
| 549 | |
---|
| 550 | virtual void |
---|
| 551 | print (std::basic_ostream<C>&) const; |
---|
| 552 | |
---|
| 553 | //@endcond |
---|
| 554 | |
---|
| 555 | private: |
---|
| 556 | std::basic_string<C> enumerator_; |
---|
| 557 | }; |
---|
| 558 | |
---|
| 559 | |
---|
| 560 | /** |
---|
| 561 | * @brief Exception indicating that the text content was expected |
---|
| 562 | * for an element. |
---|
| 563 | * |
---|
| 564 | * @nosubgrouping |
---|
| 565 | */ |
---|
| 566 | template <typename C> |
---|
| 567 | class expected_text_content: public exception<C> |
---|
| 568 | { |
---|
| 569 | public: |
---|
| 570 | /** |
---|
| 571 | * @brief Get %exception description. |
---|
| 572 | * |
---|
| 573 | * @return A C %string describing the %exception. |
---|
| 574 | */ |
---|
| 575 | virtual const char* |
---|
| 576 | what () const throw (); |
---|
| 577 | |
---|
| 578 | protected: |
---|
| 579 | //@cond |
---|
| 580 | |
---|
| 581 | virtual void |
---|
| 582 | print (std::basic_ostream<C>&) const; |
---|
| 583 | |
---|
| 584 | //@endcond |
---|
| 585 | }; |
---|
| 586 | |
---|
| 587 | |
---|
| 588 | /** |
---|
| 589 | * @brief Exception indicating that the type information is not |
---|
| 590 | * available for a type. |
---|
| 591 | * |
---|
| 592 | * @nosubgrouping |
---|
| 593 | */ |
---|
| 594 | template <typename C> |
---|
| 595 | class no_type_info: public exception<C> |
---|
| 596 | { |
---|
| 597 | public: |
---|
| 598 | virtual |
---|
| 599 | ~no_type_info () throw (); |
---|
| 600 | |
---|
| 601 | /** |
---|
| 602 | * @brief Initialize an instance with the type description. |
---|
| 603 | * |
---|
| 604 | * @param type_name A name of the type. |
---|
| 605 | * @param type_ns A namespace of the type. |
---|
| 606 | */ |
---|
| 607 | no_type_info (const std::basic_string<C>& type_name, |
---|
| 608 | const std::basic_string<C>& type_ns); |
---|
| 609 | |
---|
| 610 | public: |
---|
| 611 | /** |
---|
| 612 | * @brief Get the type name. |
---|
| 613 | * |
---|
| 614 | * @return The type name. |
---|
| 615 | */ |
---|
| 616 | const std::basic_string<C>& |
---|
| 617 | type_name () const |
---|
| 618 | { |
---|
| 619 | return type_name_; |
---|
| 620 | } |
---|
| 621 | |
---|
| 622 | /** |
---|
| 623 | * @brief Get the type namespace. |
---|
| 624 | * |
---|
| 625 | * @return The type namespace. |
---|
| 626 | */ |
---|
| 627 | const std::basic_string<C>& |
---|
| 628 | type_namespace () const |
---|
| 629 | { |
---|
| 630 | return type_namespace_; |
---|
| 631 | } |
---|
| 632 | |
---|
| 633 | /** |
---|
| 634 | * @brief Get %exception description. |
---|
| 635 | * |
---|
| 636 | * @return A C %string describing the %exception. |
---|
| 637 | */ |
---|
| 638 | virtual const char* |
---|
| 639 | what () const throw (); |
---|
| 640 | |
---|
| 641 | protected: |
---|
| 642 | //@cond |
---|
| 643 | |
---|
| 644 | virtual void |
---|
| 645 | print (std::basic_ostream<C>&) const; |
---|
| 646 | |
---|
| 647 | //@endcond |
---|
| 648 | |
---|
| 649 | private: |
---|
| 650 | std::basic_string<C> type_name_; |
---|
| 651 | std::basic_string<C> type_namespace_; |
---|
| 652 | }; |
---|
| 653 | |
---|
| 654 | /** |
---|
| 655 | * @brief Exception indicating that the types are not related by |
---|
| 656 | * inheritance. |
---|
| 657 | * |
---|
| 658 | * @nosubgrouping |
---|
| 659 | */ |
---|
| 660 | template <typename C> |
---|
| 661 | class not_derived: public exception<C> |
---|
| 662 | { |
---|
| 663 | public: |
---|
| 664 | virtual |
---|
| 665 | ~not_derived () throw (); |
---|
| 666 | |
---|
| 667 | //@cond |
---|
| 668 | |
---|
| 669 | // @@ tmp |
---|
| 670 | // |
---|
| 671 | not_derived () |
---|
| 672 | { |
---|
| 673 | } |
---|
| 674 | |
---|
| 675 | //@endcond |
---|
| 676 | |
---|
| 677 | /** |
---|
| 678 | * @brief Initialize an instance with the type descriptions. |
---|
| 679 | * |
---|
| 680 | * @param base_type_name A name of the base type. |
---|
| 681 | * @param base_type_ns A namespace of the base type. |
---|
| 682 | * @param derived_type_name A name of the derived type. |
---|
| 683 | * @param derived_type_ns A namespace of the derived type. |
---|
| 684 | */ |
---|
| 685 | not_derived (const std::basic_string<C>& base_type_name, |
---|
| 686 | const std::basic_string<C>& base_type_ns, |
---|
| 687 | const std::basic_string<C>& derived_type_name, |
---|
| 688 | const std::basic_string<C>& derived_type_ns); |
---|
| 689 | |
---|
| 690 | public: |
---|
| 691 | /** |
---|
| 692 | * @brief Get the base type name. |
---|
| 693 | * |
---|
| 694 | * @return The base type name. |
---|
| 695 | */ |
---|
| 696 | const std::basic_string<C>& |
---|
| 697 | base_type_name () const |
---|
| 698 | { |
---|
| 699 | return base_type_name_; |
---|
| 700 | } |
---|
| 701 | |
---|
| 702 | /** |
---|
| 703 | * @brief Get the base type namespace. |
---|
| 704 | * |
---|
| 705 | * @return The base type namespace. |
---|
| 706 | */ |
---|
| 707 | const std::basic_string<C>& |
---|
| 708 | base_type_namespace () const |
---|
| 709 | { |
---|
| 710 | return base_type_namespace_; |
---|
| 711 | } |
---|
| 712 | |
---|
| 713 | /** |
---|
| 714 | * @brief Get the derived type name. |
---|
| 715 | * |
---|
| 716 | * @return The derived type name. |
---|
| 717 | */ |
---|
| 718 | const std::basic_string<C>& |
---|
| 719 | derived_type_name () const |
---|
| 720 | { |
---|
| 721 | return derived_type_name_; |
---|
| 722 | } |
---|
| 723 | |
---|
| 724 | /** |
---|
| 725 | * @brief Get the derived type namespace. |
---|
| 726 | * |
---|
| 727 | * @return The derived type namespace. |
---|
| 728 | */ |
---|
| 729 | const std::basic_string<C>& |
---|
| 730 | derived_type_namespace () const |
---|
| 731 | { |
---|
| 732 | return derived_type_namespace_; |
---|
| 733 | } |
---|
| 734 | |
---|
| 735 | /** |
---|
| 736 | * @brief Get %exception description. |
---|
| 737 | * |
---|
| 738 | * @return A C %string describing the %exception. |
---|
| 739 | */ |
---|
| 740 | virtual const char* |
---|
| 741 | what () const throw (); |
---|
| 742 | |
---|
| 743 | protected: |
---|
| 744 | //@cond |
---|
| 745 | |
---|
| 746 | virtual void |
---|
| 747 | print (std::basic_ostream<C>&) const; |
---|
| 748 | |
---|
| 749 | //@endcond |
---|
| 750 | |
---|
| 751 | private: |
---|
| 752 | std::basic_string<C> base_type_name_; |
---|
| 753 | std::basic_string<C> base_type_namespace_; |
---|
| 754 | std::basic_string<C> derived_type_name_; |
---|
| 755 | std::basic_string<C> derived_type_namespace_; |
---|
| 756 | }; |
---|
| 757 | |
---|
| 758 | |
---|
| 759 | /** |
---|
| 760 | * @brief Exception indicating that a duplicate ID value was |
---|
| 761 | * encountered in the object model. |
---|
| 762 | * |
---|
| 763 | * @nosubgrouping |
---|
| 764 | */ |
---|
| 765 | template <typename C> |
---|
| 766 | class duplicate_id: public exception<C> |
---|
| 767 | { |
---|
| 768 | public: |
---|
| 769 | virtual |
---|
| 770 | ~duplicate_id () throw (); |
---|
| 771 | |
---|
| 772 | /** |
---|
| 773 | * @brief Initialize an instance with the offending ID value. |
---|
| 774 | * |
---|
| 775 | * @param id An offending ID value. |
---|
| 776 | */ |
---|
| 777 | duplicate_id (const std::basic_string<C>& id); |
---|
| 778 | |
---|
| 779 | public: |
---|
| 780 | /** |
---|
| 781 | * @brief Get the offending ID value. |
---|
| 782 | * |
---|
| 783 | * @return The offending ID value. |
---|
| 784 | */ |
---|
| 785 | const std::basic_string<C>& |
---|
| 786 | id () const |
---|
| 787 | { |
---|
| 788 | return id_; |
---|
| 789 | } |
---|
| 790 | |
---|
| 791 | /** |
---|
| 792 | * @brief Get %exception description. |
---|
| 793 | * |
---|
| 794 | * @return A C %string describing the %exception. |
---|
| 795 | */ |
---|
| 796 | virtual const char* |
---|
| 797 | what () const throw (); |
---|
| 798 | |
---|
| 799 | protected: |
---|
| 800 | //@cond |
---|
| 801 | |
---|
| 802 | virtual void |
---|
| 803 | print (std::basic_ostream<C>&) const; |
---|
| 804 | |
---|
| 805 | //@endcond |
---|
| 806 | |
---|
| 807 | private: |
---|
| 808 | std::basic_string<C> id_; |
---|
| 809 | }; |
---|
| 810 | |
---|
| 811 | |
---|
| 812 | /** |
---|
| 813 | * @brief Exception indicating a %serialization failure. |
---|
| 814 | * |
---|
| 815 | * @nosubgrouping |
---|
| 816 | */ |
---|
| 817 | template <typename C> |
---|
| 818 | class serialization: public exception<C> |
---|
| 819 | { |
---|
| 820 | public: |
---|
| 821 | virtual |
---|
| 822 | ~serialization () throw (); |
---|
| 823 | |
---|
| 824 | /** |
---|
| 825 | * @brief Default constructor. |
---|
| 826 | */ |
---|
| 827 | serialization (); |
---|
| 828 | |
---|
| 829 | /** |
---|
| 830 | * @brief Initialize an instance with a %list of %error conditions. |
---|
| 831 | * |
---|
| 832 | * @param d A %list of %error conditions. |
---|
| 833 | */ |
---|
| 834 | serialization (const tree::diagnostics<C>& d); |
---|
| 835 | |
---|
| 836 | public: |
---|
| 837 | /** |
---|
| 838 | * @brief Get the %list of %error conditions. |
---|
| 839 | * |
---|
| 840 | * @return The %list of %error conditions. |
---|
| 841 | */ |
---|
| 842 | const tree::diagnostics<C>& |
---|
| 843 | diagnostics () const |
---|
| 844 | { |
---|
| 845 | return diagnostics_; |
---|
| 846 | } |
---|
| 847 | |
---|
| 848 | /** |
---|
| 849 | * @brief Get %exception description. |
---|
| 850 | * |
---|
| 851 | * @return A C %string describing the %exception. |
---|
| 852 | */ |
---|
| 853 | virtual const char* |
---|
| 854 | what () const throw (); |
---|
| 855 | |
---|
| 856 | protected: |
---|
| 857 | //@cond |
---|
| 858 | |
---|
| 859 | virtual void |
---|
| 860 | print (std::basic_ostream<C>&) const; |
---|
| 861 | |
---|
| 862 | //@endcond |
---|
| 863 | |
---|
| 864 | private: |
---|
| 865 | tree::diagnostics<C> diagnostics_; |
---|
| 866 | }; |
---|
| 867 | |
---|
| 868 | |
---|
| 869 | /** |
---|
| 870 | * @brief Exception indicating that a namespace-prefix mapping was |
---|
| 871 | * not provided. |
---|
| 872 | * |
---|
| 873 | * @nosubgrouping |
---|
| 874 | */ |
---|
| 875 | template <typename C> |
---|
| 876 | class no_namespace_mapping: public exception<C> |
---|
| 877 | { |
---|
| 878 | public: |
---|
| 879 | virtual |
---|
| 880 | ~no_namespace_mapping () throw (); |
---|
| 881 | |
---|
| 882 | /** |
---|
| 883 | * @brief Initialize an instance with the namespace for which |
---|
| 884 | * the namespace-prefix mapping was not provided. |
---|
| 885 | * |
---|
| 886 | * @param ns A namespace. |
---|
| 887 | */ |
---|
| 888 | no_namespace_mapping (const std::basic_string<C>& ns); |
---|
| 889 | |
---|
| 890 | public: |
---|
| 891 | /** |
---|
| 892 | * @brief Get the namespace for which the namespace-prefix |
---|
| 893 | * mapping was not provided. |
---|
| 894 | * |
---|
| 895 | * @return The namespace. |
---|
| 896 | */ |
---|
| 897 | const std::basic_string<C>& |
---|
| 898 | namespace_ () const |
---|
| 899 | { |
---|
| 900 | return namespace__; |
---|
| 901 | } |
---|
| 902 | |
---|
| 903 | /** |
---|
| 904 | * @brief Get %exception description. |
---|
| 905 | * |
---|
| 906 | * @return A C %string describing the %exception. |
---|
| 907 | */ |
---|
| 908 | virtual const char* |
---|
| 909 | what () const throw (); |
---|
| 910 | |
---|
| 911 | protected: |
---|
| 912 | //@cond |
---|
| 913 | |
---|
| 914 | virtual void |
---|
| 915 | print (std::basic_ostream<C>&) const; |
---|
| 916 | |
---|
| 917 | //@endcond |
---|
| 918 | |
---|
| 919 | private: |
---|
| 920 | std::basic_string<C> namespace__; |
---|
| 921 | }; |
---|
| 922 | |
---|
| 923 | |
---|
| 924 | /** |
---|
| 925 | * @brief Exception indicating that a prefix-namespace mapping was |
---|
| 926 | * not provided. |
---|
| 927 | * |
---|
| 928 | * @nosubgrouping |
---|
| 929 | */ |
---|
| 930 | template <typename C> |
---|
| 931 | class no_prefix_mapping: public exception<C> |
---|
| 932 | { |
---|
| 933 | public: |
---|
| 934 | virtual |
---|
| 935 | ~no_prefix_mapping () throw (); |
---|
| 936 | |
---|
| 937 | /** |
---|
| 938 | * @brief Initialize an instance with the prefix for which the |
---|
| 939 | * prefix-namespace mapping was not provided. |
---|
| 940 | * |
---|
| 941 | * @param prefix A prefix. |
---|
| 942 | */ |
---|
| 943 | no_prefix_mapping (const std::basic_string<C>& prefix); |
---|
| 944 | |
---|
| 945 | public: |
---|
| 946 | /** |
---|
| 947 | * @brief Get the prefix for which the prefix-namespace mapping was |
---|
| 948 | * not provided. |
---|
| 949 | * |
---|
| 950 | * @return The prefix. |
---|
| 951 | */ |
---|
| 952 | const std::basic_string<C>& |
---|
| 953 | prefix () const |
---|
| 954 | { |
---|
| 955 | return prefix_; |
---|
| 956 | } |
---|
| 957 | |
---|
| 958 | /** |
---|
| 959 | * @brief Get %exception description. |
---|
| 960 | * |
---|
| 961 | * @return A C %string describing the %exception. |
---|
| 962 | */ |
---|
| 963 | virtual const char* |
---|
| 964 | what () const throw (); |
---|
| 965 | |
---|
| 966 | protected: |
---|
| 967 | //@cond |
---|
| 968 | |
---|
| 969 | virtual void |
---|
| 970 | print (std::basic_ostream<C>&) const; |
---|
| 971 | |
---|
| 972 | //@endcond |
---|
| 973 | |
---|
| 974 | private: |
---|
| 975 | std::basic_string<C> prefix_; |
---|
| 976 | }; |
---|
| 977 | |
---|
| 978 | |
---|
| 979 | /** |
---|
| 980 | * @brief Exception indicating that the xsi prefix is used for |
---|
| 981 | * another namespace. |
---|
| 982 | * |
---|
| 983 | * @nosubgrouping |
---|
| 984 | */ |
---|
| 985 | template <typename C> |
---|
| 986 | class xsi_already_in_use: public exception<C> |
---|
| 987 | { |
---|
| 988 | public: |
---|
| 989 | /** |
---|
| 990 | * @brief Get %exception description. |
---|
| 991 | * |
---|
| 992 | * @return A C %string describing the %exception. |
---|
| 993 | */ |
---|
| 994 | virtual const char* |
---|
| 995 | what () const throw (); |
---|
| 996 | |
---|
| 997 | protected: |
---|
| 998 | //@cond |
---|
| 999 | |
---|
| 1000 | virtual void |
---|
| 1001 | print (std::basic_ostream<C>&) const; |
---|
| 1002 | |
---|
| 1003 | //@endcond |
---|
| 1004 | }; |
---|
| 1005 | |
---|
| 1006 | |
---|
| 1007 | /** |
---|
| 1008 | * @brief Exception indicating that the size argument exceeds |
---|
| 1009 | * the capacity argument. |
---|
| 1010 | * |
---|
| 1011 | * See the buffer class for details. |
---|
| 1012 | * |
---|
| 1013 | * @nosubgrouping |
---|
| 1014 | */ |
---|
| 1015 | template <typename C> |
---|
| 1016 | class bounds: public exception<C> |
---|
| 1017 | { |
---|
| 1018 | public: |
---|
| 1019 | /** |
---|
| 1020 | * @brief Get %exception description. |
---|
| 1021 | * |
---|
| 1022 | * @return A C %string describing the %exception. |
---|
| 1023 | */ |
---|
| 1024 | virtual const char* |
---|
| 1025 | what () const throw (); |
---|
| 1026 | |
---|
| 1027 | protected: |
---|
| 1028 | //@cond |
---|
| 1029 | |
---|
| 1030 | virtual void |
---|
| 1031 | print (std::basic_ostream<C>&) const; |
---|
| 1032 | |
---|
| 1033 | //@endcond |
---|
| 1034 | }; |
---|
| 1035 | } |
---|
| 1036 | } |
---|
| 1037 | } |
---|
| 1038 | |
---|
| 1039 | #include <xsd/cxx/tree/exceptions.txx> |
---|
| 1040 | |
---|
| 1041 | #endif // XSD_CXX_TREE_EXCEPTIONS_HXX |
---|
| 1042 | |
---|
| 1043 | #include <xsd/cxx/tree/exceptions.ixx> |
---|