Changeset 416b443 for libcfa/src
- Timestamp:
- Sep 7, 2023, 1:02:54 AM (16 months ago)
- Branches:
- master
- Children:
- 154672d
- Parents:
- 01510fe
- Location:
- libcfa/src/collections
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string.cfa
r01510fe r416b443 157 157 // Comparison 158 158 159 bool ?==?(const string & s, const string & other) { 160 return *s.inner == *other.inner; 161 } 162 163 bool ?!=?(const string & s, const string & other) { 164 return *s.inner != *other.inner; 165 } 166 167 bool ?==?(const string & s, const char * other) { 168 return *s.inner == other; 169 } 170 171 bool ?!=?(const string & s, const char * other) { 172 return *s.inner != other; 173 } 159 int cmp (const string &s1, const string &s2) { return cmp(*s1.inner , *s2.inner); } 160 bool ?==?(const string &s1, const string &s2) { return *s1.inner == *s2.inner ; } 161 bool ?!=?(const string &s1, const string &s2) { return *s1.inner != *s2.inner ; } 162 bool ?>? (const string &s1, const string &s2) { return *s1.inner > *s2.inner ; } 163 bool ?>=?(const string &s1, const string &s2) { return *s1.inner >= *s2.inner ; } 164 bool ?<=?(const string &s1, const string &s2) { return *s1.inner <= *s2.inner ; } 165 bool ?<? (const string &s1, const string &s2) { return *s1.inner < *s2.inner ; } 166 167 int cmp (const string &s1, const char* s2) { return cmp(*s1.inner , s2 ); } 168 bool ?==?(const string &s1, const char* s2) { return *s1.inner == s2 ; } 169 bool ?!=?(const string &s1, const char* s2) { return *s1.inner != s2 ; } 170 bool ?>? (const string &s1, const char* s2) { return *s1.inner > s2 ; } 171 bool ?>=?(const string &s1, const char* s2) { return *s1.inner >= s2 ; } 172 bool ?<=?(const string &s1, const char* s2) { return *s1.inner <= s2 ; } 173 bool ?<? (const string &s1, const char* s2) { return *s1.inner < s2 ; } 174 175 int cmp (const char* s1, const string &s2) { return cmp( s1 , *s2.inner); } 176 bool ?==?(const char* s1, const string &s2) { return s1 == *s2.inner ; } 177 bool ?!=?(const char* s1, const string &s2) { return s1 != *s2.inner ; } 178 bool ?>? (const char* s1, const string &s2) { return s1 > *s2.inner ; } 179 bool ?>=?(const char* s1, const string &s2) { return s1 >= *s2.inner ; } 180 bool ?<=?(const char* s1, const string &s2) { return s1 <= *s2.inner ; } 181 bool ?<? (const char* s1, const string &s2) { return s1 < *s2.inner ; } 182 174 183 175 184 //////////////////////////////////////////////////////// -
libcfa/src/collections/string.hfa
r01510fe r416b443 116 116 117 117 // Comparisons 118 bool ?==?(const string & s, const string & other); 119 bool ?!=?(const string & s, const string & other); 120 bool ?==?(const string & s, const char * other); 121 bool ?!=?(const string & s, const char * other); 118 int cmp (const string &, const string &); 119 bool ?==?(const string &, const string &); 120 bool ?!=?(const string &, const string &); 121 bool ?>? (const string &, const string &); 122 bool ?>=?(const string &, const string &); 123 bool ?<=?(const string &, const string &); 124 bool ?<? (const string &, const string &); 125 126 int cmp (const string &, const char*); 127 bool ?==?(const string &, const char*); 128 bool ?!=?(const string &, const char*); 129 bool ?>? (const string &, const char*); 130 bool ?>=?(const string &, const char*); 131 bool ?<=?(const string &, const char*); 132 bool ?<? (const string &, const char*); 133 134 int cmp (const char*, const string &); 135 bool ?==?(const char*, const string &); 136 bool ?!=?(const char*, const string &); 137 bool ?>? (const char*, const string &); 138 bool ?>=?(const char*, const string &); 139 bool ?<=?(const char*, const string &); 140 bool ?<? (const char*, const string &); 141 122 142 123 143 // Slicing -
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 -
libcfa/src/collections/string_res.hfa
r01510fe r416b443 142 142 143 143 // Comparisons 144 bool ?==?(const string_res &s, const string_res &other); 145 bool ?!=?(const string_res &s, const string_res &other); 146 bool ?==?(const string_res &s, const char* other); 147 bool ?!=?(const string_res &s, const char* other); 144 int cmp (const string_res &, const string_res &); 145 bool ?==?(const string_res &, const string_res &); 146 bool ?!=?(const string_res &, const string_res &); 147 bool ?>? (const string_res &, const string_res &); 148 bool ?>=?(const string_res &, const string_res &); 149 bool ?<=?(const string_res &, const string_res &); 150 bool ?<? (const string_res &, const string_res &); 151 152 int cmp (const string_res &, const char*); 153 bool ?==?(const string_res &, const char*); 154 bool ?!=?(const string_res &, const char*); 155 bool ?>? (const string_res &, const char*); 156 bool ?>=?(const string_res &, const char*); 157 bool ?<=?(const string_res &, const char*); 158 bool ?<? (const string_res &, const char*); 159 160 int cmp (const char*, const string_res &); 161 bool ?==?(const char*, const string_res &); 162 bool ?!=?(const char*, const string_res &); 163 bool ?>? (const char*, const string_res &); 164 bool ?>=?(const char*, const string_res &); 165 bool ?<=?(const char*, const string_res &); 166 bool ?<? (const char*, const string_res &); 148 167 149 168 // String search
Note: See TracChangeset
for help on using the changeset viewer.