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