[111] | 1 | // file : xsd/cxx/tree/date-time.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 C++ class definitions for the XML Schema date/time types. |
---|
| 10 | * |
---|
| 11 | * This is an internal header and is included by the generated code. You |
---|
| 12 | * normally should not include it directly. |
---|
| 13 | * |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #ifndef XSD_CXX_TREE_DATE_TIME_HXX |
---|
| 17 | #define XSD_CXX_TREE_DATE_TIME_HXX |
---|
| 18 | |
---|
| 19 | #include <string> |
---|
| 20 | #include <cstddef> // std::size_t |
---|
| 21 | |
---|
| 22 | #include <xercesc/dom/DOMAttr.hpp> |
---|
| 23 | #include <xercesc/dom/DOMElement.hpp> |
---|
| 24 | |
---|
| 25 | #include <xsd/cxx/tree/elements.hxx> |
---|
| 26 | #include <xsd/cxx/tree/istream-fwd.hxx> |
---|
| 27 | |
---|
| 28 | namespace xsd |
---|
| 29 | { |
---|
| 30 | namespace cxx |
---|
| 31 | { |
---|
| 32 | /** |
---|
| 33 | * @brief C++/Tree mapping runtime namespace. |
---|
| 34 | * |
---|
| 35 | * This is an internal namespace and normally should not be referenced |
---|
| 36 | * directly. Instead you should use the aliases for types in this |
---|
| 37 | * namespaces that are created in the generated code. |
---|
| 38 | * |
---|
| 39 | */ |
---|
| 40 | namespace tree |
---|
| 41 | { |
---|
| 42 | /** |
---|
| 43 | * @brief Time zone representation |
---|
| 44 | * |
---|
| 45 | * The %time_zone class represents an optional %time zone and |
---|
| 46 | * is used as a base class for date/time types. |
---|
| 47 | * |
---|
| 48 | * The %time zone can negative in which case both the hours and |
---|
| 49 | * minutes components should be negative. |
---|
| 50 | * |
---|
| 51 | * @nosubgrouping |
---|
| 52 | */ |
---|
| 53 | class time_zone |
---|
| 54 | { |
---|
| 55 | public: |
---|
| 56 | /** |
---|
| 57 | * @name Constructors |
---|
| 58 | */ |
---|
| 59 | //@{ |
---|
| 60 | |
---|
| 61 | /** |
---|
| 62 | * @brief Default constructor. |
---|
| 63 | * |
---|
| 64 | * This constructor initializes the instance to the 'not specified' |
---|
| 65 | * state. |
---|
| 66 | */ |
---|
| 67 | time_zone (); |
---|
| 68 | |
---|
| 69 | /** |
---|
| 70 | * @brief Initialize an instance with the hours and minutes |
---|
| 71 | * components. |
---|
| 72 | * |
---|
| 73 | * @param hours The %time zone hours component. |
---|
| 74 | * @param minutes The %time zone minutes component. |
---|
| 75 | */ |
---|
| 76 | time_zone (short hours, short minutes); |
---|
| 77 | |
---|
| 78 | //@} |
---|
| 79 | |
---|
| 80 | /** |
---|
| 81 | * @brief Determine if %time zone is specified. |
---|
| 82 | * |
---|
| 83 | * @return True if %time zone is specified, false otherwise. |
---|
| 84 | */ |
---|
| 85 | bool |
---|
| 86 | zone_present () const; |
---|
| 87 | |
---|
| 88 | /** |
---|
| 89 | * @brief Reset the %time zone to the 'not specified' state. |
---|
| 90 | * |
---|
| 91 | */ |
---|
| 92 | void |
---|
| 93 | zone_reset (); |
---|
| 94 | |
---|
| 95 | /** |
---|
| 96 | * @brief Get the hours component of the %time zone. |
---|
| 97 | * |
---|
| 98 | * @return The hours component of the %time zone. |
---|
| 99 | */ |
---|
| 100 | short |
---|
| 101 | zone_hours () const; |
---|
| 102 | |
---|
| 103 | /** |
---|
| 104 | * @brief Set the hours component of the %time zone. |
---|
| 105 | * |
---|
| 106 | * @param h The new hours component. |
---|
| 107 | */ |
---|
| 108 | void |
---|
| 109 | zone_hours (short h); |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | /** |
---|
| 113 | * @brief Get the minutes component of the %time zone. |
---|
| 114 | * |
---|
| 115 | * @return The minutes component of the %time zone. |
---|
| 116 | */ |
---|
| 117 | short |
---|
| 118 | zone_minutes () const; |
---|
| 119 | |
---|
| 120 | /** |
---|
| 121 | * @brief Set the minutes component of the %time zone. |
---|
| 122 | * |
---|
| 123 | * @param m The new minutes component. |
---|
| 124 | */ |
---|
| 125 | void |
---|
| 126 | zone_minutes (short m); |
---|
| 127 | |
---|
| 128 | protected: |
---|
| 129 | //@cond |
---|
| 130 | |
---|
| 131 | template <typename C> |
---|
| 132 | void |
---|
| 133 | zone_parse (const C*, std::size_t); |
---|
| 134 | |
---|
| 135 | template <typename S> |
---|
| 136 | void |
---|
| 137 | zone_extract (istream<S>&); |
---|
| 138 | |
---|
| 139 | //@endcond |
---|
| 140 | |
---|
| 141 | private: |
---|
| 142 | bool present_; |
---|
| 143 | short hours_; |
---|
| 144 | short minutes_; |
---|
| 145 | }; |
---|
| 146 | |
---|
| 147 | /** |
---|
| 148 | * @brief %time_zone comparison operator. |
---|
| 149 | * |
---|
| 150 | * @return True if both %time zones are either not specified or |
---|
| 151 | * have equal hours and minutes components, false otherwise. |
---|
| 152 | */ |
---|
| 153 | bool |
---|
| 154 | operator== (const time_zone&, const time_zone&); |
---|
| 155 | |
---|
| 156 | /** |
---|
| 157 | * @brief %time_zone comparison operator. |
---|
| 158 | * |
---|
| 159 | * @return False if both %time zones are either not specified or |
---|
| 160 | * have equal hours and minutes components, true otherwise. |
---|
| 161 | */ |
---|
| 162 | bool |
---|
| 163 | operator!= (const time_zone&, const time_zone&); |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | /** |
---|
| 167 | * @brief Class corresponding to the XML Schema gDay built-in type. |
---|
| 168 | * |
---|
| 169 | * The %gday class represents a day of the month with an optional |
---|
| 170 | * %time zone. |
---|
| 171 | * |
---|
| 172 | * @nosubgrouping |
---|
| 173 | */ |
---|
| 174 | template <typename C, typename B> |
---|
| 175 | class gday: public B, public time_zone |
---|
| 176 | { |
---|
| 177 | public: |
---|
| 178 | /** |
---|
| 179 | * @name Constructors |
---|
| 180 | */ |
---|
| 181 | //@{ |
---|
| 182 | |
---|
| 183 | /** |
---|
| 184 | * @brief Initialize an instance with the day component. |
---|
| 185 | * |
---|
| 186 | * When this constructor is used, the %time zone is left |
---|
| 187 | * unspecified. |
---|
| 188 | * |
---|
| 189 | * @param day The day component. |
---|
| 190 | */ |
---|
| 191 | explicit |
---|
| 192 | gday (unsigned short day); |
---|
| 193 | |
---|
| 194 | /** |
---|
| 195 | * @brief Initialize an instance with the day component and %time |
---|
| 196 | * zone. |
---|
| 197 | * |
---|
| 198 | * @param day The day component. |
---|
| 199 | * @param zone_hours The %time zone hours component. |
---|
| 200 | * @param zone_minutes The %time zone minutes component. |
---|
| 201 | */ |
---|
| 202 | gday (unsigned short day, short zone_hours, short zone_minutes); |
---|
| 203 | |
---|
| 204 | /** |
---|
| 205 | * @brief Copy constructor. |
---|
| 206 | * |
---|
| 207 | * @param x An instance to make a copy of. |
---|
| 208 | * @param f Flags to create the copy with. |
---|
| 209 | * @param c A pointer to the object that will contain the copy. |
---|
| 210 | * |
---|
| 211 | * For polymorphic object models use the _clone function instead. |
---|
| 212 | */ |
---|
| 213 | gday (const gday& x, flags f = 0, container* c = 0); |
---|
| 214 | |
---|
| 215 | /** |
---|
| 216 | * @brief Copy the instance polymorphically. |
---|
| 217 | * |
---|
| 218 | * @param f Flags to create the copy with. |
---|
| 219 | * @param c A pointer to the object that will contain the copy. |
---|
| 220 | * @return A pointer to the dynamically allocated copy. |
---|
| 221 | * |
---|
| 222 | * This function ensures that the dynamic type of the instance |
---|
| 223 | * is used for copying and should be used for polymorphic object |
---|
| 224 | * models instead of the copy constructor. |
---|
| 225 | */ |
---|
| 226 | virtual gday* |
---|
| 227 | _clone (flags f = 0, container* c = 0) const; |
---|
| 228 | |
---|
| 229 | /** |
---|
| 230 | * @brief Create an instance from a data representation |
---|
| 231 | * stream. |
---|
| 232 | * |
---|
| 233 | * @param s A stream to extract the data from. |
---|
| 234 | * @param f Flags to create the new instance with. |
---|
| 235 | * @param c A pointer to the object that will contain the new |
---|
| 236 | * instance. |
---|
| 237 | */ |
---|
| 238 | template <typename S> |
---|
| 239 | gday (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 240 | |
---|
| 241 | /** |
---|
| 242 | * @brief Create an instance from a DOM element. |
---|
| 243 | * |
---|
| 244 | * @param e A DOM element to extract the data from. |
---|
| 245 | * @param f Flags to create the new instance with. |
---|
| 246 | * @param c A pointer to the object that will contain the new |
---|
| 247 | * instance. |
---|
| 248 | */ |
---|
| 249 | gday (const xercesc::DOMElement& e, flags f = 0, container* c = 0); |
---|
| 250 | |
---|
| 251 | /** |
---|
| 252 | * @brief Create an instance from a DOM Attribute. |
---|
| 253 | * |
---|
| 254 | * @param a A DOM attribute to extract the data from. |
---|
| 255 | * @param f Flags to create the new instance with. |
---|
| 256 | * @param c A pointer to the object that will contain the new |
---|
| 257 | * instance. |
---|
| 258 | */ |
---|
| 259 | gday (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); |
---|
| 260 | |
---|
| 261 | /** |
---|
| 262 | * @brief Create an instance from a %string fragment. |
---|
| 263 | * |
---|
| 264 | * @param s A %string fragment to extract the data from. |
---|
| 265 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 266 | * @param f Flags to create the new instance with. |
---|
| 267 | * @param c A pointer to the object that will contain the new |
---|
| 268 | * instance. |
---|
| 269 | */ |
---|
| 270 | gday (const std::basic_string<C>& s, |
---|
| 271 | const xercesc::DOMElement* e, |
---|
| 272 | flags f = 0, |
---|
| 273 | container* c = 0); |
---|
| 274 | //@} |
---|
| 275 | |
---|
| 276 | public: |
---|
| 277 | /** |
---|
| 278 | * @brief Get the day component. |
---|
| 279 | * |
---|
| 280 | * @return The day component. |
---|
| 281 | */ |
---|
| 282 | unsigned short |
---|
| 283 | day () const; |
---|
| 284 | |
---|
| 285 | /** |
---|
| 286 | * @brief Set the day component. |
---|
| 287 | * |
---|
| 288 | * @param d The new day component. |
---|
| 289 | */ |
---|
| 290 | void |
---|
| 291 | day (unsigned short d); |
---|
| 292 | |
---|
| 293 | protected: |
---|
| 294 | //@cond |
---|
| 295 | |
---|
| 296 | gday (); |
---|
| 297 | |
---|
| 298 | void |
---|
| 299 | parse (const std::basic_string<C>&); |
---|
| 300 | |
---|
| 301 | //@endcond |
---|
| 302 | |
---|
| 303 | private: |
---|
| 304 | unsigned short day_; |
---|
| 305 | }; |
---|
| 306 | |
---|
| 307 | /** |
---|
| 308 | * @brief %gday comparison operator. |
---|
| 309 | * |
---|
| 310 | * @return True if the day components and %time zones are equal, false |
---|
| 311 | * otherwise. |
---|
| 312 | */ |
---|
| 313 | template <typename C, typename B> |
---|
| 314 | bool |
---|
| 315 | operator== (const gday<C, B>&, const gday<C, B>&); |
---|
| 316 | |
---|
| 317 | /** |
---|
| 318 | * @brief %gday comparison operator. |
---|
| 319 | * |
---|
| 320 | * @return False if the day components and %time zones are equal, true |
---|
| 321 | * otherwise. |
---|
| 322 | */ |
---|
| 323 | template <typename C, typename B> |
---|
| 324 | bool |
---|
| 325 | operator!= (const gday<C, B>&, const gday<C, B>&); |
---|
| 326 | |
---|
| 327 | /** |
---|
| 328 | * @brief Class corresponding to the XML Schema gMonth built-in type. |
---|
| 329 | * |
---|
| 330 | * The %gmonth class represents a month of the year with an optional |
---|
| 331 | * %time zone. |
---|
| 332 | * |
---|
| 333 | * @nosubgrouping |
---|
| 334 | */ |
---|
| 335 | template <typename C, typename B> |
---|
| 336 | class gmonth: public B, public time_zone |
---|
| 337 | { |
---|
| 338 | public: |
---|
| 339 | /** |
---|
| 340 | * @name Constructors |
---|
| 341 | */ |
---|
| 342 | //@{ |
---|
| 343 | |
---|
| 344 | /** |
---|
| 345 | * @brief Initialize an instance with the month component. |
---|
| 346 | * |
---|
| 347 | * When this constructor is used, the %time zone is left |
---|
| 348 | * unspecified. |
---|
| 349 | * |
---|
| 350 | * @param month The month component. |
---|
| 351 | */ |
---|
| 352 | explicit |
---|
| 353 | gmonth (unsigned short month); |
---|
| 354 | |
---|
| 355 | /** |
---|
| 356 | * @brief Initialize an instance with the month component and %time |
---|
| 357 | * zone. |
---|
| 358 | * |
---|
| 359 | * @param month The month component. |
---|
| 360 | * @param zone_hours The %time zone hours component. |
---|
| 361 | * @param zone_minutes The %time zone minutes component. |
---|
| 362 | */ |
---|
| 363 | gmonth (unsigned short month, short zone_hours, short zone_minutes); |
---|
| 364 | |
---|
| 365 | /** |
---|
| 366 | * @brief Copy constructor. |
---|
| 367 | * |
---|
| 368 | * @param x An instance to make a copy of. |
---|
| 369 | * @param f Flags to create the copy with. |
---|
| 370 | * @param c A pointer to the object that will contain the copy. |
---|
| 371 | * |
---|
| 372 | * For polymorphic object models use the _clone function instead. |
---|
| 373 | */ |
---|
| 374 | gmonth (const gmonth& x, flags f = 0, container* c = 0); |
---|
| 375 | |
---|
| 376 | /** |
---|
| 377 | * @brief Copy the instance polymorphically. |
---|
| 378 | * |
---|
| 379 | * @param f Flags to create the copy with. |
---|
| 380 | * @param c A pointer to the object that will contain the copy. |
---|
| 381 | * @return A pointer to the dynamically allocated copy. |
---|
| 382 | * |
---|
| 383 | * This function ensures that the dynamic type of the instance |
---|
| 384 | * is used for copying and should be used for polymorphic object |
---|
| 385 | * models instead of the copy constructor. |
---|
| 386 | */ |
---|
| 387 | virtual gmonth* |
---|
| 388 | _clone (flags f = 0, container* c = 0) const; |
---|
| 389 | |
---|
| 390 | /** |
---|
| 391 | * @brief Create an instance from a data representation |
---|
| 392 | * stream. |
---|
| 393 | * |
---|
| 394 | * @param s A stream to extract the data from. |
---|
| 395 | * @param f Flags to create the new instance with. |
---|
| 396 | * @param c A pointer to the object that will contain the new |
---|
| 397 | * instance. |
---|
| 398 | */ |
---|
| 399 | template <typename S> |
---|
| 400 | gmonth (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 401 | |
---|
| 402 | /** |
---|
| 403 | * @brief Create an instance from a DOM element. |
---|
| 404 | * |
---|
| 405 | * @param e A DOM element to extract the data from. |
---|
| 406 | * @param f Flags to create the new instance with. |
---|
| 407 | * @param c A pointer to the object that will contain the new |
---|
| 408 | * instance. |
---|
| 409 | */ |
---|
| 410 | gmonth (const xercesc::DOMElement& e, flags f = 0, container* c = 0); |
---|
| 411 | |
---|
| 412 | /** |
---|
| 413 | * @brief Create an instance from a DOM Attribute. |
---|
| 414 | * |
---|
| 415 | * @param a A DOM attribute to extract the data from. |
---|
| 416 | * @param f Flags to create the new instance with. |
---|
| 417 | * @param c A pointer to the object that will contain the new |
---|
| 418 | * instance. |
---|
| 419 | */ |
---|
| 420 | gmonth (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); |
---|
| 421 | |
---|
| 422 | /** |
---|
| 423 | * @brief Create an instance from a %string fragment. |
---|
| 424 | * |
---|
| 425 | * @param s A %string fragment to extract the data from. |
---|
| 426 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 427 | * @param f Flags to create the new instance with. |
---|
| 428 | * @param c A pointer to the object that will contain the new |
---|
| 429 | * instance. |
---|
| 430 | */ |
---|
| 431 | gmonth (const std::basic_string<C>& s, |
---|
| 432 | const xercesc::DOMElement* e, |
---|
| 433 | flags f = 0, |
---|
| 434 | container* c = 0); |
---|
| 435 | //@} |
---|
| 436 | |
---|
| 437 | public: |
---|
| 438 | /** |
---|
| 439 | * @brief Get the month component. |
---|
| 440 | * |
---|
| 441 | * @return The month component. |
---|
| 442 | */ |
---|
| 443 | unsigned short |
---|
| 444 | month () const; |
---|
| 445 | |
---|
| 446 | /** |
---|
| 447 | * @brief Set the month component. |
---|
| 448 | * |
---|
| 449 | * @param m The new month component. |
---|
| 450 | */ |
---|
| 451 | void |
---|
| 452 | month (unsigned short m); |
---|
| 453 | |
---|
| 454 | protected: |
---|
| 455 | //@cond |
---|
| 456 | |
---|
| 457 | gmonth (); |
---|
| 458 | |
---|
| 459 | void |
---|
| 460 | parse (const std::basic_string<C>&); |
---|
| 461 | |
---|
| 462 | //@endcond |
---|
| 463 | |
---|
| 464 | private: |
---|
| 465 | unsigned short month_; |
---|
| 466 | }; |
---|
| 467 | |
---|
| 468 | /** |
---|
| 469 | * @brief %gmonth comparison operator. |
---|
| 470 | * |
---|
| 471 | * @return True if the month components and %time zones are equal, false |
---|
| 472 | * otherwise. |
---|
| 473 | */ |
---|
| 474 | template <typename C, typename B> |
---|
| 475 | bool |
---|
| 476 | operator== (const gmonth<C, B>&, const gmonth<C, B>&); |
---|
| 477 | |
---|
| 478 | /** |
---|
| 479 | * @brief %gmonth comparison operator. |
---|
| 480 | * |
---|
| 481 | * @return False if the month components and %time zones are equal, true |
---|
| 482 | * otherwise. |
---|
| 483 | */ |
---|
| 484 | template <typename C, typename B> |
---|
| 485 | bool |
---|
| 486 | operator!= (const gmonth<C, B>&, const gmonth<C, B>&); |
---|
| 487 | |
---|
| 488 | |
---|
| 489 | /** |
---|
| 490 | * @brief Class corresponding to the XML Schema gYear built-in type. |
---|
| 491 | * |
---|
| 492 | * The %gyear class represents a year with an optional %time zone. |
---|
| 493 | * |
---|
| 494 | * @nosubgrouping |
---|
| 495 | */ |
---|
| 496 | template <typename C, typename B> |
---|
| 497 | class gyear: public B, public time_zone |
---|
| 498 | { |
---|
| 499 | public: |
---|
| 500 | /** |
---|
| 501 | * @name Constructors |
---|
| 502 | */ |
---|
| 503 | //@{ |
---|
| 504 | |
---|
| 505 | /** |
---|
| 506 | * @brief Initialize an instance with the year component. |
---|
| 507 | * |
---|
| 508 | * When this constructor is used, the %time zone is left |
---|
| 509 | * unspecified. |
---|
| 510 | * |
---|
| 511 | * @param year The year component. |
---|
| 512 | */ |
---|
| 513 | explicit |
---|
| 514 | gyear (int year); |
---|
| 515 | |
---|
| 516 | /** |
---|
| 517 | * @brief Initialize an instance with the year component and %time |
---|
| 518 | * zone. |
---|
| 519 | * |
---|
| 520 | * @param year The year component. |
---|
| 521 | * @param zone_hours The %time zone hours component. |
---|
| 522 | * @param zone_minutes The %time zone minutes component. |
---|
| 523 | */ |
---|
| 524 | gyear (int year, short zone_hours, short zone_minutes); |
---|
| 525 | |
---|
| 526 | /** |
---|
| 527 | * @brief Copy constructor. |
---|
| 528 | * |
---|
| 529 | * @param x An instance to make a copy of. |
---|
| 530 | * @param f Flags to create the copy with. |
---|
| 531 | * @param c A pointer to the object that will contain the copy. |
---|
| 532 | * |
---|
| 533 | * For polymorphic object models use the _clone function instead. |
---|
| 534 | */ |
---|
| 535 | gyear (const gyear& x, flags f = 0, container* c = 0); |
---|
| 536 | |
---|
| 537 | /** |
---|
| 538 | * @brief Copy the instance polymorphically. |
---|
| 539 | * |
---|
| 540 | * @param f Flags to create the copy with. |
---|
| 541 | * @param c A pointer to the object that will contain the copy. |
---|
| 542 | * @return A pointer to the dynamically allocated copy. |
---|
| 543 | * |
---|
| 544 | * This function ensures that the dynamic type of the instance |
---|
| 545 | * is used for copying and should be used for polymorphic object |
---|
| 546 | * models instead of the copy constructor. |
---|
| 547 | */ |
---|
| 548 | virtual gyear* |
---|
| 549 | _clone (flags f = 0, container* c = 0) const; |
---|
| 550 | |
---|
| 551 | /** |
---|
| 552 | * @brief Create an instance from a data representation |
---|
| 553 | * stream. |
---|
| 554 | * |
---|
| 555 | * @param s A stream to extract the data from. |
---|
| 556 | * @param f Flags to create the new instance with. |
---|
| 557 | * @param c A pointer to the object that will contain the new |
---|
| 558 | * instance. |
---|
| 559 | */ |
---|
| 560 | template <typename S> |
---|
| 561 | gyear (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 562 | |
---|
| 563 | /** |
---|
| 564 | * @brief Create an instance from a DOM element. |
---|
| 565 | * |
---|
| 566 | * @param e A DOM element to extract the data from. |
---|
| 567 | * @param f Flags to create the new instance with. |
---|
| 568 | * @param c A pointer to the object that will contain the new |
---|
| 569 | * instance. |
---|
| 570 | */ |
---|
| 571 | gyear (const xercesc::DOMElement& e, flags f = 0, container* c = 0); |
---|
| 572 | |
---|
| 573 | /** |
---|
| 574 | * @brief Create an instance from a DOM Attribute. |
---|
| 575 | * |
---|
| 576 | * @param a A DOM attribute to extract the data from. |
---|
| 577 | * @param f Flags to create the new instance with. |
---|
| 578 | * @param c A pointer to the object that will contain the new |
---|
| 579 | * instance. |
---|
| 580 | */ |
---|
| 581 | gyear (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); |
---|
| 582 | |
---|
| 583 | /** |
---|
| 584 | * @brief Create an instance from a %string fragment. |
---|
| 585 | * |
---|
| 586 | * @param s A %string fragment to extract the data from. |
---|
| 587 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 588 | * @param f Flags to create the new instance with. |
---|
| 589 | * @param c A pointer to the object that will contain the new |
---|
| 590 | * instance. |
---|
| 591 | */ |
---|
| 592 | gyear (const std::basic_string<C>& s, |
---|
| 593 | const xercesc::DOMElement* e, |
---|
| 594 | flags f = 0, |
---|
| 595 | container* c = 0); |
---|
| 596 | //@} |
---|
| 597 | |
---|
| 598 | public: |
---|
| 599 | /** |
---|
| 600 | * @brief Get the year component. |
---|
| 601 | * |
---|
| 602 | * @return The year component. |
---|
| 603 | */ |
---|
| 604 | int |
---|
| 605 | year () const; |
---|
| 606 | |
---|
| 607 | /** |
---|
| 608 | * @brief Set the year component. |
---|
| 609 | * |
---|
| 610 | * @param y The new year component. |
---|
| 611 | */ |
---|
| 612 | void |
---|
| 613 | year (int y); |
---|
| 614 | |
---|
| 615 | protected: |
---|
| 616 | //@cond |
---|
| 617 | |
---|
| 618 | gyear (); |
---|
| 619 | |
---|
| 620 | void |
---|
| 621 | parse (const std::basic_string<C>&); |
---|
| 622 | |
---|
| 623 | //@endcond |
---|
| 624 | |
---|
| 625 | private: |
---|
| 626 | int year_; |
---|
| 627 | }; |
---|
| 628 | |
---|
| 629 | /** |
---|
| 630 | * @brief %gyear comparison operator. |
---|
| 631 | * |
---|
| 632 | * @return True if the year components and %time zones are equal, false |
---|
| 633 | * otherwise. |
---|
| 634 | */ |
---|
| 635 | template <typename C, typename B> |
---|
| 636 | bool |
---|
| 637 | operator== (const gyear<C, B>&, const gyear<C, B>&); |
---|
| 638 | |
---|
| 639 | /** |
---|
| 640 | * @brief %gyear comparison operator. |
---|
| 641 | * |
---|
| 642 | * @return False if the year components and %time zones are equal, true |
---|
| 643 | * otherwise. |
---|
| 644 | */ |
---|
| 645 | template <typename C, typename B> |
---|
| 646 | bool |
---|
| 647 | operator!= (const gyear<C, B>&, const gyear<C, B>&); |
---|
| 648 | |
---|
| 649 | |
---|
| 650 | /** |
---|
| 651 | * @brief Class corresponding to the XML Schema gMonthDay built-in type. |
---|
| 652 | * |
---|
| 653 | * The %gmonth_day class represents day and month of the year with an |
---|
| 654 | * optional %time zone. |
---|
| 655 | * |
---|
| 656 | * @nosubgrouping |
---|
| 657 | */ |
---|
| 658 | template <typename C, typename B> |
---|
| 659 | class gmonth_day: public B, public time_zone |
---|
| 660 | { |
---|
| 661 | public: |
---|
| 662 | /** |
---|
| 663 | * @name Constructors |
---|
| 664 | */ |
---|
| 665 | //@{ |
---|
| 666 | |
---|
| 667 | /** |
---|
| 668 | * @brief Initialize an instance with the month and day components. |
---|
| 669 | * |
---|
| 670 | * When this constructor is used, the %time zone is left |
---|
| 671 | * unspecified. |
---|
| 672 | * |
---|
| 673 | * @param month The month component. |
---|
| 674 | * @param day The day component. |
---|
| 675 | */ |
---|
| 676 | gmonth_day (unsigned short month, unsigned short day); |
---|
| 677 | |
---|
| 678 | /** |
---|
| 679 | * @brief Initialize an instance with the month and day components |
---|
| 680 | * as well as %time zone. |
---|
| 681 | * |
---|
| 682 | * @param month The month component. |
---|
| 683 | * @param day The day component. |
---|
| 684 | * @param zone_hours The %time zone hours component. |
---|
| 685 | * @param zone_minutes The %time zone minutes component. |
---|
| 686 | */ |
---|
| 687 | gmonth_day (unsigned short month, unsigned short day, |
---|
| 688 | short zone_hours, short zone_minutes); |
---|
| 689 | |
---|
| 690 | /** |
---|
| 691 | * @brief Copy constructor. |
---|
| 692 | * |
---|
| 693 | * @param x An instance to make a copy of. |
---|
| 694 | * @param f Flags to create the copy with. |
---|
| 695 | * @param c A pointer to the object that will contain the copy. |
---|
| 696 | * |
---|
| 697 | * For polymorphic object models use the _clone function instead. |
---|
| 698 | */ |
---|
| 699 | gmonth_day (const gmonth_day& x, flags f = 0, container* c = 0); |
---|
| 700 | |
---|
| 701 | /** |
---|
| 702 | * @brief Copy the instance polymorphically. |
---|
| 703 | * |
---|
| 704 | * @param f Flags to create the copy with. |
---|
| 705 | * @param c A pointer to the object that will contain the copy. |
---|
| 706 | * @return A pointer to the dynamically allocated copy. |
---|
| 707 | * |
---|
| 708 | * This function ensures that the dynamic type of the instance |
---|
| 709 | * is used for copying and should be used for polymorphic object |
---|
| 710 | * models instead of the copy constructor. |
---|
| 711 | */ |
---|
| 712 | virtual gmonth_day* |
---|
| 713 | _clone (flags f = 0, container* c = 0) const; |
---|
| 714 | |
---|
| 715 | /** |
---|
| 716 | * @brief Create an instance from a data representation |
---|
| 717 | * stream. |
---|
| 718 | * |
---|
| 719 | * @param s A stream to extract the data from. |
---|
| 720 | * @param f Flags to create the new instance with. |
---|
| 721 | * @param c A pointer to the object that will contain the new |
---|
| 722 | * instance. |
---|
| 723 | */ |
---|
| 724 | template <typename S> |
---|
| 725 | gmonth_day (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 726 | |
---|
| 727 | /** |
---|
| 728 | * @brief Create an instance from a DOM element. |
---|
| 729 | * |
---|
| 730 | * @param e A DOM element to extract the data from. |
---|
| 731 | * @param f Flags to create the new instance with. |
---|
| 732 | * @param c A pointer to the object that will contain the new |
---|
| 733 | * instance. |
---|
| 734 | */ |
---|
| 735 | gmonth_day (const xercesc::DOMElement& e, |
---|
| 736 | flags f = 0, |
---|
| 737 | container* c = 0); |
---|
| 738 | |
---|
| 739 | /** |
---|
| 740 | * @brief Create an instance from a DOM Attribute. |
---|
| 741 | * |
---|
| 742 | * @param a A DOM attribute to extract the data from. |
---|
| 743 | * @param f Flags to create the new instance with. |
---|
| 744 | * @param c A pointer to the object that will contain the new |
---|
| 745 | * instance. |
---|
| 746 | */ |
---|
| 747 | gmonth_day (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); |
---|
| 748 | |
---|
| 749 | /** |
---|
| 750 | * @brief Create an instance from a %string fragment. |
---|
| 751 | * |
---|
| 752 | * @param s A %string fragment to extract the data from. |
---|
| 753 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 754 | * @param f Flags to create the new instance with. |
---|
| 755 | * @param c A pointer to the object that will contain the new |
---|
| 756 | * instance. |
---|
| 757 | */ |
---|
| 758 | gmonth_day (const std::basic_string<C>& s, |
---|
| 759 | const xercesc::DOMElement* e, |
---|
| 760 | flags f = 0, |
---|
| 761 | container* c = 0); |
---|
| 762 | //@} |
---|
| 763 | |
---|
| 764 | public: |
---|
| 765 | /** |
---|
| 766 | * @brief Get the month component. |
---|
| 767 | * |
---|
| 768 | * @return The month component. |
---|
| 769 | */ |
---|
| 770 | unsigned short |
---|
| 771 | month () const; |
---|
| 772 | |
---|
| 773 | /** |
---|
| 774 | * @brief Set the month component. |
---|
| 775 | * |
---|
| 776 | * @param m The new month component. |
---|
| 777 | */ |
---|
| 778 | void |
---|
| 779 | month (unsigned short m); |
---|
| 780 | |
---|
| 781 | /** |
---|
| 782 | * @brief Get the day component. |
---|
| 783 | * |
---|
| 784 | * @return The day component. |
---|
| 785 | */ |
---|
| 786 | unsigned short |
---|
| 787 | day () const; |
---|
| 788 | |
---|
| 789 | /** |
---|
| 790 | * @brief Set the day component. |
---|
| 791 | * |
---|
| 792 | * @param d The new day component. |
---|
| 793 | */ |
---|
| 794 | void |
---|
| 795 | day (unsigned short d); |
---|
| 796 | |
---|
| 797 | protected: |
---|
| 798 | //@cond |
---|
| 799 | |
---|
| 800 | gmonth_day (); |
---|
| 801 | |
---|
| 802 | void |
---|
| 803 | parse (const std::basic_string<C>&); |
---|
| 804 | |
---|
| 805 | //@endcond |
---|
| 806 | |
---|
| 807 | private: |
---|
| 808 | unsigned short month_; |
---|
| 809 | unsigned short day_; |
---|
| 810 | }; |
---|
| 811 | |
---|
| 812 | /** |
---|
| 813 | * @brief %gmonth_day comparison operator. |
---|
| 814 | * |
---|
| 815 | * @return True if the month and day components as well as %time zones |
---|
| 816 | * are equal, false otherwise. |
---|
| 817 | */ |
---|
| 818 | template <typename C, typename B> |
---|
| 819 | bool |
---|
| 820 | operator== (const gmonth_day<C, B>&, const gmonth_day<C, B>&); |
---|
| 821 | |
---|
| 822 | /** |
---|
| 823 | * @brief %gmonth_day comparison operator. |
---|
| 824 | * |
---|
| 825 | * @return False if the month and day components as well as %time zones |
---|
| 826 | * are equal, true otherwise. |
---|
| 827 | */ |
---|
| 828 | template <typename C, typename B> |
---|
| 829 | bool |
---|
| 830 | operator!= (const gmonth_day<C, B>&, const gmonth_day<C, B>&); |
---|
| 831 | |
---|
| 832 | |
---|
| 833 | /** |
---|
| 834 | * @brief Class corresponding to the XML Schema gYearMonth built-in |
---|
| 835 | * type. |
---|
| 836 | * |
---|
| 837 | * The %gyear_month class represents year and month with an optional |
---|
| 838 | * %time zone. |
---|
| 839 | * |
---|
| 840 | * @nosubgrouping |
---|
| 841 | */ |
---|
| 842 | template <typename C, typename B> |
---|
| 843 | class gyear_month: public B, public time_zone |
---|
| 844 | { |
---|
| 845 | public: |
---|
| 846 | /** |
---|
| 847 | * @name Constructors |
---|
| 848 | */ |
---|
| 849 | //@{ |
---|
| 850 | |
---|
| 851 | /** |
---|
| 852 | * @brief Initialize an instance with the year and month components. |
---|
| 853 | * |
---|
| 854 | * When this constructor is used, the %time zone is left |
---|
| 855 | * unspecified. |
---|
| 856 | * |
---|
| 857 | * @param year The year component. |
---|
| 858 | * @param month The month component. |
---|
| 859 | */ |
---|
| 860 | gyear_month (int year, unsigned short month); |
---|
| 861 | |
---|
| 862 | /** |
---|
| 863 | * @brief Initialize an instance with the year and month components |
---|
| 864 | * as well as %time zone. |
---|
| 865 | * |
---|
| 866 | * @param year The year component. |
---|
| 867 | * @param month The month component. |
---|
| 868 | * @param zone_hours The %time zone hours component. |
---|
| 869 | * @param zone_minutes The %time zone minutes component. |
---|
| 870 | */ |
---|
| 871 | gyear_month (int year, unsigned short month, |
---|
| 872 | short zone_hours, short zone_minutes); |
---|
| 873 | |
---|
| 874 | /** |
---|
| 875 | * @brief Copy constructor. |
---|
| 876 | * |
---|
| 877 | * @param x An instance to make a copy of. |
---|
| 878 | * @param f Flags to create the copy with. |
---|
| 879 | * @param c A pointer to the object that will contain the copy. |
---|
| 880 | * |
---|
| 881 | * For polymorphic object models use the _clone function instead. |
---|
| 882 | */ |
---|
| 883 | gyear_month (const gyear_month& x, flags f = 0, container* c = 0); |
---|
| 884 | |
---|
| 885 | /** |
---|
| 886 | * @brief Copy the instance polymorphically. |
---|
| 887 | * |
---|
| 888 | * @param f Flags to create the copy with. |
---|
| 889 | * @param c A pointer to the object that will contain the copy. |
---|
| 890 | * @return A pointer to the dynamically allocated copy. |
---|
| 891 | * |
---|
| 892 | * This function ensures that the dynamic type of the instance |
---|
| 893 | * is used for copying and should be used for polymorphic object |
---|
| 894 | * models instead of the copy constructor. |
---|
| 895 | */ |
---|
| 896 | virtual gyear_month* |
---|
| 897 | _clone (flags f = 0, container* c = 0) const; |
---|
| 898 | |
---|
| 899 | /** |
---|
| 900 | * @brief Create an instance from a data representation |
---|
| 901 | * stream. |
---|
| 902 | * |
---|
| 903 | * @param s A stream to extract the data from. |
---|
| 904 | * @param f Flags to create the new instance with. |
---|
| 905 | * @param c A pointer to the object that will contain the new |
---|
| 906 | * instance. |
---|
| 907 | */ |
---|
| 908 | template <typename S> |
---|
| 909 | gyear_month (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 910 | |
---|
| 911 | /** |
---|
| 912 | * @brief Create an instance from a DOM element. |
---|
| 913 | * |
---|
| 914 | * @param e A DOM element to extract the data from. |
---|
| 915 | * @param f Flags to create the new instance with. |
---|
| 916 | * @param c A pointer to the object that will contain the new |
---|
| 917 | * instance. |
---|
| 918 | */ |
---|
| 919 | gyear_month (const xercesc::DOMElement& e, |
---|
| 920 | flags f = 0, |
---|
| 921 | container* c = 0); |
---|
| 922 | |
---|
| 923 | /** |
---|
| 924 | * @brief Create an instance from a DOM Attribute. |
---|
| 925 | * |
---|
| 926 | * @param a A DOM attribute to extract the data from. |
---|
| 927 | * @param f Flags to create the new instance with. |
---|
| 928 | * @param c A pointer to the object that will contain the new |
---|
| 929 | * instance. |
---|
| 930 | */ |
---|
| 931 | gyear_month (const xercesc::DOMAttr& a, |
---|
| 932 | flags f = 0, |
---|
| 933 | container* c = 0); |
---|
| 934 | |
---|
| 935 | /** |
---|
| 936 | * @brief Create an instance from a %string fragment. |
---|
| 937 | * |
---|
| 938 | * @param s A %string fragment to extract the data from. |
---|
| 939 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 940 | * @param f Flags to create the new instance with. |
---|
| 941 | * @param c A pointer to the object that will contain the new |
---|
| 942 | * instance. |
---|
| 943 | */ |
---|
| 944 | gyear_month (const std::basic_string<C>& s, |
---|
| 945 | const xercesc::DOMElement* e, |
---|
| 946 | flags f = 0, |
---|
| 947 | container* c = 0); |
---|
| 948 | //@} |
---|
| 949 | |
---|
| 950 | public: |
---|
| 951 | /** |
---|
| 952 | * @brief Get the year component. |
---|
| 953 | * |
---|
| 954 | * @return The year component. |
---|
| 955 | */ |
---|
| 956 | int |
---|
| 957 | year () const; |
---|
| 958 | |
---|
| 959 | /** |
---|
| 960 | * @brief Set the year component. |
---|
| 961 | * |
---|
| 962 | * @param y The new year component. |
---|
| 963 | */ |
---|
| 964 | void |
---|
| 965 | year (int y); |
---|
| 966 | |
---|
| 967 | /** |
---|
| 968 | * @brief Get the month component. |
---|
| 969 | * |
---|
| 970 | * @return The month component. |
---|
| 971 | */ |
---|
| 972 | unsigned short |
---|
| 973 | month () const; |
---|
| 974 | |
---|
| 975 | /** |
---|
| 976 | * @brief Set the month component. |
---|
| 977 | * |
---|
| 978 | * @param m The new month component. |
---|
| 979 | */ |
---|
| 980 | void |
---|
| 981 | month (unsigned short m); |
---|
| 982 | |
---|
| 983 | protected: |
---|
| 984 | //@cond |
---|
| 985 | |
---|
| 986 | gyear_month (); |
---|
| 987 | |
---|
| 988 | void |
---|
| 989 | parse (const std::basic_string<C>&); |
---|
| 990 | |
---|
| 991 | //@endcond |
---|
| 992 | |
---|
| 993 | private: |
---|
| 994 | int year_; |
---|
| 995 | unsigned short month_; |
---|
| 996 | }; |
---|
| 997 | |
---|
| 998 | /** |
---|
| 999 | * @brief %gyear_month comparison operator. |
---|
| 1000 | * |
---|
| 1001 | * @return True if the year and month components as well as %time zones |
---|
| 1002 | * are equal, false otherwise. |
---|
| 1003 | */ |
---|
| 1004 | template <typename C, typename B> |
---|
| 1005 | bool |
---|
| 1006 | operator== (const gyear_month<C, B>&, const gyear_month<C, B>&); |
---|
| 1007 | |
---|
| 1008 | /** |
---|
| 1009 | * @brief %gyear_month comparison operator. |
---|
| 1010 | * |
---|
| 1011 | * @return False if the year and month components as well as %time zones |
---|
| 1012 | * are equal, true otherwise. |
---|
| 1013 | */ |
---|
| 1014 | template <typename C, typename B> |
---|
| 1015 | bool |
---|
| 1016 | operator!= (const gyear_month<C, B>&, const gyear_month<C, B>&); |
---|
| 1017 | |
---|
| 1018 | |
---|
| 1019 | /** |
---|
| 1020 | * @brief Class corresponding to the XML Schema %date built-in type. |
---|
| 1021 | * |
---|
| 1022 | * The %date class represents day, month, and year with an optional |
---|
| 1023 | * %time zone. |
---|
| 1024 | * |
---|
| 1025 | * @nosubgrouping |
---|
| 1026 | */ |
---|
| 1027 | template <typename C, typename B> |
---|
| 1028 | class date: public B, public time_zone |
---|
| 1029 | { |
---|
| 1030 | public: |
---|
| 1031 | /** |
---|
| 1032 | * @name Constructors |
---|
| 1033 | */ |
---|
| 1034 | //@{ |
---|
| 1035 | |
---|
| 1036 | /** |
---|
| 1037 | * @brief Initialize an instance with the year, month, and day |
---|
| 1038 | * components. |
---|
| 1039 | * |
---|
| 1040 | * When this constructor is used, the %time zone is left |
---|
| 1041 | * unspecified. |
---|
| 1042 | * |
---|
| 1043 | * @param year The year component. |
---|
| 1044 | * @param month The month component. |
---|
| 1045 | * @param day The day component. |
---|
| 1046 | */ |
---|
| 1047 | date (int year, unsigned short month, unsigned short day); |
---|
| 1048 | |
---|
| 1049 | /** |
---|
| 1050 | * @brief Initialize an instance with the year, month, and day |
---|
| 1051 | * components as well as %time zone. |
---|
| 1052 | * |
---|
| 1053 | * @param year The year component. |
---|
| 1054 | * @param month The month component. |
---|
| 1055 | * @param day The day component. |
---|
| 1056 | * @param zone_hours The %time zone hours component. |
---|
| 1057 | * @param zone_minutes The %time zone minutes component. |
---|
| 1058 | */ |
---|
| 1059 | date (int year, unsigned short month, unsigned short day, |
---|
| 1060 | short zone_hours, short zone_minutes); |
---|
| 1061 | |
---|
| 1062 | /** |
---|
| 1063 | * @brief Copy constructor. |
---|
| 1064 | * |
---|
| 1065 | * @param x An instance to make a copy of. |
---|
| 1066 | * @param f Flags to create the copy with. |
---|
| 1067 | * @param c A pointer to the object that will contain the copy. |
---|
| 1068 | * |
---|
| 1069 | * For polymorphic object models use the _clone function instead. |
---|
| 1070 | */ |
---|
| 1071 | date (const date& x, flags f = 0, container* c = 0); |
---|
| 1072 | |
---|
| 1073 | /** |
---|
| 1074 | * @brief Copy the instance polymorphically. |
---|
| 1075 | * |
---|
| 1076 | * @param f Flags to create the copy with. |
---|
| 1077 | * @param c A pointer to the object that will contain the copy. |
---|
| 1078 | * @return A pointer to the dynamically allocated copy. |
---|
| 1079 | * |
---|
| 1080 | * This function ensures that the dynamic type of the instance |
---|
| 1081 | * is used for copying and should be used for polymorphic object |
---|
| 1082 | * models instead of the copy constructor. |
---|
| 1083 | */ |
---|
| 1084 | virtual date* |
---|
| 1085 | _clone (flags f = 0, container* c = 0) const; |
---|
| 1086 | |
---|
| 1087 | /** |
---|
| 1088 | * @brief Create an instance from a data representation |
---|
| 1089 | * stream. |
---|
| 1090 | * |
---|
| 1091 | * @param s A stream to extract the data from. |
---|
| 1092 | * @param f Flags to create the new instance with. |
---|
| 1093 | * @param c A pointer to the object that will contain the new |
---|
| 1094 | * instance. |
---|
| 1095 | */ |
---|
| 1096 | template <typename S> |
---|
| 1097 | date (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 1098 | |
---|
| 1099 | /** |
---|
| 1100 | * @brief Create an instance from a DOM element. |
---|
| 1101 | * |
---|
| 1102 | * @param e A DOM element to extract the data from. |
---|
| 1103 | * @param f Flags to create the new instance with. |
---|
| 1104 | * @param c A pointer to the object that will contain the new |
---|
| 1105 | * instance. |
---|
| 1106 | */ |
---|
| 1107 | date (const xercesc::DOMElement& e, flags f = 0, container* c = 0); |
---|
| 1108 | |
---|
| 1109 | /** |
---|
| 1110 | * @brief Create an instance from a DOM Attribute. |
---|
| 1111 | * |
---|
| 1112 | * @param a A DOM attribute to extract the data from. |
---|
| 1113 | * @param f Flags to create the new instance with. |
---|
| 1114 | * @param c A pointer to the object that will contain the new |
---|
| 1115 | * instance. |
---|
| 1116 | */ |
---|
| 1117 | date (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); |
---|
| 1118 | |
---|
| 1119 | /** |
---|
| 1120 | * @brief Create an instance from a %string fragment. |
---|
| 1121 | * |
---|
| 1122 | * @param s A %string fragment to extract the data from. |
---|
| 1123 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 1124 | * @param f Flags to create the new instance with. |
---|
| 1125 | * @param c A pointer to the object that will contain the new |
---|
| 1126 | * instance. |
---|
| 1127 | */ |
---|
| 1128 | date (const std::basic_string<C>& s, |
---|
| 1129 | const xercesc::DOMElement* e, |
---|
| 1130 | flags f = 0, |
---|
| 1131 | container* c = 0); |
---|
| 1132 | //@} |
---|
| 1133 | |
---|
| 1134 | public: |
---|
| 1135 | /** |
---|
| 1136 | * @brief Get the year component. |
---|
| 1137 | * |
---|
| 1138 | * @return The year component. |
---|
| 1139 | */ |
---|
| 1140 | int |
---|
| 1141 | year () const; |
---|
| 1142 | |
---|
| 1143 | /** |
---|
| 1144 | * @brief Set the year component. |
---|
| 1145 | * |
---|
| 1146 | * @param y The new year component. |
---|
| 1147 | */ |
---|
| 1148 | void |
---|
| 1149 | year (int y); |
---|
| 1150 | |
---|
| 1151 | /** |
---|
| 1152 | * @brief Get the month component. |
---|
| 1153 | * |
---|
| 1154 | * @return The month component. |
---|
| 1155 | */ |
---|
| 1156 | unsigned short |
---|
| 1157 | month () const; |
---|
| 1158 | |
---|
| 1159 | /** |
---|
| 1160 | * @brief Set the month component. |
---|
| 1161 | * |
---|
| 1162 | * @param m The new month component. |
---|
| 1163 | */ |
---|
| 1164 | void |
---|
| 1165 | month (unsigned short m); |
---|
| 1166 | |
---|
| 1167 | /** |
---|
| 1168 | * @brief Get the day component. |
---|
| 1169 | * |
---|
| 1170 | * @return The day component. |
---|
| 1171 | */ |
---|
| 1172 | unsigned short |
---|
| 1173 | day () const; |
---|
| 1174 | |
---|
| 1175 | /** |
---|
| 1176 | * @brief Set the day component. |
---|
| 1177 | * |
---|
| 1178 | * @param d The new day component. |
---|
| 1179 | */ |
---|
| 1180 | void |
---|
| 1181 | day (unsigned short d); |
---|
| 1182 | |
---|
| 1183 | protected: |
---|
| 1184 | //@cond |
---|
| 1185 | |
---|
| 1186 | date (); |
---|
| 1187 | |
---|
| 1188 | void |
---|
| 1189 | parse (const std::basic_string<C>&); |
---|
| 1190 | |
---|
| 1191 | //@endcond |
---|
| 1192 | |
---|
| 1193 | private: |
---|
| 1194 | int year_; |
---|
| 1195 | unsigned short month_; |
---|
| 1196 | unsigned short day_; |
---|
| 1197 | }; |
---|
| 1198 | |
---|
| 1199 | /** |
---|
| 1200 | * @brief %date comparison operator. |
---|
| 1201 | * |
---|
| 1202 | * @return True if the year, month, and day components as well as %time |
---|
| 1203 | * zones are equal, false otherwise. |
---|
| 1204 | */ |
---|
| 1205 | template <typename C, typename B> |
---|
| 1206 | bool |
---|
| 1207 | operator== (const date<C, B>&, const date<C, B>&); |
---|
| 1208 | |
---|
| 1209 | /** |
---|
| 1210 | * @brief %date comparison operator. |
---|
| 1211 | * |
---|
| 1212 | * @return False if the year, month, and day components as well as %time |
---|
| 1213 | * zones are equal, true otherwise. |
---|
| 1214 | */ |
---|
| 1215 | template <typename C, typename B> |
---|
| 1216 | bool |
---|
| 1217 | operator!= (const date<C, B>&, const date<C, B>&); |
---|
| 1218 | |
---|
| 1219 | |
---|
| 1220 | /** |
---|
| 1221 | * @brief Class corresponding to the XML Schema %time built-in type. |
---|
| 1222 | * |
---|
| 1223 | * The %time class represents hours, minutes, and seconds with an |
---|
| 1224 | * optional %time zone. |
---|
| 1225 | * |
---|
| 1226 | * @nosubgrouping |
---|
| 1227 | */ |
---|
| 1228 | template <typename C, typename B> |
---|
| 1229 | class time: public B, public time_zone |
---|
| 1230 | { |
---|
| 1231 | public: |
---|
| 1232 | /** |
---|
| 1233 | * @name Constructors |
---|
| 1234 | */ |
---|
| 1235 | //@{ |
---|
| 1236 | |
---|
| 1237 | /** |
---|
| 1238 | * @brief Initialize an instance with the hours, minutes, and |
---|
| 1239 | * seconds components. |
---|
| 1240 | * |
---|
| 1241 | * When this constructor is used, the %time zone is left |
---|
| 1242 | * unspecified. |
---|
| 1243 | * |
---|
| 1244 | * @param hours The hours component. |
---|
| 1245 | * @param minutes The minutes component. |
---|
| 1246 | * @param seconds The seconds component. |
---|
| 1247 | */ |
---|
| 1248 | time (unsigned short hours, unsigned short minutes, double seconds); |
---|
| 1249 | |
---|
| 1250 | /** |
---|
| 1251 | * @brief Initialize an instance with the hours, minutes, and |
---|
| 1252 | * seconds components as well as %time zone. |
---|
| 1253 | * |
---|
| 1254 | * @param hours The hours component. |
---|
| 1255 | * @param minutes The minutes component. |
---|
| 1256 | * @param seconds The seconds component. |
---|
| 1257 | * @param zone_hours The %time zone hours component. |
---|
| 1258 | * @param zone_minutes The %time zone minutes component. |
---|
| 1259 | */ |
---|
| 1260 | time (unsigned short hours, unsigned short minutes, double seconds, |
---|
| 1261 | short zone_hours, short zone_minutes); |
---|
| 1262 | |
---|
| 1263 | /** |
---|
| 1264 | * @brief Copy constructor. |
---|
| 1265 | * |
---|
| 1266 | * @param x An instance to make a copy of. |
---|
| 1267 | * @param f Flags to create the copy with. |
---|
| 1268 | * @param c A pointer to the object that will contain the copy. |
---|
| 1269 | * |
---|
| 1270 | * For polymorphic object models use the _clone function instead. |
---|
| 1271 | */ |
---|
| 1272 | time (const time& x, flags f = 0, container* c = 0); |
---|
| 1273 | |
---|
| 1274 | /** |
---|
| 1275 | * @brief Copy the instance polymorphically. |
---|
| 1276 | * |
---|
| 1277 | * @param f Flags to create the copy with. |
---|
| 1278 | * @param c A pointer to the object that will contain the copy. |
---|
| 1279 | * @return A pointer to the dynamically allocated copy. |
---|
| 1280 | * |
---|
| 1281 | * This function ensures that the dynamic type of the instance |
---|
| 1282 | * is used for copying and should be used for polymorphic object |
---|
| 1283 | * models instead of the copy constructor. |
---|
| 1284 | */ |
---|
| 1285 | virtual time* |
---|
| 1286 | _clone (flags f = 0, container* c = 0) const; |
---|
| 1287 | |
---|
| 1288 | /** |
---|
| 1289 | * @brief Create an instance from a data representation |
---|
| 1290 | * stream. |
---|
| 1291 | * |
---|
| 1292 | * @param s A stream to extract the data from. |
---|
| 1293 | * @param f Flags to create the new instance with. |
---|
| 1294 | * @param c A pointer to the object that will contain the new |
---|
| 1295 | * instance. |
---|
| 1296 | */ |
---|
| 1297 | template <typename S> |
---|
| 1298 | time (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 1299 | |
---|
| 1300 | /** |
---|
| 1301 | * @brief Create an instance from a DOM element. |
---|
| 1302 | * |
---|
| 1303 | * @param e A DOM element to extract the data from. |
---|
| 1304 | * @param f Flags to create the new instance with. |
---|
| 1305 | * @param c A pointer to the object that will contain the new |
---|
| 1306 | * instance. |
---|
| 1307 | */ |
---|
| 1308 | time (const xercesc::DOMElement& e, flags f = 0, container* c = 0); |
---|
| 1309 | |
---|
| 1310 | /** |
---|
| 1311 | * @brief Create an instance from a DOM Attribute. |
---|
| 1312 | * |
---|
| 1313 | * @param a A DOM attribute to extract the data from. |
---|
| 1314 | * @param f Flags to create the new instance with. |
---|
| 1315 | * @param c A pointer to the object that will contain the new |
---|
| 1316 | * instance. |
---|
| 1317 | */ |
---|
| 1318 | time (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); |
---|
| 1319 | |
---|
| 1320 | /** |
---|
| 1321 | * @brief Create an instance from a %string fragment. |
---|
| 1322 | * |
---|
| 1323 | * @param s A %string fragment to extract the data from. |
---|
| 1324 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 1325 | * @param f Flags to create the new instance with. |
---|
| 1326 | * @param c A pointer to the object that will contain the new |
---|
| 1327 | * instance. |
---|
| 1328 | */ |
---|
| 1329 | time (const std::basic_string<C>& s, |
---|
| 1330 | const xercesc::DOMElement* e, |
---|
| 1331 | flags f = 0, |
---|
| 1332 | container* c = 0); |
---|
| 1333 | //@} |
---|
| 1334 | |
---|
| 1335 | public: |
---|
| 1336 | /** |
---|
| 1337 | * @brief Get the hours component. |
---|
| 1338 | * |
---|
| 1339 | * @return The hours component. |
---|
| 1340 | */ |
---|
| 1341 | unsigned short |
---|
| 1342 | hours () const; |
---|
| 1343 | |
---|
| 1344 | /** |
---|
| 1345 | * @brief Set the hours component. |
---|
| 1346 | * |
---|
| 1347 | * @param h The new hours component. |
---|
| 1348 | */ |
---|
| 1349 | void |
---|
| 1350 | hours (unsigned short h); |
---|
| 1351 | |
---|
| 1352 | /** |
---|
| 1353 | * @brief Get the minutes component. |
---|
| 1354 | * |
---|
| 1355 | * @return The minutes component. |
---|
| 1356 | */ |
---|
| 1357 | unsigned short |
---|
| 1358 | minutes () const; |
---|
| 1359 | |
---|
| 1360 | /** |
---|
| 1361 | * @brief Set the minutes component. |
---|
| 1362 | * |
---|
| 1363 | * @param m The new minutes component. |
---|
| 1364 | */ |
---|
| 1365 | void |
---|
| 1366 | minutes (unsigned short m); |
---|
| 1367 | |
---|
| 1368 | /** |
---|
| 1369 | * @brief Get the seconds component. |
---|
| 1370 | * |
---|
| 1371 | * @return The seconds component. |
---|
| 1372 | */ |
---|
| 1373 | double |
---|
| 1374 | seconds () const; |
---|
| 1375 | |
---|
| 1376 | /** |
---|
| 1377 | * @brief Set the seconds component. |
---|
| 1378 | * |
---|
| 1379 | * @param s The new seconds component. |
---|
| 1380 | */ |
---|
| 1381 | void |
---|
| 1382 | seconds (double s); |
---|
| 1383 | |
---|
| 1384 | protected: |
---|
| 1385 | //@cond |
---|
| 1386 | |
---|
| 1387 | time (); |
---|
| 1388 | |
---|
| 1389 | void |
---|
| 1390 | parse (const std::basic_string<C>&); |
---|
| 1391 | |
---|
| 1392 | //@endcond |
---|
| 1393 | |
---|
| 1394 | private: |
---|
| 1395 | unsigned short hours_; |
---|
| 1396 | unsigned short minutes_; |
---|
| 1397 | double seconds_; |
---|
| 1398 | }; |
---|
| 1399 | |
---|
| 1400 | /** |
---|
| 1401 | * @brief %time comparison operator. |
---|
| 1402 | * |
---|
| 1403 | * @return True if the hours, seconds, and minutes components as well |
---|
| 1404 | * as %time zones are equal, false otherwise. |
---|
| 1405 | */ |
---|
| 1406 | template <typename C, typename B> |
---|
| 1407 | bool |
---|
| 1408 | operator== (const time<C, B>&, const time<C, B>&); |
---|
| 1409 | |
---|
| 1410 | /** |
---|
| 1411 | * @brief %time comparison operator. |
---|
| 1412 | * |
---|
| 1413 | * @return False if the hours, seconds, and minutes components as well |
---|
| 1414 | * as %time zones are equal, true otherwise. |
---|
| 1415 | */ |
---|
| 1416 | template <typename C, typename B> |
---|
| 1417 | bool |
---|
| 1418 | operator!= (const time<C, B>&, const time<C, B>&); |
---|
| 1419 | |
---|
| 1420 | |
---|
| 1421 | /** |
---|
| 1422 | * @brief Class corresponding to the XML Schema dateTime built-in type. |
---|
| 1423 | * |
---|
| 1424 | * The %date_time class represents year, month, day, hours, minutes, |
---|
| 1425 | * and seconds with an optional %time zone. |
---|
| 1426 | * |
---|
| 1427 | * @nosubgrouping |
---|
| 1428 | */ |
---|
| 1429 | template <typename C, typename B> |
---|
| 1430 | class date_time: public B, public time_zone |
---|
| 1431 | { |
---|
| 1432 | public: |
---|
| 1433 | /** |
---|
| 1434 | * @name Constructors |
---|
| 1435 | */ |
---|
| 1436 | //@{ |
---|
| 1437 | |
---|
| 1438 | /** |
---|
| 1439 | * @brief Initialize an instance with the year, month, day, hours, |
---|
| 1440 | * minutes, and seconds components. |
---|
| 1441 | * |
---|
| 1442 | * When this constructor is used, the %time zone is left |
---|
| 1443 | * unspecified. |
---|
| 1444 | * |
---|
| 1445 | * @param year The year component. |
---|
| 1446 | * @param month The month component. |
---|
| 1447 | * @param day The day component. |
---|
| 1448 | * @param hours The hours component. |
---|
| 1449 | * @param minutes The minutes component. |
---|
| 1450 | * @param seconds The seconds component. |
---|
| 1451 | */ |
---|
| 1452 | date_time (int year, unsigned short month, unsigned short day, |
---|
| 1453 | unsigned short hours, unsigned short minutes, |
---|
| 1454 | double seconds); |
---|
| 1455 | |
---|
| 1456 | /** |
---|
| 1457 | * @brief Initialize an instance with the year, month, day, hours, |
---|
| 1458 | * minutes, and seconds components as well as %time zone. |
---|
| 1459 | * |
---|
| 1460 | * @param year The year component. |
---|
| 1461 | * @param month The month component. |
---|
| 1462 | * @param day The day component. |
---|
| 1463 | * @param hours The hours component. |
---|
| 1464 | * @param minutes The minutes component. |
---|
| 1465 | * @param seconds The seconds component. |
---|
| 1466 | * @param zone_hours The %time zone hours component. |
---|
| 1467 | * @param zone_minutes The %time zone minutes component. |
---|
| 1468 | */ |
---|
| 1469 | date_time (int year, unsigned short month, unsigned short day, |
---|
| 1470 | unsigned short hours, unsigned short minutes, |
---|
| 1471 | double seconds, short zone_hours, short zone_minutes); |
---|
| 1472 | |
---|
| 1473 | /** |
---|
| 1474 | * @brief Copy constructor. |
---|
| 1475 | * |
---|
| 1476 | * @param x An instance to make a copy of. |
---|
| 1477 | * @param f Flags to create the copy with. |
---|
| 1478 | * @param c A pointer to the object that will contain the copy. |
---|
| 1479 | * |
---|
| 1480 | * For polymorphic object models use the _clone function instead. |
---|
| 1481 | */ |
---|
| 1482 | date_time (const date_time& x, flags f = 0, container* c = 0); |
---|
| 1483 | |
---|
| 1484 | /** |
---|
| 1485 | * @brief Copy the instance polymorphically. |
---|
| 1486 | * |
---|
| 1487 | * @param f Flags to create the copy with. |
---|
| 1488 | * @param c A pointer to the object that will contain the copy. |
---|
| 1489 | * @return A pointer to the dynamically allocated copy. |
---|
| 1490 | * |
---|
| 1491 | * This function ensures that the dynamic type of the instance |
---|
| 1492 | * is used for copying and should be used for polymorphic object |
---|
| 1493 | * models instead of the copy constructor. |
---|
| 1494 | */ |
---|
| 1495 | virtual date_time* |
---|
| 1496 | _clone (flags f = 0, container* c = 0) const; |
---|
| 1497 | |
---|
| 1498 | /** |
---|
| 1499 | * @brief Create an instance from a data representation |
---|
| 1500 | * stream. |
---|
| 1501 | * |
---|
| 1502 | * @param s A stream to extract the data from. |
---|
| 1503 | * @param f Flags to create the new instance with. |
---|
| 1504 | * @param c A pointer to the object that will contain the new |
---|
| 1505 | * instance. |
---|
| 1506 | */ |
---|
| 1507 | template <typename S> |
---|
| 1508 | date_time (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 1509 | |
---|
| 1510 | /** |
---|
| 1511 | * @brief Create an instance from a DOM element. |
---|
| 1512 | * |
---|
| 1513 | * @param e A DOM element to extract the data from. |
---|
| 1514 | * @param f Flags to create the new instance with. |
---|
| 1515 | * @param c A pointer to the object that will contain the new |
---|
| 1516 | * instance. |
---|
| 1517 | */ |
---|
| 1518 | date_time (const xercesc::DOMElement& e, |
---|
| 1519 | flags f = 0, |
---|
| 1520 | container* c = 0); |
---|
| 1521 | |
---|
| 1522 | /** |
---|
| 1523 | * @brief Create an instance from a DOM Attribute. |
---|
| 1524 | * |
---|
| 1525 | * @param a A DOM attribute to extract the data from. |
---|
| 1526 | * @param f Flags to create the new instance with. |
---|
| 1527 | * @param c A pointer to the object that will contain the new |
---|
| 1528 | * instance. |
---|
| 1529 | */ |
---|
| 1530 | date_time (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); |
---|
| 1531 | |
---|
| 1532 | /** |
---|
| 1533 | * @brief Create an instance from a %string fragment. |
---|
| 1534 | * |
---|
| 1535 | * @param s A %string fragment to extract the data from. |
---|
| 1536 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 1537 | * @param f Flags to create the new instance with. |
---|
| 1538 | * @param c A pointer to the object that will contain the new |
---|
| 1539 | * instance. |
---|
| 1540 | */ |
---|
| 1541 | date_time (const std::basic_string<C>& s, |
---|
| 1542 | const xercesc::DOMElement* e, |
---|
| 1543 | flags f = 0, |
---|
| 1544 | container* c = 0); |
---|
| 1545 | //@} |
---|
| 1546 | |
---|
| 1547 | public: |
---|
| 1548 | /** |
---|
| 1549 | * @brief Get the year component. |
---|
| 1550 | * |
---|
| 1551 | * @return The year component. |
---|
| 1552 | */ |
---|
| 1553 | int |
---|
| 1554 | year () const; |
---|
| 1555 | |
---|
| 1556 | /** |
---|
| 1557 | * @brief Set the year component. |
---|
| 1558 | * |
---|
| 1559 | * @param y The new year component. |
---|
| 1560 | */ |
---|
| 1561 | void |
---|
| 1562 | year (int y); |
---|
| 1563 | |
---|
| 1564 | /** |
---|
| 1565 | * @brief Get the month component. |
---|
| 1566 | * |
---|
| 1567 | * @return The month component. |
---|
| 1568 | */ |
---|
| 1569 | unsigned short |
---|
| 1570 | month () const; |
---|
| 1571 | |
---|
| 1572 | /** |
---|
| 1573 | * @brief Set the month component. |
---|
| 1574 | * |
---|
| 1575 | * @param m The new month component. |
---|
| 1576 | */ |
---|
| 1577 | void |
---|
| 1578 | month (unsigned short m); |
---|
| 1579 | |
---|
| 1580 | /** |
---|
| 1581 | * @brief Get the day component. |
---|
| 1582 | * |
---|
| 1583 | * @return The day component. |
---|
| 1584 | */ |
---|
| 1585 | unsigned short |
---|
| 1586 | day () const; |
---|
| 1587 | |
---|
| 1588 | /** |
---|
| 1589 | * @brief Set the day component. |
---|
| 1590 | * |
---|
| 1591 | * @param d The new day component. |
---|
| 1592 | */ |
---|
| 1593 | void |
---|
| 1594 | day (unsigned short d); |
---|
| 1595 | |
---|
| 1596 | /** |
---|
| 1597 | * @brief Get the hours component. |
---|
| 1598 | * |
---|
| 1599 | * @return The hours component. |
---|
| 1600 | */ |
---|
| 1601 | unsigned short |
---|
| 1602 | hours () const; |
---|
| 1603 | |
---|
| 1604 | /** |
---|
| 1605 | * @brief Set the hours component. |
---|
| 1606 | * |
---|
| 1607 | * @param h The new hours component. |
---|
| 1608 | */ |
---|
| 1609 | void |
---|
| 1610 | hours (unsigned short h); |
---|
| 1611 | |
---|
| 1612 | /** |
---|
| 1613 | * @brief Get the minutes component. |
---|
| 1614 | * |
---|
| 1615 | * @return The minutes component. |
---|
| 1616 | */ |
---|
| 1617 | unsigned short |
---|
| 1618 | minutes () const; |
---|
| 1619 | |
---|
| 1620 | /** |
---|
| 1621 | * @brief Set the minutes component. |
---|
| 1622 | * |
---|
| 1623 | * @param m The new minutes component. |
---|
| 1624 | */ |
---|
| 1625 | void |
---|
| 1626 | minutes (unsigned short m); |
---|
| 1627 | |
---|
| 1628 | /** |
---|
| 1629 | * @brief Get the seconds component. |
---|
| 1630 | * |
---|
| 1631 | * @return The seconds component. |
---|
| 1632 | */ |
---|
| 1633 | double |
---|
| 1634 | seconds () const; |
---|
| 1635 | |
---|
| 1636 | /** |
---|
| 1637 | * @brief Set the seconds component. |
---|
| 1638 | * |
---|
| 1639 | * @param s The new seconds component. |
---|
| 1640 | */ |
---|
| 1641 | void |
---|
| 1642 | seconds (double s); |
---|
| 1643 | |
---|
| 1644 | protected: |
---|
| 1645 | //@cond |
---|
| 1646 | |
---|
| 1647 | date_time (); |
---|
| 1648 | |
---|
| 1649 | void |
---|
| 1650 | parse (const std::basic_string<C>&); |
---|
| 1651 | |
---|
| 1652 | //@endcond |
---|
| 1653 | |
---|
| 1654 | private: |
---|
| 1655 | int year_; |
---|
| 1656 | unsigned short month_; |
---|
| 1657 | unsigned short day_; |
---|
| 1658 | unsigned short hours_; |
---|
| 1659 | unsigned short minutes_; |
---|
| 1660 | double seconds_; |
---|
| 1661 | }; |
---|
| 1662 | |
---|
| 1663 | /** |
---|
| 1664 | * @brief %date_time comparison operator. |
---|
| 1665 | * |
---|
| 1666 | * @return True if the year, month, day, hours, seconds, and minutes |
---|
| 1667 | * components as well as %time zones are equal, false otherwise. |
---|
| 1668 | */ |
---|
| 1669 | template <typename C, typename B> |
---|
| 1670 | bool |
---|
| 1671 | operator== (const date_time<C, B>&, const date_time<C, B>&); |
---|
| 1672 | |
---|
| 1673 | /** |
---|
| 1674 | * @brief %date_time comparison operator. |
---|
| 1675 | * |
---|
| 1676 | * @return False if the year, month, day, hours, seconds, and minutes |
---|
| 1677 | * components as well as %time zones are equal, true otherwise. |
---|
| 1678 | */ |
---|
| 1679 | template <typename C, typename B> |
---|
| 1680 | bool |
---|
| 1681 | operator!= (const date_time<C, B>&, const date_time<C, B>&); |
---|
| 1682 | |
---|
| 1683 | |
---|
| 1684 | /** |
---|
| 1685 | * @brief Class corresponding to the XML Schema %duration built-in type. |
---|
| 1686 | * |
---|
| 1687 | * The %duration class represents a potentially negative %duration in |
---|
| 1688 | * the form of years, months, days, hours, minutes, and seconds. |
---|
| 1689 | * |
---|
| 1690 | * @nosubgrouping |
---|
| 1691 | */ |
---|
| 1692 | template <typename C, typename B> |
---|
| 1693 | class duration: public B |
---|
| 1694 | { |
---|
| 1695 | public: |
---|
| 1696 | /** |
---|
| 1697 | * @name Constructors |
---|
| 1698 | */ |
---|
| 1699 | //@{ |
---|
| 1700 | /** |
---|
| 1701 | * @brief Initialize a potentially negative instance with the years, |
---|
| 1702 | * months, days, hours, minutes, and seconds components. |
---|
| 1703 | * |
---|
| 1704 | * @param negative A boolean value indicating whether the %duration |
---|
| 1705 | * is negative (true) or positive (false). |
---|
| 1706 | * @param years The years component. |
---|
| 1707 | * @param months The months component. |
---|
| 1708 | * @param days The days component. |
---|
| 1709 | * @param hours The hours component. |
---|
| 1710 | * @param minutes The minutes component. |
---|
| 1711 | * @param seconds The seconds component. |
---|
| 1712 | */ |
---|
| 1713 | duration (bool negative, |
---|
| 1714 | unsigned int years, unsigned int months, unsigned int days, |
---|
| 1715 | unsigned int hours, unsigned int minutes, double seconds); |
---|
| 1716 | |
---|
| 1717 | /** |
---|
| 1718 | * @brief Copy constructor. |
---|
| 1719 | * |
---|
| 1720 | * @param x An instance to make a copy of. |
---|
| 1721 | * @param f Flags to create the copy with. |
---|
| 1722 | * @param c A pointer to the object that will contain the copy. |
---|
| 1723 | * |
---|
| 1724 | * For polymorphic object models use the _clone function instead. |
---|
| 1725 | */ |
---|
| 1726 | duration (const duration& x, flags f = 0, container* c = 0); |
---|
| 1727 | |
---|
| 1728 | /** |
---|
| 1729 | * @brief Copy the instance polymorphically. |
---|
| 1730 | * |
---|
| 1731 | * @param f Flags to create the copy with. |
---|
| 1732 | * @param c A pointer to the object that will contain the copy. |
---|
| 1733 | * @return A pointer to the dynamically allocated copy. |
---|
| 1734 | * |
---|
| 1735 | * This function ensures that the dynamic type of the instance |
---|
| 1736 | * is used for copying and should be used for polymorphic object |
---|
| 1737 | * models instead of the copy constructor. |
---|
| 1738 | */ |
---|
| 1739 | virtual duration* |
---|
| 1740 | _clone (flags f = 0, container* c = 0) const; |
---|
| 1741 | |
---|
| 1742 | /** |
---|
| 1743 | * @brief Create an instance from a data representation |
---|
| 1744 | * stream. |
---|
| 1745 | * |
---|
| 1746 | * @param s A stream to extract the data from. |
---|
| 1747 | * @param f Flags to create the new instance with. |
---|
| 1748 | * @param c A pointer to the object that will contain the new |
---|
| 1749 | * instance. |
---|
| 1750 | */ |
---|
| 1751 | template <typename S> |
---|
| 1752 | duration (istream<S>& s, flags f = 0, container* c = 0); |
---|
| 1753 | |
---|
| 1754 | /** |
---|
| 1755 | * @brief Create an instance from a DOM element. |
---|
| 1756 | * |
---|
| 1757 | * @param e A DOM element to extract the data from. |
---|
| 1758 | * @param f Flags to create the new instance with. |
---|
| 1759 | * @param c A pointer to the object that will contain the new |
---|
| 1760 | * instance. |
---|
| 1761 | */ |
---|
| 1762 | duration (const xercesc::DOMElement& e, |
---|
| 1763 | flags f = 0, |
---|
| 1764 | container* c = 0); |
---|
| 1765 | |
---|
| 1766 | /** |
---|
| 1767 | * @brief Create an instance from a DOM Attribute. |
---|
| 1768 | * |
---|
| 1769 | * @param a A DOM attribute to extract the data from. |
---|
| 1770 | * @param f Flags to create the new instance with. |
---|
| 1771 | * @param c A pointer to the object that will contain the new |
---|
| 1772 | * instance. |
---|
| 1773 | */ |
---|
| 1774 | duration (const xercesc::DOMAttr& a, flags f = 0, container* c = 0); |
---|
| 1775 | |
---|
| 1776 | /** |
---|
| 1777 | * @brief Create an instance from a %string fragment. |
---|
| 1778 | * |
---|
| 1779 | * @param s A %string fragment to extract the data from. |
---|
| 1780 | * @param e A pointer to DOM element containing the %string fragment. |
---|
| 1781 | * @param f Flags to create the new instance with. |
---|
| 1782 | * @param c A pointer to the object that will contain the new |
---|
| 1783 | * instance. |
---|
| 1784 | */ |
---|
| 1785 | duration (const std::basic_string<C>& s, |
---|
| 1786 | const xercesc::DOMElement* e, |
---|
| 1787 | flags f = 0, |
---|
| 1788 | container* c = 0); |
---|
| 1789 | //@} |
---|
| 1790 | |
---|
| 1791 | public: |
---|
| 1792 | /** |
---|
| 1793 | * @brief Determine if %duration is negative. |
---|
| 1794 | * |
---|
| 1795 | * @return True if %duration is negative, false otherwise. |
---|
| 1796 | */ |
---|
| 1797 | bool |
---|
| 1798 | negative () const; |
---|
| 1799 | |
---|
| 1800 | /** |
---|
| 1801 | * @brief Change %duration sign. |
---|
| 1802 | * |
---|
| 1803 | * @param n A boolean value indicating whether %duration is |
---|
| 1804 | * negative (true) or positive (false). |
---|
| 1805 | */ |
---|
| 1806 | void |
---|
| 1807 | negative (bool n); |
---|
| 1808 | |
---|
| 1809 | /** |
---|
| 1810 | * @brief Get the years component. |
---|
| 1811 | * |
---|
| 1812 | * @return The years component. |
---|
| 1813 | */ |
---|
| 1814 | unsigned int |
---|
| 1815 | years () const; |
---|
| 1816 | |
---|
| 1817 | /** |
---|
| 1818 | * @brief Set the years component. |
---|
| 1819 | * |
---|
| 1820 | * @param y The new years component. |
---|
| 1821 | */ |
---|
| 1822 | void |
---|
| 1823 | years (unsigned int y); |
---|
| 1824 | |
---|
| 1825 | /** |
---|
| 1826 | * @brief Get the months component. |
---|
| 1827 | * |
---|
| 1828 | * @return The months component. |
---|
| 1829 | */ |
---|
| 1830 | unsigned int |
---|
| 1831 | months () const; |
---|
| 1832 | |
---|
| 1833 | /** |
---|
| 1834 | * @brief Set the months component. |
---|
| 1835 | * |
---|
| 1836 | * @param m The new months component. |
---|
| 1837 | */ |
---|
| 1838 | void |
---|
| 1839 | months (unsigned int m); |
---|
| 1840 | |
---|
| 1841 | /** |
---|
| 1842 | * @brief Get the days component. |
---|
| 1843 | * |
---|
| 1844 | * @return The days component. |
---|
| 1845 | */ |
---|
| 1846 | unsigned int |
---|
| 1847 | days () const; |
---|
| 1848 | |
---|
| 1849 | /** |
---|
| 1850 | * @brief Set the days component. |
---|
| 1851 | * |
---|
| 1852 | * @param d The new days component. |
---|
| 1853 | */ |
---|
| 1854 | void |
---|
| 1855 | days (unsigned int d); |
---|
| 1856 | |
---|
| 1857 | /** |
---|
| 1858 | * @brief Get the hours component. |
---|
| 1859 | * |
---|
| 1860 | * @return The hours component. |
---|
| 1861 | */ |
---|
| 1862 | unsigned int |
---|
| 1863 | hours () const; |
---|
| 1864 | |
---|
| 1865 | /** |
---|
| 1866 | * @brief Set the hours component. |
---|
| 1867 | * |
---|
| 1868 | * @param h The new hours component. |
---|
| 1869 | */ |
---|
| 1870 | void |
---|
| 1871 | hours (unsigned int h); |
---|
| 1872 | |
---|
| 1873 | /** |
---|
| 1874 | * @brief Get the minutes component. |
---|
| 1875 | * |
---|
| 1876 | * @return The minutes component. |
---|
| 1877 | */ |
---|
| 1878 | unsigned int |
---|
| 1879 | minutes () const; |
---|
| 1880 | |
---|
| 1881 | /** |
---|
| 1882 | * @brief Set the minutes component. |
---|
| 1883 | * |
---|
| 1884 | * @param m The new minutes component. |
---|
| 1885 | */ |
---|
| 1886 | void |
---|
| 1887 | minutes (unsigned int m); |
---|
| 1888 | |
---|
| 1889 | /** |
---|
| 1890 | * @brief Get the seconds component. |
---|
| 1891 | * |
---|
| 1892 | * @return The seconds component. |
---|
| 1893 | */ |
---|
| 1894 | double |
---|
| 1895 | seconds () const; |
---|
| 1896 | |
---|
| 1897 | /** |
---|
| 1898 | * @brief Set the seconds component. |
---|
| 1899 | * |
---|
| 1900 | * @param s The new seconds component. |
---|
| 1901 | */ |
---|
| 1902 | void |
---|
| 1903 | seconds (double s); |
---|
| 1904 | |
---|
| 1905 | protected: |
---|
| 1906 | //@cond |
---|
| 1907 | |
---|
| 1908 | duration (); |
---|
| 1909 | |
---|
| 1910 | void |
---|
| 1911 | parse (const std::basic_string<C>&); |
---|
| 1912 | |
---|
| 1913 | //@endcond |
---|
| 1914 | |
---|
| 1915 | private: |
---|
| 1916 | bool negative_; |
---|
| 1917 | unsigned int years_; |
---|
| 1918 | unsigned int months_; |
---|
| 1919 | unsigned int days_; |
---|
| 1920 | unsigned int hours_; |
---|
| 1921 | unsigned int minutes_; |
---|
| 1922 | double seconds_; |
---|
| 1923 | }; |
---|
| 1924 | |
---|
| 1925 | /** |
---|
| 1926 | * @brief %duration comparison operator. |
---|
| 1927 | * |
---|
| 1928 | * @return True if the sings as well as years, months, days, hours, |
---|
| 1929 | * seconds, and minutes components are equal, false otherwise. |
---|
| 1930 | */ |
---|
| 1931 | template <typename C, typename B> |
---|
| 1932 | bool |
---|
| 1933 | operator== (const duration<C, B>&, const duration<C, B>&); |
---|
| 1934 | |
---|
| 1935 | /** |
---|
| 1936 | * @brief %duration comparison operator. |
---|
| 1937 | * |
---|
| 1938 | * @return False if the sings as well as years, months, days, hours, |
---|
| 1939 | * seconds, and minutes components are equal, true otherwise. |
---|
| 1940 | */ |
---|
| 1941 | template <typename C, typename B> |
---|
| 1942 | bool |
---|
| 1943 | operator!= (const duration<C, B>&, const duration<C, B>&); |
---|
| 1944 | } |
---|
| 1945 | } |
---|
| 1946 | } |
---|
| 1947 | |
---|
| 1948 | #include <xsd/cxx/tree/date-time.ixx> |
---|
| 1949 | #include <xsd/cxx/tree/date-time.txx> |
---|
| 1950 | |
---|
| 1951 | #endif // XSD_CXX_TREE_DATE_TIME_HXX |
---|