Changeset 416b443 for libcfa/src/collections/string_res.cfa
- Timestamp:
- Sep 7, 2023, 1:02:54 AM (14 months ago)
- Branches:
- master
- Children:
- 154672d
- Parents:
- 01510fe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string_res.cfa
r01510fe r416b443 637 637 // Comparisons 638 638 639 640 bool ?==?(const string_res &s1, const string_res &s2) { 641 return ByteCmp( s1.Handle.s, 0, s1.Handle.lnth, s2.Handle.s, 0, s2.Handle.lnth) == 0; 642 } 643 644 bool ?!=?(const string_res &s1, const string_res &s2) { 645 return !(s1 == s2); 646 } 647 bool ?==?(const string_res &s, const char* other) { 648 string_res sother = other; 649 return s == sother; 650 } 651 bool ?!=?(const string_res &s, const char* other) { 652 return !(s == other); 653 } 639 int cmp(const string_res &s1, const string_res &s2) { 640 // return 0; 641 int ans1 = memcmp(s1.Handle.s, s2.Handle.s, min(s1.Handle.lnth, s2.Handle.lnth)); 642 if (ans1 != 0) return ans1; 643 return s1.Handle.lnth - s2.Handle.lnth; 644 } 645 646 bool ?==?(const string_res &s1, const string_res &s2) { return cmp(s1, s2) == 0; } 647 bool ?!=?(const string_res &s1, const string_res &s2) { return cmp(s1, s2) != 0; } 648 bool ?>? (const string_res &s1, const string_res &s2) { return cmp(s1, s2) > 0; } 649 bool ?>=?(const string_res &s1, const string_res &s2) { return cmp(s1, s2) >= 0; } 650 bool ?<=?(const string_res &s1, const string_res &s2) { return cmp(s1, s2) <= 0; } 651 bool ?<? (const string_res &s1, const string_res &s2) { return cmp(s1, s2) < 0; } 652 653 int cmp (const string_res &s1, const char* s2) { 654 string_res s2x = s2; 655 return cmp(s1, s2x); 656 } 657 658 bool ?==?(const string_res &s1, const char* s2) { return cmp(s1, s2) == 0; } 659 bool ?!=?(const string_res &s1, const char* s2) { return cmp(s1, s2) != 0; } 660 bool ?>? (const string_res &s1, const char* s2) { return cmp(s1, s2) > 0; } 661 bool ?>=?(const string_res &s1, const char* s2) { return cmp(s1, s2) >= 0; } 662 bool ?<=?(const string_res &s1, const char* s2) { return cmp(s1, s2) <= 0; } 663 bool ?<? (const string_res &s1, const char* s2) { return cmp(s1, s2) < 0; } 664 665 int cmp (const char* s1, const string_res & s2) { 666 string_res s1x = s1; 667 return cmp(s1x, s2); 668 } 669 670 bool ?==?(const char* s1, const string_res &s2) { return cmp(s1, s2) == 0; } 671 bool ?!=?(const char* s1, const string_res &s2) { return cmp(s1, s2) != 0; } 672 bool ?>? (const char* s1, const string_res &s2) { return cmp(s1, s2) > 0; } 673 bool ?>=?(const char* s1, const string_res &s2) { return cmp(s1, s2) >= 0; } 674 bool ?<=?(const char* s1, const string_res &s2) { return cmp(s1, s2) <= 0; } 675 bool ?<? (const char* s1, const string_res &s2) { return cmp(s1, s2) < 0; } 676 654 677 655 678
Note: See TracChangeset
for help on using the changeset viewer.