1 /*- 2 * Copyright (c) 2004 - 2011 CTPP Team 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 4. Neither the name of the CTPP Team nor the names of its contributors 13 * may be used to endorse or promote products derived from this software 14 * without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * CDT.hpp 29 * 30 * $CTPP$ 31 */ 32 #ifndef _CDT_HPP__ 33 #define _CDT_HPP__ 1 34 35 /** 36 @file CDT.hpp 37 @brief Common Data Type 38 */ 39 40 #include "STLMap.hpp" 41 #include "STLString.hpp" 42 #include "STLVector.hpp" 43 44 #include "CTPP2Exception.hpp" 45 46 namespace CTPP // C++ Template Engine 47 { 48 49 #define C_MAX_SPRINTF_LENGTH 128 50 51 class CTPP2DECL CDTConstIterator; 52 class CTPP2DECL CDTIterator; 53 54 /** 55 @class CDT CDT.hpp <CDT.hpp> 56 @brief Common Data Type 57 */ 58 class CTPP2DECL CDT 59 { 60 public: 61 /** 62 @var typedef STLW::string<CDT> String 63 @brief internal string definition 64 */ 65 typedef STLW::string String; 66 67 /** 68 @var typedef STLW::vector<CDT> Vector 69 @brief internal array definition 70 */ 71 typedef STLW::vector<CDT> Vector; 72 73 /** 74 @var typedef STLW::map<String, CDT> Map 75 @brief internal hash definition 76 */ 77 typedef STLW::map<String, CDT> Map; 78 79 /** 80 @enum eValType CDT.hpp <CDT.hpp> 81 @brief Describes type of stored value 82 */ 83 enum eValType { UNDEF = 0x01, 84 INT_VAL = 0x02, 85 REAL_VAL = 0x04, 86 POINTER_VAL = 0x08, 87 STRING_VAL = 0x10, 88 89 STRING_INT_VAL = 0x12, 90 STRING_REAL_VAL = 0x14, 91 92 ARRAY_VAL = 0x20, 93 HASH_VAL = 0x40 /*, 94 REFERENCE_VAL = 0x80 */ 95 }; 96 97 /** 98 @enum eMergeStrategy CDT.hpp <CDT.hpp> 99 @brief Describes merging strategy for HASH-es and ARRAY-s 100 */ 101 enum eMergeStrategy { FAST_MERGE, DEEP_MERGE }; 102 103 // FWD 104 class CTPP2DECL SortingComparator; 105 106 /** 107 @brief Constructor 108 @param oValue - type of value 109 */ 110 CDT(const CDT::eValType & oValue = UNDEF); 111 112 /** 113 @brief Copy constructor 114 @param oCDT - Object to copy 115 */ 116 CDT(const CDT & oCDT); 117 118 /** 119 @brief Copy operator 120 @param oCDT - Object to copy 121 @return read/write referense to self 122 */ 123 CDT & operator=(const CDT & oCDT); 124 125 /** 126 @brief Type cast constructor 127 @param oValue - INT_64 value 128 */ 129 CDT(const INT_64 oValue); 130 131 /** 132 @brief Type cast constructor 133 @param oValue - UINT_64 value 134 */ 135 CDT(const UINT_64 oValue); 136 137 /** 138 @brief Type cast constructor 139 @param oValue - INT_32 value 140 */ 141 CDT(const INT_32 oValue); 142 143 /** 144 @brief Type cast constructor 145 @param oValue - UINT_32 value 146 */ 147 CDT(const UINT_32 oValue); 148 149 /** 150 @brief Type cast constructor 151 @param oValue - W_FLOAT value 152 */ 153 CDT(const W_FLOAT oValue); 154 155 /** 156 @brief Type cast constructor 157 @param oValue - string value 158 */ 159 CDT(const STLW::string & oValue); 160 161 /** 162 @brief Type cast constructor 163 @param oValue - asciz string to copy 164 @return read/write referense to self 165 */ 166 CDT(CCHAR_P oValue); 167 168 /** 169 @brief Type cast constructor 170 @param oValue - generic pointer value 171 */ 172 CDT(void * oValue); 173 174 /** 175 @brief Copy operator 176 @param oValue - INT_64 value to copy 177 @return read/write referense to self 178 */ 179 CDT & operator=(const INT_64 oValue); 180 181 /** 182 @brief Copy operator 183 @param oValue - UINT_64 value to copy 184 @return read/write referense to self 185 */ 186 CDT & operator=(const UINT_64 oValue); 187 188 /** 189 @brief Copy operator 190 @param oValue - INT_32 value to copy 191 @return read/write referense to self 192 */ 193 CDT & operator=(const INT_32 oValue); 194 195 /** 196 @brief Copy operator 197 @param oValue - UINT_32 value to copy 198 @return read/write referense to self 199 */ 200 CDT & operator=(const UINT_32 oValue); 201 202 /** 203 @brief Copy operator 204 @param oValue - W_FLOAT value to copy 205 @return read/write referense to self 206 */ 207 CDT & operator=(const W_FLOAT oValue); 208 209 /** 210 @brief Copy operator 211 @param oValue - string to copy 212 @return read/write referense to self 213 */ 214 CDT & operator=(const STLW::string & oValue); 215 216 /** 217 @brief Copy operator 218 @param oValue - asciz string to copy 219 @return read/write referense to self 220 */ 221 CDT & operator=(CCHAR_P oValue); 222 223 /** 224 @brief Copy operator 225 @param oValue - generic pointer 226 @return read/write referense to self 227 */ 228 CDT & operator=(void * oValue); 229 230 /** 231 @brief Provides access to the data contained in CDT 232 @param iPos - The index of the element 233 @return Object with data 234 */ 235 CDT & operator[](const UINT_32 iPos); 236 237 /** 238 @brief Provides access to the data contained in CDT (constant method) 239 @param iPos - The index of the element 240 @return Object with data 241 */ 242 const CDT & operator[](const UINT_32 iPos) const; 243 244 /** 245 @brief Provides access to the data contained in CDT 246 @param sKey - The key of the element 247 @return Object with data 248 */ 249 CDT & operator[](const STLW::string & sKey); 250 251 /** 252 @brief Provides access to the data contained in CDT (constant method) 253 @param sKey - The key of the element 254 @return Object with data 255 */ 256 const CDT & operator[](const STLW::string & sKey) const; 257 258 /** 259 @brief Provides constant access to the data contained in CDT 260 @param iPos - The index of the element 261 @return Object with data 262 */ 263 const CDT & GetCDT(const UINT_32 iPos) const; 264 265 /** 266 @brief Provides constant access to the data contained in CDT 267 @param sKey - The key of the hash 268 @return Object with data 269 */ 270 const CDT & GetCDT(const STLW::string & sKey) const; 271 272 /** 273 @brief Provides constant access to the data contained in CDT 274 @param sKey - The key of the hash [in] 275 @param bCDTExist - Existence flag [out], is set to true if object exist or false otherwise 276 @return Object with data 277 */ 278 const CDT & GetExistedCDT(const STLW::string & sKey, bool & bCDTExist) const; 279 280 /** 281 @brief Erase element from HASH 282 @param sKey - The key of the hash [in] 283 @return true - if key found, false - otherwise 284 */ 285 bool Erase(const STLW::string & sKey); 286 287 /** 288 @brief Check element in hash 289 @param sKey - The key of the hash 290 @return true, if element present, false - otherwise 291 */ 292 bool Exists(const STLW::string & sKey) const; 293 294 /** 295 @brief Check element in array 296 @param iPos - The index of the element 297 @return true, if element present, false - otherwise 298 */ 299 bool Exists(const UINT_32 iPos) const; 300 301 /** 302 @brief Push value into array 303 @param oValue - INT_64 value 304 */ 305 void PushBack(const INT_64 oValue); 306 307 /** 308 @brief Push value into array 309 @param oValue - UINT_64 value 310 */ 311 void PushBack(const UINT_64 oValue); 312 313 /** 314 @brief Push value into array 315 @param oValue - INT_32 value 316 */ 317 void PushBack(const INT_32 oValue); 318 319 /** 320 @brief Push value into array 321 @param oValue - UINT_32 value 322 */ 323 void PushBack(const UINT_32 oValue); 324 325 /** 326 @brief Push value into array 327 @param oValue - W_FLOAT value 328 */ 329 void PushBack(const W_FLOAT oValue); 330 331 /** 332 @brief Push value into array 333 @param oValue - string value 334 */ 335 void PushBack(const STLW::string & oValue); 336 337 /** 338 @brief Push value into array 339 @param oValue - asciz string 340 */ 341 void PushBack(CCHAR_P oValue); 342 343 /** 344 @brief Push value into array 345 @param oValue - CDT object 346 */ 347 void PushBack(const CDT & oValue); 348 349 /** 350 @brief Returns a boolean value telling whether object has a value 351 @return true if object has a value, false - otherwise 352 */ 353 bool Nonzero() const; 354 355 /** 356 @brief Provides range-check access to the data contained in CDT 357 @param iPos - The index of the element 358 @return Read/write reference to data 359 */ 360 CDT & At(const UINT_32 iPos); 361 362 /** 363 @brief Provides range-check access to the data contained in CDT 364 @param sKey - The key of the hash 365 @return Read/write reference to data 366 */ 367 CDT & At(const STLW::string & sKey); 368 369 // Operator + //////////////////////////////////// 370 371 /** 372 @brief Operator + for INT_64 argument 373 @param oValue - value to add 374 @return new CDT object 375 */ 376 CDT operator+(const INT_64 oValue) const; 377 378 /** 379 @brief Operator + for UINT_64 argument 380 @param oValue - value to add 381 @return new CDT object 382 */ 383 CDT operator+(const UINT_64 oValue) const; 384 385 /** 386 @brief Operator + for INT_32 argument 387 @param oValue - value to add 388 @return new CDT object 389 */ 390 CDT operator+(const INT_32 oValue) const; 391 392 /** 393 @brief Operator + for UINT_32 argument 394 @param oValue - value to add 395 @return new CDT object 396 */ 397 CDT operator+(const UINT_32 oValue) const; 398 399 /** 400 @brief Operator + for W_FLOAT argument 401 @param oValue - value to add 402 @return new CDT object 403 */ 404 CDT operator+(const W_FLOAT oValue) const; 405 406 /** 407 @brief Operator + for CDT argument 408 @param oCDT - value to add 409 @return new CDT object 410 */ 411 CDT operator+(const CDT & oCDT) const; 412 413 // Operator - //////////////////////////////////// 414 415 /** 416 @brief Operator - for INT_64 argument 417 @param oValue - value to substract 418 @return new CDT object 419 */ 420 CDT operator-(const INT_64 oValue) const; 421 422 /** 423 @brief Operator - for UINT_64 argument 424 @param oValue - value to substract 425 @return new CDT object 426 */ 427 CDT operator-(const UINT_64 oValue) const; 428 429 /** 430 @brief Operator - for INT_32 argument 431 @param oValue - value to substract 432 @return new CDT object 433 */ 434 CDT operator-(const INT_32 oValue) const; 435 436 /** 437 @brief Operator - for UINT_32 argument 438 @param oValue - value to substract 439 @return new CDT object 440 */ 441 CDT operator-(const UINT_32 oValue) const; 442 443 /** 444 @brief Operator - for W_FLOAT argument 445 @param oValue - value to substract 446 @return new CDT object 447 */ 448 CDT operator-(const W_FLOAT oValue) const; 449 450 /** 451 @brief Operator - for CDT argument 452 @param oCDT - value to substract 453 @return new CDT object 454 */ 455 CDT operator-(const CDT & oCDT) const; 456 457 // Operator * //////////////////////////////////// 458 459 /** 460 @brief Operator * for INT_64 argument 461 @param oValue - value to multiplicate 462 @return new CDT object 463 */ 464 CDT operator*(const INT_64 oValue) const; 465 466 /** 467 @brief Operator * for UINT_64 argument 468 @param oValue - value to multiplicate 469 @return new CDT object 470 */ 471 CDT operator*(const UINT_64 oValue) const; 472 473 /** 474 @brief Operator * for INT_32 argument 475 @param oValue - value to multiplicate 476 @return new CDT object 477 */ 478 CDT operator*(const INT_32 oValue) const; 479 480 /** 481 @brief Operator * for UINT_32 argument 482 @param oValue - value to multiplicate 483 @return new CDT object 484 */ 485 CDT operator*(const UINT_32 oValue) const; 486 487 /** 488 @brief Operator * for W_FLOAT argument 489 @param oValue - value to multiplicate 490 @return new CDT object 491 */ 492 CDT operator*(const W_FLOAT oValue) const; 493 494 /** 495 @brief Operator * for CDT argument 496 @param oCDT - value to multiplicate 497 @return new CDT object 498 */ 499 CDT operator*(const CDT & oCDT) const; 500 501 // Operator / //////////////////////////////////// 502 503 /** 504 @brief Operator / for INT_64 argument 505 @param oValue - value to divide 506 @return new CDT object 507 */ 508 CDT operator/(const INT_64 oValue) const; 509 510 /** 511 @brief Operator / for UINT_64 argument 512 @param oValue - value to divide 513 @return new CDT object 514 */ 515 CDT operator/(const UINT_64 oValue) const; 516 517 /** 518 @brief Operator / for INT_32 argument 519 @param oValue - value to divide 520 @return new CDT object 521 */ 522 CDT operator/(const INT_32 oValue) const; 523 524 /** 525 @brief Operator / for UINT_32 argument 526 @param oValue - value to divide 527 @return new CDT object 528 */ 529 CDT operator/(const UINT_32 oValue) const; 530 531 /** 532 @brief Operator / for W_FLOAT argument 533 @param oValue - value to divide 534 @return new CDT object 535 */ 536 CDT operator/(const W_FLOAT oValue) const; 537 538 /** 539 @brief Operator / for CDT argument 540 @param oCDT - value to divide 541 @return new CDT object 542 */ 543 CDT operator/(const CDT & oCDT) const; 544 545 // /////////////////////////////////////////////// 546 547 // Operator += /////////////////////////////////// 548 549 /** 550 @brief Operator += for INT_64 argument 551 @param oValue - value to add 552 @return Read/write reference to self 553 */ 554 CDT & operator+=(const INT_64 oValue); 555 556 /** 557 @brief Operator += for UINT_64 argument 558 @param oValue - value to add 559 @return Read/write reference to self 560 */ 561 CDT & operator+=(const UINT_64 oValue); 562 563 /** 564 @brief Operator += for INT_32 argument 565 @param oValue - value to add 566 @return Read/write reference to self 567 */ 568 CDT & operator+=(const INT_32 oValue); 569 570 /** 571 @brief Operator += for UINT_32 argument 572 @param oValue - value to divide 573 @return Read/write reference to self 574 */ 575 CDT & operator+=(const UINT_32 oValue); 576 577 /** 578 @brief Operator += for W_FLOAT argument 579 @param oValue - value to add 580 @return Read/write reference to self 581 */ 582 CDT & operator+=(const W_FLOAT oValue); 583 584 /** 585 @brief Operator += for CDT argument 586 @param oCDT - value to add 587 @return Read/write reference to self 588 */ 589 CDT & operator+=(const CDT & oCDT); 590 591 // Operator -= /////////////////////////////////// 592 593 /** 594 @brief Operator -= for INT_64 argument 595 @param oValue - value to substract 596 @return Read/write reference to self 597 */ 598 CDT & operator-=(const INT_64 oValue); 599 600 /** 601 @brief Operator -= for UINT_64 argument 602 @param oValue - value to substract 603 @return Read/write reference to self 604 */ 605 CDT & operator-=(const UINT_64 oValue); 606 607 /** 608 @brief Operator -= for INT_32 argument 609 @param oValue - value to substract 610 @return Read/write reference to self 611 */ 612 CDT & operator-=(const INT_32 oValue); 613 614 /** 615 @brief Operator -= for UINT_32 argument 616 @param oValue - value to substract 617 @return Read/write reference to self 618 */ 619 CDT & operator-=(const UINT_32 oValue); 620 621 /** 622 @brief Operator -= for W_FLOAT argument 623 @param oValue - value to substract 624 @return Read/write reference to self 625 */ 626 CDT & operator-=(const W_FLOAT oValue); 627 628 /** 629 @brief Operator -= for string argument 630 @param oCDT - value to substract 631 @return Read/write reference to self 632 */ 633 CDT & operator-=(const CDT & oCDT); 634 635 // Operator *= /////////////////////////////////// 636 637 /** 638 @brief Operator *= for INT_64 argument 639 @param oValue - value to multiplication 640 @return Read/write reference to self 641 */ 642 CDT & operator*=(const INT_64 oValue); 643 644 /** 645 @brief Operator *= for UINT_64 argument 646 @param oValue - value to multiplication 647 @return Read/write reference to self 648 */ 649 CDT & operator*=(const UINT_64 oValue); 650 651 /** 652 @brief Operator *= for INT_32 argument 653 @param oValue - value to multiplication 654 @return Read/write reference to self 655 */ 656 CDT & operator*=(const INT_32 oValue); 657 658 /** 659 @brief Operator *= for UINT_32 argument 660 @param oValue - value to multiplication 661 @return Read/write reference to self 662 */ 663 CDT & operator*=(const UINT_32 oValue); 664 665 /** 666 @brief Operator *= for W_FLOAT argument 667 @param oValue - value to multiplication 668 @return Read/write reference to self 669 */ 670 CDT & operator*=(const W_FLOAT oValue); 671 672 /** 673 @brief Operator *= for CDT argument 674 @param oCDT - value to multiplication 675 @return Read/write reference to self 676 */ 677 CDT & operator*=(const CDT & oCDT); 678 679 // Operator /= /////////////////////////////////// 680 681 /** 682 @brief Operator /= for INT_64 argument 683 @param oValue - value to division 684 @return Read/write reference to self 685 */ 686 CDT & operator/=(const INT_64 oValue); 687 688 /** 689 @brief Operator /= for UINT_64 argument 690 @param oValue - value to division 691 @return Read/write reference to self 692 */ 693 CDT & operator/=(const UINT_64 oValue); 694 695 /** 696 @brief Operator /= for INT_32 argument 697 @param oValue - value to division 698 @return Read/write reference to self 699 */ 700 CDT & operator/=(const INT_32 oValue); 701 702 /** 703 @brief Operator /= for UINT_32 argument 704 @param oValue - value to division 705 @return Read/write reference to self 706 */ 707 CDT & operator/=(const UINT_32 oValue); 708 709 /** 710 @brief Operator /= for W_FLOAT argument 711 @param oValue - value to division 712 @return Read/write reference to self 713 */ 714 CDT & operator/=(const W_FLOAT oValue); 715 716 /** 717 @brief Operator /= for CDT argument 718 @param oCDT - value to division 719 @return Read/write reference to self 720 */ 721 CDT & operator/=(const CDT & oCDT); 722 723 // /////////////////////////////////////////////// 724 725 // Operator == /////////////////////////////////// 726 727 /** 728 @brief Comparison operator == for CDT argument 729 @param oValue - value to compare 730 @return true if values are equal 731 */ 732 bool operator==(const INT_64 oValue) const; 733 734 /** 735 @brief Comparison operator == for CDT argument 736 @param oValue - value to compare 737 @return true if values are equal 738 */ 739 bool operator==(const UINT_64 oValue) const; 740 741 /** 742 @brief Comparison operator == for CDT argument 743 @param oValue - value to compare 744 @return true if values are equal 745 */ 746 bool operator==(const INT_32 oValue) const; 747 748 /** 749 @brief Comparison operator == for CDT argument 750 @param oValue - value to compare 751 @return true if values are equal 752 */ 753 bool operator==(const UINT_32 oValue) const; 754 755 /** 756 @brief Comparison operator == for CDT argument 757 @param oValue - value to compare 758 @return true if values are equal 759 */ 760 bool operator==(const W_FLOAT oValue) const; 761 762 /** 763 @brief Comparison operator == for old-fashion string argument 764 @param oValue - value to compare 765 @return true if values are equal 766 */ 767 bool operator==(CCHAR_P oValue) const; 768 769 /** 770 @brief Comparison operator == for string argument 771 @param oValue - value to compare 772 @return true if values are equal 773 */ 774 bool operator==(const STLW::string & oValue) const; 775 776 /** 777 @brief Comparison operator == for CDT argument 778 @param oCDT - value to compare 779 @return true if values are equal 780 */ 781 bool operator==(const CDT & oCDT) const; 782 783 // Operator != /////////////////////////////////// 784 785 /** 786 @brief Comparison operator != for CDT argument 787 @param oValue - value to compare 788 @return true if values are not equal 789 */ 790 bool operator!=(const INT_64 oValue) const; 791 792 /** 793 @brief Comparison operator != for CDT argument 794 @param oValue - value to compare 795 @return true if values are not equal 796 */ 797 bool operator!=(const UINT_64 oValue) const; 798 799 /** 800 @brief Comparison operator != for CDT argument 801 @param oValue - value to compare 802 @return true if values are not equal 803 */ 804 bool operator!=(const INT_32 oValue) const; 805 806 /** 807 @brief Comparison operator != for CDT argument 808 @param oValue - value to compare 809 @return true if values are not equal 810 */ 811 bool operator!=(const UINT_32 oValue) const; 812 813 /** 814 @brief Comparison operator != for CDT argument 815 @param oValue - value to compare 816 @return true if values are not equal 817 */ 818 bool operator!=(const W_FLOAT oValue) const; 819 820 /** 821 @brief Comparison operator != for old-fashion string argument 822 @param oValue - value to compare 823 @return true if values are not equal 824 */ 825 bool operator!=(CCHAR_P oValue) const; 826 827 /** 828 @brief Comparison operator != for string argument 829 @param oValue - value to compare 830 @return true if values are not equal 831 */ 832 bool operator!=(const STLW::string & oValue) const; 833 834 /** 835 @brief Comparison operator != for CDT argument 836 @param oCDT - value to compare 837 @return true if values are not equal 838 */ 839 bool operator!=(const CDT & oCDT) const; 840 // /////////////////////////////////////////////// 841 842 // Operator > /////////////////////////////////// 843 844 /** 845 @brief Comparison operator > for CDT argument 846 @param oValue - value to compare 847 @return true if CDT is greater than value 848 */ 849 bool operator>(const INT_64 oValue) const; 850 851 /** 852 @brief Comparison operator > for CDT argument 853 @param oValue - value to compare 854 @return true if CDT is greater than value 855 */ 856 bool operator>(const UINT_64 oValue) const; 857 858 /** 859 @brief Comparison operator > for CDT argument 860 @param oValue - value to compare 861 @return true if CDT is greater than value 862 */ 863 bool operator>(const INT_32 oValue) const; 864 865 /** 866 @brief Comparison operator > for CDT argument 867 @param oValue - value to compare 868 @return true if CDT is greater than value 869 */ 870 bool operator>(const UINT_32 oValue) const; 871 872 /** 873 @brief Comparison operator > for CDT argument 874 @param oValue - value to compare 875 @return true if CDT is greater than value 876 */ 877 bool operator>(const W_FLOAT oValue) const; 878 879 /** 880 @brief Comparison operator > for old-fashion string argument 881 @param oValue - value to compare 882 @return true if CDT is greater than value 883 */ 884 bool operator>(CCHAR_P oValue) const; 885 886 /** 887 @brief Comparison operator > for string argument 888 @param oValue - value to compare 889 @return true if CDT is greater than value 890 */ 891 bool operator>(const STLW::string & oValue) const; 892 893 /** 894 @brief Comparison operator > for CDT argument 895 @param oCDT - value to compare 896 @return true if CDT is greater than value 897 */ 898 bool operator>(const CDT & oCDT) const; 899 900 // Operator < /////////////////////////////////// 901 902 /** 903 @brief Comparison operator < for CDT argument 904 @param oValue - value to compare 905 @return true if CDT is lesser than value 906 */ 907 bool operator<(const INT_64 oValue) const; 908 909 /** 910 @brief Comparison operator < for CDT argument 911 @param oValue - value to compare 912 @return true if CDT is lesser than value 913 */ 914 bool operator<(const UINT_64 oValue) const; 915 916 /** 917 @brief Comparison operator < for CDT argument 918 @param oValue - value to compare 919 @return true if CDT is lesser than value 920 */ 921 bool operator<(const INT_32 oValue) const; 922 923 /** 924 @brief Comparison operator < for CDT argument 925 @param oValue - value to compare 926 @return true if CDT is lesser than value 927 */ 928 bool operator<(const UINT_32 oValue) const; 929 930 /** 931 @brief Comparison operator < for CDT argument 932 @param oValue - value to compare 933 @return true if CDT is lesser than value 934 */ 935 bool operator<(const W_FLOAT oValue) const; 936 937 /** 938 @brief Comparison operator < for old-fashion string argument 939 @param oValue - value to compare 940 @return true if CDT is lesser than value 941 */ 942 bool operator<(CCHAR_P oValue) const; 943 944 /** 945 @brief Comparison operator < for string argument 946 @param oValue - value to compare 947 @return true if CDT is lesser than value 948 */ 949 bool operator<(const STLW::string & oValue) const; 950 951 /** 952 @brief Comparison operator < for CDT argument 953 @param oCDT - value to compare 954 @return true if CDT is lesser than value 955 */ 956 bool operator<(const CDT & oCDT) const; 957 958 // Operator >= /////////////////////////////////// 959 960 /** 961 @brief Comparison operator >= for CDT argument 962 @param oValue - value to compare 963 @return true if CDT is greater or equal than value 964 */ 965 bool operator>=(const INT_64 oValue) const; 966 967 /** 968 @brief Comparison operator >= for CDT argument 969 @param oValue - value to compare 970 @return true if CDT is greater or equal than value 971 */ 972 bool operator>=(const UINT_64 oValue) const; 973 974 /** 975 @brief Comparison operator >= for CDT argument 976 @param oValue - value to compare 977 @return true if CDT is greater or equal than value 978 */ 979 bool operator>=(const INT_32 oValue) const; 980 981 /** 982 @brief Comparison operator >= for CDT argument 983 @param oValue - value to compare 984 @return true if CDT is greater or equal than value 985 */ 986 bool operator>=(const UINT_32 oValue) const; 987 988 /** 989 @brief Comparison operator >= for CDT argument 990 @param oValue - value to compare 991 @return true if CDT is greater or equal than value 992 */ 993 bool operator>=(const W_FLOAT oValue) const; 994 995 /** 996 @brief Comparison operator >= for old-fashion string argument 997 @param oValue - value to compare 998 @return true if CDT is greater or equal than value 999 */ 1000 bool operator>=(CCHAR_P oValue) const; 1001 1002 /** 1003 @brief Comparison operator >= for string argument 1004 @param oValue - value to compare 1005 @return true if CDT is greater or equal than value 1006 */ 1007 bool operator>=(const STLW::string & oValue) const; 1008 1009 /** 1010 @brief Comparison operator >= for CDT argument 1011 @param oCDT - value to compare 1012 @return true if CDT is greater or equal than value 1013 */ 1014 bool operator>=(const CDT & oCDT) const; 1015 1016 // Operator <= /////////////////////////////////// 1017 1018 /** 1019 @brief Comparison operator <= for CDT argument 1020 @param oValue - value to compare 1021 @return true if CDT is greater or equal than value 1022 */ 1023 bool operator<=(const INT_64 oValue) const; 1024 1025 /** 1026 @brief Comparison operator <= for CDT argument 1027 @param oValue - value to compare 1028 @return true if CDT is greater or equal than value 1029 */ 1030 bool operator<=(const UINT_64 oValue) const; 1031 1032 /** 1033 @brief Comparison operator <= for CDT argument 1034 @param oValue - value to compare 1035 @return true if CDT is greater or equal than value 1036 */ 1037 bool operator<=(const INT_32 oValue) const; 1038 1039 /** 1040 @brief Comparison operator <= for CDT argument 1041 @param oValue - value to compare 1042 @return true if CDT is greater or equal than value 1043 */ 1044 bool operator<=(const UINT_32 oValue) const; 1045 1046 /** 1047 @brief Comparison operator <= for CDT argument 1048 @param oValue - value to compare 1049 @return true if CDT is greater or equal than value 1050 */ 1051 bool operator<=(const W_FLOAT oValue) const; 1052 1053 /** 1054 @brief Comparison operator <= for old-fashion string argument 1055 @param oValue - value to compare 1056 @return true if CDT is greater or equal than value 1057 */ 1058 bool operator<=(CCHAR_P oValue) const; 1059 1060 /** 1061 @brief Comparison operator <= for string argument 1062 @param oValue - value to compare 1063 @return true if CDT is greater or equal than value 1064 */ 1065 bool operator<=(const STLW::string & oValue) const; 1066 1067 /** 1068 @brief Comparison operator <= for CDT argument 1069 @param oCDT - value to compare 1070 @return true if CDT is greater or equal than value 1071 */ 1072 bool operator<=(const CDT & oCDT) const; 1073 1074 // Comparator Equal /////////////////////////////////// 1075 1076 /** 1077 @brief Comparator Equal for CDT argument 1078 @param oValue - value to compare 1079 @return true if values are equal 1080 */ 1081 bool Equal(const INT_64 oValue) const; 1082 1083 /** 1084 @brief Comparator Equal for CDT argument 1085 @param oValue - value to compare 1086 @return true if values are equal 1087 */ 1088 bool Equal(const UINT_64 oValue) const; 1089 1090 /** 1091 @brief Comparator Equal for CDT argument 1092 @param oValue - value to compare 1093 @return true if values are equal 1094 */ 1095 bool Equal(const INT_32 oValue) const; 1096 1097 /** 1098 @brief Comparator Equal for CDT argument 1099 @param oValue - value to compare 1100 @return true if values are equal 1101 */ 1102 bool Equal(const UINT_32 oValue) const; 1103 1104 /** 1105 @brief Comparator Equal for CDT argument 1106 @param oValue - value to compare 1107 @return true if values are equal 1108 */ 1109 bool Equal(const W_FLOAT oValue) const; 1110 1111 /** 1112 @brief Comparator Equal for old-fashion string argument 1113 @param oValue - value to compare 1114 @return true if values are equal 1115 */ 1116 bool Equal(CCHAR_P oValue) const; 1117 1118 /** 1119 @brief Comparator Equal for string argument 1120 @param oValue - value to compare 1121 @return true if values are equal 1122 */ 1123 bool Equal(const STLW::string & oValue) const; 1124 1125 /** 1126 @brief Comparator Equal for CDT argument 1127 @param oCDT - value to compare 1128 @return true if values are equal 1129 */ 1130 bool Equal(const CDT & oCDT) const; 1131 1132 // Comparator NotEqual /////////////////////////////////// 1133 1134 /** 1135 @brief Comparator NotEqual for CDT argument 1136 @param oValue - value to compare 1137 @return true if values are not equal 1138 */ 1139 bool NotEqual(const INT_64 oValue) const; 1140 1141 /** 1142 @brief Comparator NotEqual for CDT argument 1143 @param oValue - value to compare 1144 @return true if values are not equal 1145 */ 1146 bool NotEqual(const UINT_64 oValue) const; 1147 1148 /** 1149 @brief Comparator NotEqual for CDT argument 1150 @param oValue - value to compare 1151 @return true if values are not equal 1152 */ 1153 bool NotEqual(const INT_32 oValue) const; 1154 1155 /** 1156 @brief Comparator NotEqual for CDT argument 1157 @param oValue - value to compare 1158 @return true if values are not equal 1159 */ 1160 bool NotEqual(const UINT_32 oValue) const; 1161 1162 /** 1163 @brief Comparator NotEqual for CDT argument 1164 @param oValue - value to compare 1165 @return true if values are not equal 1166 */ 1167 bool NotEqual(const W_FLOAT oValue) const; 1168 1169 /** 1170 @brief Comparator NotEqual for old-fashion string argument 1171 @param oValue - value to compare 1172 @return true if values are not equal 1173 */ 1174 bool NotEqual(CCHAR_P oValue) const; 1175 1176 /** 1177 @brief Comparator NotEqual for string argument 1178 @param oValue - value to compare 1179 @return true if values are not equal 1180 */ 1181 bool NotEqual(const STLW::string & oValue) const; 1182 1183 /** 1184 @brief Comparator NotEqual for CDT argument 1185 @param oCDT - value to compare 1186 @return true if values are not equal 1187 */ 1188 bool NotEqual(const CDT & oCDT) const; 1189 1190 // Comparator Greater /////////////////////////////////// 1191 1192 /** 1193 @brief Comparator Greater for CDT argument 1194 @param oValue - value to compare 1195 @return true if CDT is greater than value 1196 */ 1197 bool Greater(const INT_64 oValue) const; 1198 1199 /** 1200 @brief Comparator Greater for CDT argument 1201 @param oValue - value to compare 1202 @return true if CDT is greater than value 1203 */ 1204 bool Greater(const UINT_64 oValue) const; 1205 1206 /** 1207 @brief Comparator Greater for CDT argument 1208 @param oValue - value to compare 1209 @return true if CDT is greater than value 1210 */ 1211 bool Greater(const INT_32 oValue) const; 1212 1213 /** 1214 @brief Comparator Greater for CDT argument 1215 @param oValue - value to compare 1216 @return true if CDT is greater than value 1217 */ 1218 bool Greater(const UINT_32 oValue) const; 1219 1220 /** 1221 @brief Comparator Greater for CDT argument 1222 @param oValue - value to compare 1223 @return true if CDT is greater than value 1224 */ 1225 bool Greater(const W_FLOAT oValue) const; 1226 1227 /** 1228 @brief Comparator Greater for old-fashion string argument 1229 @param oValue - value to compare 1230 @return true if CDT is greater than value 1231 */ 1232 bool Greater(CCHAR_P oValue) const; 1233 1234 /** 1235 @brief Comparator Greater for string argument 1236 @param oValue - value to compare 1237 @return true if CDT is greater than value 1238 */ 1239 bool Greater(const STLW::string & oValue) const; 1240 1241 /** 1242 @brief Comparator Greater for CDT argument 1243 @param oCDT - value to compare 1244 @return true if CDT is greater than value 1245 */ 1246 bool Greater(const CDT & oCDT) const; 1247 1248 // Comparator Less /////////////////////////////////// 1249 1250 /** 1251 @brief Comparator Less for CDT argument 1252 @param oValue - value to compare 1253 @return true if CDT is lesser than value 1254 */ 1255 bool Less(const INT_64 oValue) const; 1256 1257 /** 1258 @brief Comparator Less for CDT argument 1259 @param oValue - value to compare 1260 @return true if CDT is lesser than value 1261 */ 1262 bool Less(const UINT_64 oValue) const; 1263 1264 /** 1265 @brief Comparator Less for CDT argument 1266 @param oValue - value to compare 1267 @return true if CDT is lesser than value 1268 */ 1269 bool Less(const INT_32 oValue) const; 1270 1271 /** 1272 @brief Comparator Less for CDT argument 1273 @param oValue - value to compare 1274 @return true if CDT is lesser than value 1275 */ 1276 bool Less(const UINT_32 oValue) const; 1277 1278 /** 1279 @brief Comparator Less for CDT argument 1280 @param oValue - value to compare 1281 @return true if CDT is lesser than value 1282 */ 1283 bool Less(const W_FLOAT oValue) const; 1284 1285 /** 1286 @brief Comparator Less for string argument 1287 @param oValue - value to compare 1288 @return true if CDT is lesser than value 1289 */ 1290 bool Less(CCHAR_P oValue) const; 1291 1292 /** 1293 @brief Comparator Less for string argument 1294 @param oValue - value to compare 1295 @return true if CDT is lesser than value 1296 */ 1297 bool Less(const STLW::string & oValue) const; 1298 1299 /** 1300 @brief Comparator Less for CDT argument 1301 @param oCDT - value to compare 1302 @return true if CDT is lesser than value 1303 */ 1304 bool Less(const CDT & oCDT) const; 1305 1306 // Comparator GreaterOrEqual /////////////////////////////////// 1307 1308 /** 1309 @brief Comparator GreaterOrEqual for CDT argument 1310 @param oValue - value to compare 1311 @return true if CDT is greater or equal than value 1312 */ 1313 bool GreaterOrEqual(const INT_64 oValue) const; 1314 1315 /** 1316 @brief Comparator GreaterOrEqual for CDT argument 1317 @param oValue - value to compare 1318 @return true if CDT is greater or equal than value 1319 */ 1320 bool GreaterOrEqual(const UINT_64 oValue) const; 1321 1322 /** 1323 @brief Comparator GreaterOrEqual for CDT argument 1324 @param oValue - value to compare 1325 @return true if CDT is greater or equal than value 1326 */ 1327 bool GreaterOrEqual(const INT_32 oValue) const; 1328 1329 /** 1330 @brief Comparator GreaterOrEqual for CDT argument 1331 @param oValue - value to compare 1332 @return true if CDT is greater or equal than value 1333 */ 1334 bool GreaterOrEqual(const UINT_32 oValue) const; 1335 1336 /** 1337 @brief Comparator GreaterOrEqual for CDT argument 1338 @param oValue - value to compare 1339 @return true if CDT is greater or equal than value 1340 */ 1341 bool GreaterOrEqual(const W_FLOAT oValue) const; 1342 1343 /** 1344 @brief Comparator GreaterOrEqual for old-fashion string argument 1345 @param oValue - value to compare 1346 @return true if CDT is greater or equal than value 1347 */ 1348 bool GreaterOrEqual(CCHAR_P oValue) const; 1349 1350 /** 1351 @brief Comparator GreaterOrEqual for string argument 1352 @param oValue - value to compare 1353 @return true if CDT is greater or equal than value 1354 */ 1355 bool GreaterOrEqual(const STLW::string & oValue) const; 1356 1357 /** 1358 @brief Comparator GreaterOrEqual for CDT argument 1359 @param oCDT - value to compare 1360 @return true if CDT is greater or equal than value 1361 */ 1362 bool GreaterOrEqual(const CDT & oCDT) const; 1363 1364 // Comparator LessOrEqual /////////////////////////////////// 1365 1366 /** 1367 @brief Comparator LessOrEqual for CDT argument 1368 @param oValue - value to compare 1369 @return true if CDT is greater or equal than value 1370 */ 1371 bool LessOrEqual(const INT_64 oValue) const; 1372 1373 /** 1374 @brief Comparator LessOrEqual for CDT argument 1375 @param oValue - value to compare 1376 @return true if CDT is greater or equal than value 1377 */ 1378 bool LessOrEqual(const UINT_64 oValue) const; 1379 1380 /** 1381 @brief Comparator LessOrEqual for CDT argument 1382 @param oValue - value to compare 1383 @return true if CDT is greater or equal than value 1384 */ 1385 bool LessOrEqual(const INT_32 oValue) const; 1386 1387 /** 1388 @brief Comparator LessOrEqual for CDT argument 1389 @param oValue - value to compare 1390 @return true if CDT is greater or equal than value 1391 */ 1392 bool LessOrEqual(const UINT_32 oValue) const; 1393 1394 /** 1395 @brief Comparator LessOrEqual for CDT argument 1396 @param oValue - value to compare 1397 @return true if CDT is greater or equal than value 1398 */ 1399 bool LessOrEqual(const W_FLOAT oValue) const; 1400 1401 /** 1402 @brief Comparator LessOrEqual for old-fashion string argument 1403 @param oValue - value to compare 1404 @return true if CDT is greater or equal than value 1405 */ 1406 bool LessOrEqual(CCHAR_P oValue) const; 1407 1408 /** 1409 @brief Comparator LessOrEqual for string argument 1410 @param oValue - value to compare 1411 @return true if CDT is greater or equal than value 1412 */ 1413 bool LessOrEqual(const STLW::string & oValue) const; 1414 1415 /** 1416 @brief Comparator LessOrEqual for CDT argument 1417 @param oCDT - value to compare 1418 @return true if CDT is greater or equal than value 1419 */ 1420 bool LessOrEqual(const CDT & oCDT) const; 1421 1422 // /////////////////////////////////////////////// 1423 1424 /** 1425 @brief Pre-increment operator ++ 1426 @return Read/write reference to self 1427 */ 1428 CDT & operator++(); 1429 1430 /** 1431 @brief Post-increment operator ++ 1432 @return Read/write reference to self 1433 */ 1434 CDT operator++(int); 1435 1436 /** 1437 @brief Pre-decrement operator -- 1438 @return Read/write reference to self 1439 */ 1440 CDT & operator--(); 1441 1442 /** 1443 @brief Post-decrement operator -- 1444 @return Read/write reference to self 1445 */ 1446 CDT operator--(int); 1447 1448 /** 1449 @brief Append a string to CDT 1450 @see Append(const STLW::string & oValue) 1451 @param oValue - string to append 1452 @return read/write referense to self 1453 */ 1454 CDT & Concat(const STLW::string & oValue); 1455 1456 /** 1457 @brief Append a old-fashion string to CDT 1458 @see Append(CCHAR_P * szData, const INT_32 & iDataLength) 1459 @param szData - string to append 1460 @param iDataLength - string length 1461 @return read/write referense to self 1462 */ 1463 CDT & Concat(CCHAR_P szData, const INT_32 iDataLength = -1); 1464 1465 /** 1466 @brief Append a string to CDT, alias for Concat 1467 @see Concat(const STLW::string & oValue) 1468 @param oValue - string to append 1469 @return read/write referense to self 1470 */ 1471 CDT & Append(const STLW::string & oValue); 1472 1473 /** 1474 @brief Append a old-fashion string to CDT 1475 @see Concat(CCHAR_P * szData, const INT_32 & iDataLength) 1476 @param szData - string to append 1477 @param iDataLength - string length 1478 @return read/write referense to self 1479 */ 1480 CDT & Append(CCHAR_P szData, const INT_32 iDataLength = -1); 1481 1482 /** 1483 @brief Append a INT_64 to CDT 1484 @param szData - string to append 1485 @param iDataLength - string length 1486 @return read/write referense to self 1487 */ 1488 CDT & Append(const INT_64 oValue); 1489 1490 /** 1491 @brief Append a INT_64 to CDT 1492 @param szData - string to append 1493 @param iDataLength - string length 1494 @return read/write referense to self 1495 */ 1496 CDT & Append(const UINT_64 oValue); 1497 1498 /** 1499 @brief Append a INT_32 to CDT 1500 @param szData - string to append 1501 @param iDataLength - string length 1502 @return read/write referense to self 1503 */ 1504 CDT & Append(const INT_32 oValue); 1505 1506 /** 1507 @brief Append a UINT_32 to CDT 1508 @param szData - string to append 1509 @param iDataLength - string length 1510 @return read/write referense to self 1511 */ 1512 CDT & Append(const UINT_32 oValue); 1513 1514 /** 1515 @brief Append a W_FLOAT to CDT 1516 @param szData - string to append 1517 @param iDataLength - string length 1518 @return read/write referense to self 1519 */ 1520 CDT & Append(const W_FLOAT oValue); 1521 1522 /** 1523 @brief Append a string to CDT, alias for Concat 1524 @see Concat(const STLW::string & oValue) 1525 @param oValue - string to append 1526 @return read/write referense to self 1527 */ 1528 CDT & Append(const CDT & oCDT); 1529 1530 /** 1531 @brief Prepend a string to CDT, alias for Concat 1532 @see Concat(const STLW::string & oValue) 1533 @param oValue - string to append 1534 @return read/write referense to self 1535 */ 1536 CDT & Prepend(const STLW::string & oValue); 1537 1538 /** 1539 @brief Prepend a old-fashion string to CDT 1540 @param szData - string to append 1541 @param iDataLength - string length 1542 @return read/write referense to self 1543 */ 1544 CDT & Prepend(CCHAR_P szData, const INT_32 iDataLength = -1); 1545 1546 /** 1547 @brief Prepend a INT_64 to CDT 1548 @param szData - string to append 1549 @param iDataLength - string length 1550 @return read/write referense to self 1551 */ 1552 CDT & Prepend(const INT_64 oValue); 1553 1554 /** 1555 @brief Prepend a INT_64 to CDT 1556 @param szData - string to append 1557 @param iDataLength - string length 1558 @return read/write referense to self 1559 */ 1560 CDT & Prepend(const UINT_64 oValue); 1561 1562 /** 1563 @brief Prepend a INT_32 to CDT 1564 @param szData - string to append 1565 @param iDataLength - string length 1566 @return read/write referense to self 1567 */ 1568 CDT & Prepend(const INT_32 oValue); 1569 1570 /** 1571 @brief Prepend a UINT_32 to CDT 1572 @param szData - string to append 1573 @param iDataLength - string length 1574 @return read/write referense to self 1575 */ 1576 CDT & Prepend(const UINT_32 oValue); 1577 1578 /** 1579 @brief Prepend a W_FLOAT to CDT 1580 @param szData - string to append 1581 @param iDataLength - string length 1582 @return read/write referense to self 1583 */ 1584 CDT & Prepend(const W_FLOAT oValue); 1585 1586 /** 1587 @brief Prepend a string to CDT 1588 @see Concat(const STLW::string & oValue) 1589 @param oValue - string to append 1590 @return read/write referense to self 1591 */ 1592 CDT & Prepend(const CDT & oCDT); 1593 1594 /** 1595 @brief Get value as W_FLOAT 1596 */ 1597 W_FLOAT GetFloat() const; 1598 1599 /** 1600 @brief Get value as INT_64 1601 */ 1602 INT_64 GetInt() const; 1603 1604 /** 1605 @brief Get value as UINT_64 1606 */ 1607 UINT_64 GetUInt() const; 1608 1609 /** 1610 @brief Get value as STLW::string 1611 @param szFormat - output format 1612 @return String object representation 1613 */ 1614 STLW::string GetString(CCHAR_P szFormat = "") const; 1615 1616 /** 1617 @brief Cast value to W_FLOAT 1618 */ 1619 W_FLOAT ToFloat(); 1620 1621 /** 1622 @brief Cast value to INT_64 1623 */ 1624 INT_64 ToInt(); 1625 1626 /** 1627 @brief Cast value to STLW::string 1628 @param szFormat - output format 1629 @return String object representation 1630 */ 1631 STLW::string ToString(CCHAR_P szFormat = ""); 1632 1633 /** 1634 @brief Get generic pointer 1635 @return generic pointer 1636 */ 1637 const void * GetPointer() const; 1638 1639 /** 1640 @brief Get object 1641 @return pointer to specified type 1642 */ GetObject() const1643 template<typename T> const T * GetObject() const { return (T*)GetPointer(); } 1644 1645 /** 1646 @brief Get generic pointer 1647 @return generic pointer 1648 */ 1649 void * GetPointer(); 1650 1651 /** 1652 @brief Get object 1653 @return pointer to specified type 1654 */ GetObject()1655 template<typename T> T * GetObject() { return (T*)GetPointer(); } 1656 1657 /** 1658 @brief Recursively dump CDT into string 1659 @param iLevel - left margin 1660 @param bGlobalFmt - use global object formatting 1661 @return printable string 1662 */ 1663 STLW::string Dump(UINT_32 iLevel = 0, bool bGlobalFmt = false) const; 1664 1665 /** 1666 @brief Alias for RecursiveDump, deprecated 1667 @param iLevel - left margin 1668 @return printable string 1669 */ 1670 STLW::string RecursiveDump(UINT_32 iLevel = 0) const; 1671 1672 /** 1673 @brief Get value type of object 1674 */ 1675 eValType GetType() const; 1676 1677 /** 1678 @brief Get printable value type of object 1679 @return printable name of data type 1680 */ 1681 CCHAR_P PrintableType() const; 1682 1683 /** 1684 @brief Get printable value type 1685 @return printable name of data type 1686 */ 1687 static CCHAR_P PrintableType(eValType eType); 1688 1689 /** 1690 @brief Get array of hash size 1691 @return Size of array 1692 */ 1693 UINT_32 Size() const; 1694 1695 /** 1696 @brief Swap values 1697 @param oCDT - value to swap 1698 @return Reference to self 1699 */ 1700 CDT & Swap(CDT & oCDT); 1701 1702 /** 1703 @brief Join array elements to string 1704 @brief sDelimiter - delimiter between elements 1705 @return string as result of join array values 1706 */ 1707 STLW::string JoinArrayElements(const STLW::string & sDelimiter = "") const; 1708 1709 /** 1710 @brief Join hash keys 1711 @brief sDelimiter - delimiter between keys 1712 @return string as result of join hash keys 1713 */ 1714 STLW::string JoinHashKeys(const STLW::string & sDelimiter = "") const; 1715 1716 /** 1717 @brief Join hash values 1718 @brief sDelimiter - delimiter between keys 1719 @return string as result of join hash values 1720 */ 1721 STLW::string JoinHashValues(const STLW::string & sDelimiter = "") const; 1722 1723 /** 1724 @brief Get hash keys 1725 @return CDT with ARRAY type with hash keys 1726 */ 1727 CDT GetHashKeys() const; 1728 1729 /** 1730 @brief Get hash values 1731 @return CDT with ARRAY type with hash values 1732 */ 1733 CDT GetHashValues() const; 1734 1735 /** 1736 @brief Merge two CDT's 1737 @param oSource - source object 1738 @param eStrategy - Merging strategy 1739 */ 1740 void MergeCDT(const CDT & oSource, const eMergeStrategy & eStrategy = FAST_MERGE); 1741 1742 /** 1743 @brief Quick sort ARRAY 1744 @param oSortingComparator - variables comparator 1745 */ 1746 void SortArray(const SortingComparator & oSortingComparator); 1747 1748 /** 1749 @class SortingComparator CDT.hpp <CDT.hpp> 1750 @brief Sorting comparator 1751 */ 1752 class CTPP2DECL SortingComparator 1753 { 1754 public: 1755 /** 1756 @brief Sorting direction 1757 */ 1758 enum eSortingDirection { ASC, DESC }; 1759 1760 /** 1761 @brief Compare two values. 1762 @param oX - first value to compare 1763 @param oY - seond value to compare 1764 @return 0 - if equel, -1 - if oX < oY, 1 - if ox > oY 1765 */ 1766 virtual bool operator()(const CDT & oX, const CDT & oY) const = 0; 1767 1768 /** 1769 @brief A dertructor 1770 */ 1771 virtual ~SortingComparator() throw(); 1772 }; 1773 1774 /** 1775 @brief Get iterator pointed to start of hash 1776 */ 1777 CDTIterator Begin(); 1778 1779 /** 1780 @brief Get iterator pointed to end of hash 1781 */ 1782 CDTIterator End(); 1783 1784 /** 1785 @brief Find element in hash 1786 @param sKey - element name 1787 @return Iterator pointed to element or to end of hash if nothing found 1788 */ 1789 CDTIterator Find(const STLW::string & sKey); 1790 1791 /** 1792 @brief Get constant iterator pointed to start of hash 1793 */ 1794 CDTConstIterator Begin() const; 1795 1796 /** 1797 @brief Get constant iterator pointed to end of hash 1798 */ 1799 CDTConstIterator End() const; 1800 1801 /** 1802 @brief Find element in hash 1803 @param sKey - element name 1804 @return Iterator pointed to element or to end of hash if nothing found 1805 */ 1806 CDTConstIterator Find(const STLW::string & sKey) const; 1807 1808 /** 1809 @brief Try to cast value to integer or to IEEE floating point value 1810 @return Cast result type 1811 */ 1812 eValType CastToNumber(INT_64 & iData, 1813 W_FLOAT & dData) const; 1814 1815 /** 1816 @brief A destructor 1817 */ 1818 ~CDT() throw(); 1819 1820 private: 1821 // Friends 1822 CTPP2DECL friend CDT operator-(const UINT_64 & oValue, const CDT & oCDT); 1823 CTPP2DECL friend CDT operator-(const INT_64 & oValue, const CDT & oCDT); 1824 CTPP2DECL friend CDT operator-(const W_FLOAT & oValue, const CDT & oCDT); 1825 1826 CTPP2DECL friend CDT operator/(const UINT_64 & oValue, const CDT & oCDT); 1827 CTPP2DECL friend CDT operator/(const INT_64 & oValue, const CDT & oCDT); 1828 CTPP2DECL friend CDT operator/(const W_FLOAT & oValue, const CDT & oCDT); 1829 1830 // FWD 1831 struct _CDT; 1832 1833 /** Plain Old datatypes */ 1834 union 1835 { 1836 /** Signed interger */ 1837 INT_64 i_data; 1838 /** Floating point value */ 1839 W_FLOAT d_data; 1840 /** Pointer to shareable container */ 1841 _CDT * p_data; 1842 /** Generic pointer */ 1843 void * pp_data; 1844 } u; 1845 1846 /** Value type */ 1847 mutable eValType eValueType; 1848 1849 /** 1850 @brief Destroy object if need 1851 */ 1852 void Destroy() throw(); 1853 1854 /** 1855 @brief Unshare shareable container 1856 */ 1857 void Unshare(); 1858 1859 /** 1860 @brief Dump CDT into string 1861 @param iLevel - level of recursion 1862 @param oData - data to dump 1863 @param sResult - string to put result in 1864 */ 1865 static void DumpData(UINT_32 iLevel, UINT_32 iOffset, const CDT & oData, STLW::string & sResult, bool bGlobalFmt = false); 1866 1867 /** 1868 @brief Merge two CDT's 1869 @param oDestination - destination object 1870 @param oSource - source object 1871 @param eStrategy - Merging strategy 1872 */ 1873 static void MergeCDT(CDT & oDestination, const CDT & oSource, const eMergeStrategy & eStrategy); 1874 1875 /** 1876 @brief Check complex data type and change value type, if need 1877 */ 1878 void CheckComplexDataType() const; 1879 1880 }; 1881 1882 1883 /** 1884 @class CDTIterator CDT.hpp <CDT.hpp> 1885 @brief CDT[HASH] forward iterator 1886 */ 1887 class CTPP2DECL CDTIterator 1888 { 1889 private: 1890 friend class CDT; 1891 friend class CDTConstIterator; 1892 1893 /** Hash iterator */ 1894 CDT::Map::iterator itMap; 1895 1896 /** 1897 @brief Constructor 1898 @param itIMap - map iterator 1899 */ 1900 CDTIterator(CDT::Map::iterator itIMap); 1901 public: 1902 /** 1903 @brief Copy constructor 1904 @param oRhs - object to copy 1905 */ 1906 CDTIterator(const CDTIterator & oRhs); 1907 1908 /** 1909 @brief Operator = 1910 @param oRhs - object to copy 1911 */ 1912 CDTIterator & operator=(const CDTIterator & oRhs); 1913 1914 /** 1915 @brief Pre-increment operator ++ 1916 */ 1917 CDTIterator & operator++(); 1918 1919 /** 1920 @brief Post-increment operator ++ 1921 */ 1922 CDTIterator operator++(int); 1923 1924 /** 1925 @brief Access operator 1926 @return Pair of key => value 1927 */ 1928 STLW::pair<const STLW::string, CDT> * operator->(); 1929 1930 /** 1931 @brief Comparison operator 1932 @param oRhs - object to compare 1933 @return true if objects are equal 1934 */ 1935 bool operator ==(const CDTIterator & oRhs); 1936 1937 /** 1938 @brief Comparison operator 1939 @param oRhs - object to compare 1940 @return true if objects are NOT equal 1941 */ 1942 bool operator !=(const CDTIterator & oRhs); 1943 }; 1944 1945 1946 /** 1947 @class CDTConstIterator CDT.hpp <CDT.hpp> 1948 @brief CDT[HASH] forward constant iterator 1949 */ 1950 class CTPP2DECL CDTConstIterator 1951 { 1952 private: 1953 friend class CDT; 1954 1955 /** Hash iterator */ 1956 CDT::Map::const_iterator itMap; 1957 1958 public: 1959 /** 1960 @brief Copy constructor 1961 @param oRhs - object to copy 1962 */ 1963 CDTConstIterator(const CDTConstIterator & oRhs); 1964 1965 /** 1966 @brief Type cast constructor 1967 @param oRhs - object to copy 1968 */ 1969 CDTConstIterator(const CDTIterator & oRhs); 1970 1971 /** 1972 @brief Operator = 1973 @param oRhs - object to copy 1974 */ 1975 CDTConstIterator & operator=(const CDTConstIterator & oRhs); 1976 1977 /** 1978 @brief Operator = 1979 @param oRhs - object to copy 1980 */ 1981 CDTConstIterator & operator=(const CDTIterator & oRhs); 1982 1983 /** 1984 @brief Pre-increment operator ++ 1985 */ 1986 CDTConstIterator & operator++(); 1987 1988 /** 1989 @brief Post-increment operator ++ 1990 */ 1991 CDTConstIterator operator++(int); 1992 1993 /** 1994 @brief Access operator 1995 @return Pair of key => value 1996 */ 1997 const STLW::pair<const STLW::string, CDT> * operator->() const; 1998 1999 /** 2000 @brief Comparison operator 2001 @param oRhs - object to compare 2002 @return true if objects are equal 2003 */ 2004 bool operator ==(const CDTConstIterator & oRhs) const; 2005 2006 /** 2007 @brief Comparison operator 2008 @param oRhs - object to compare 2009 @return true if objects are NOT equal 2010 */ 2011 bool operator !=(const CDTConstIterator & oRhs) const; 2012 }; 2013 2014 2015 // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2016 // 2017 // Realization 2018 // 2019 2020 // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2021 2022 /** 2023 @brief Operator + for UINT_64 and CDT arguments 2024 @param oValue - 1-st argument 2025 @param oCDT - 2-nd argument 2026 @return result of addition with same type of oCDT 2027 */ 2028 CTPP2DECL CDT operator+(const UINT_64 & oValue, const CDT & oCDT); 2029 2030 /** 2031 @brief Operator + for INT_64 and CDT arguments 2032 @param oValue - 1-st argument 2033 @param oCDT - 2-nd argument 2034 @return result of addition with same type of oCDT 2035 */ 2036 CTPP2DECL CDT operator+(const INT_64 & oValue, const CDT & oCDT); 2037 2038 /** 2039 @brief Operator + for UINT_32 and CDT arguments 2040 @param oValue - 1-st argument 2041 @param oCDT - 2-nd argument 2042 @return result of addition with same type of oCDT 2043 */ 2044 CTPP2DECL CDT operator+(const UINT_32 & oValue, const CDT & oCDT); 2045 2046 /** 2047 @brief Operator + for INT_32 and CDT arguments 2048 @param oValue - 1-st argument 2049 @param oCDT - 2-nd argument 2050 @return result of addition with same type of oCDT 2051 */ 2052 CTPP2DECL CDT operator+(const INT_32 & oValue, const CDT & oCDT); 2053 2054 /** 2055 @brief Operator + for W_FLOAT and CDT arguments 2056 @param oValue - 1-st argument 2057 @param oCDT - 2-nd argument 2058 @return result of addition with same type of oCDT 2059 */ 2060 CTPP2DECL CDT operator+(const W_FLOAT & oValue, const CDT & oCDT); 2061 2062 // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2063 2064 /** 2065 @brief Operator - for UINT_64 and CDT arguments 2066 @param oValue - 1-st argument 2067 @param oCDT - 2-nd argument 2068 @return result of substraction with same type of oCDT 2069 */ 2070 CTPP2DECL CDT operator-(const UINT_64 & oValue, const CDT & oCDT); 2071 2072 /** 2073 @brief Operator - for INT_64 and CDT arguments 2074 @param oValue - 1-st argument 2075 @param oCDT - 2-nd argument 2076 @return result of substraction with same type of oCDT 2077 */ 2078 CTPP2DECL CDT operator-(const INT_64 & oValue, const CDT & oCDT); 2079 2080 /** 2081 @brief Operator - for UINT_32 and CDT arguments 2082 @param oValue - 1-st argument 2083 @param oCDT - 2-nd argument 2084 @return result of substraction with same type of oCDT 2085 */ 2086 CTPP2DECL CDT operator-(const UINT_32 & oValue, const CDT & oCDT); 2087 2088 /** 2089 @brief Operator - for INT_32 and CDT arguments 2090 @param oValue - 1-st argument 2091 @param oCDT - 2-nd argument 2092 @return result of substraction with same type of oCDT 2093 */ 2094 CTPP2DECL CDT operator-(const INT_32 & oValue, const CDT & oCDT); 2095 2096 /** 2097 @brief Operator - for W_FLOAT and CDT arguments 2098 @param oValue - 1-st argument 2099 @param oCDT - 2-nd argument 2100 @return result of substraction with same type of oCDT 2101 */ 2102 CTPP2DECL CDT operator-(const W_FLOAT & oValue, const CDT & oCDT); 2103 2104 // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2105 2106 /** 2107 @brief Operator * for UINT_64 and CDT arguments 2108 @param oValue - 1-st argument 2109 @param oCDT - 2-nd argument 2110 @return result of multiplication with same type of oCDT 2111 */ 2112 CTPP2DECL CDT operator*(const UINT_64 & oValue, const CDT & oCDT); 2113 2114 /** 2115 @brief Operator * for INT_64 and CDT arguments 2116 @param oValue - 1-st argument 2117 @param oCDT - 2-nd argument 2118 @return result of multiplication with same type of oCDT 2119 */ 2120 CTPP2DECL CDT operator*(const INT_64 & oValue, const CDT & oCDT); 2121 2122 /** 2123 @brief Operator * for UINT_32 and CDT arguments 2124 @param oValue - 1-st argument 2125 @param oCDT - 2-nd argument 2126 @return result of multiplication with same type of oCDT 2127 */ 2128 CTPP2DECL CDT operator*(const UINT_32 & oValue, const CDT & oCDT); 2129 2130 /** 2131 @brief Operator * for INT_32 and CDT arguments 2132 @param oValue - 1-st argument 2133 @param oCDT - 2-nd argument 2134 @return result of multiplication with same type of oCDT 2135 */ 2136 CTPP2DECL CDT operator*(const INT_32 & oValue, const CDT & oCDT); 2137 2138 /** 2139 @brief Operator * for W_FLOAT and CDT arguments 2140 @param oValue - 1-st argument 2141 @param oCDT - 2-nd argument 2142 @return result of multiplication with same type of oCDT 2143 */ 2144 CTPP2DECL CDT operator*(const W_FLOAT & oValue, const CDT & oCDT); 2145 2146 // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2147 2148 /** 2149 @brief Operator / for UINT_64 and CDT arguments 2150 @param oValue - 1-st argument 2151 @param oCDT - 2-nd argument 2152 @return result of division with same type of oCDT 2153 */ 2154 CTPP2DECL CDT operator/(const UINT_64 & oValue, const CDT & oCDT); 2155 2156 /** 2157 @brief Operator / for INT_64 and CDT arguments 2158 @param oValue - 1-st argument 2159 @param oCDT - 2-nd argument 2160 @return result of division with same type of oCDT 2161 */ 2162 CTPP2DECL CDT operator/(const INT_64 & oValue, const CDT & oCDT); 2163 2164 /** 2165 @brief Operator / for UINT_32 and CDT arguments 2166 @param oValue - 1-st argument 2167 @param oCDT - 2-nd argument 2168 @return result of division with same type of oCDT 2169 */ 2170 CTPP2DECL CDT operator/(const UINT_32 & oValue, const CDT & oCDT); 2171 2172 /** 2173 @brief Operator / for INT_32 and CDT arguments 2174 @param oValue - 1-st argument 2175 @param oCDT - 2-nd argument 2176 @return result of division with same type of oCDT 2177 */ 2178 CTPP2DECL CDT operator/(const INT_32 & oValue, const CDT & oCDT); 2179 2180 /** 2181 @brief Operator / for W_FLOAT and CDT arguments 2182 @param oValue - 1-st argument 2183 @param oCDT - 2-nd argument 2184 @return result of division with same type of oCDT 2185 */ 2186 CTPP2DECL CDT operator/(const W_FLOAT & oValue, const CDT & oCDT); 2187 2188 } // namespace CTPP 2189 #endif // _CDT_HPP__ 2190 // End. 2191