Changeset ed5023d1 for libcfa/src/collections/string_res.cfa
- Timestamp:
- Apr 6, 2025, 10:46:19 PM (9 months ago)
- Branches:
- master
- Children:
- 0393fda8
- Parents:
- 56ec508
- File:
-
- 1 edited
-
libcfa/src/collections/string_res.cfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string_res.cfa
r56ec508 red5023d1 10 10 // Created On : Fri Sep 03 11:00:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Apr 1 23:29:58202513 // Update Count : 9112 // Last Modified On : Sun Apr 6 07:38:02 2025 13 // Update Count : 111 14 14 // 15 15 … … 724 724 } 725 725 726 void ?+=?(string_res & str1, const string_res & str2) { 727 append( str1, str2.Handle.s, str2.Handle.lnth ); 728 } 729 730 void append(string_res & str1, const string_res & str2, size_t maxlen) { 731 append( str1, str2.Handle.s, min(str2.Handle.lnth, maxlen) ); 732 } 733 734 void ?+=?(string_res & s, char c) { 735 append( s, & c, 1 ); 736 } 737 void ?+=?(string_res & s, const char * c) { 738 append( s, c, strlen(c) ); 726 void append( string_res & s, const string_res & s2, size_t maxlen ) { 727 append( s, s2.Handle.s, min( s2.Handle.lnth, maxlen ) ); 739 728 } 740 729 … … 751 740 // Comparisons 752 741 753 int strcmp(const string_res & s1, const string_res & s2) { 754 // return 0; 755 int ans1 = memcmp(s1.Handle.s, s2.Handle.s, min(s1.Handle.lnth, s2.Handle.lnth)); 756 if (ans1 != 0) return ans1; 757 return s1.Handle.lnth - s2.Handle.lnth; 758 } 759 760 bool ?==?(const string_res & s1, const string_res & s2) { return strcmp(s1, s2) == 0; } 761 bool ?!=?(const string_res & s1, const string_res & s2) { return strcmp(s1, s2) != 0; } 762 bool ?>? (const string_res & s1, const string_res & s2) { return strcmp(s1, s2) > 0; } 763 bool ?>=?(const string_res & s1, const string_res & s2) { return strcmp(s1, s2) >= 0; } 764 bool ?<=?(const string_res & s1, const string_res & s2) { return strcmp(s1, s2) <= 0; } 765 bool ?<? (const string_res & s1, const string_res & s2) { return strcmp(s1, s2) < 0; } 766 767 int strcmp (const string_res & s1, const char * s2) { 768 string_res s2x = s2; 769 return strcmp(s1, s2x); 770 } 771 772 bool ?==?(const string_res & s1, const char * s2) { return strcmp(s1, s2) == 0; } 773 bool ?!=?(const string_res & s1, const char * s2) { return strcmp(s1, s2) != 0; } 774 bool ?>? (const string_res & s1, const char * s2) { return strcmp(s1, s2) > 0; } 775 bool ?>=?(const string_res & s1, const char * s2) { return strcmp(s1, s2) >= 0; } 776 bool ?<=?(const string_res & s1, const char * s2) { return strcmp(s1, s2) <= 0; } 777 bool ?<? (const string_res & s1, const char * s2) { return strcmp(s1, s2) < 0; } 778 779 int strcmp (const char * s1, const string_res & s2) { 780 string_res s1x = s1; 781 return strcmp(s1x, s2); 782 } 783 784 bool ?==?(const char * s1, const string_res & s2) { return strcmp(s1, s2) == 0; } 785 bool ?!=?(const char * s1, const string_res & s2) { return strcmp(s1, s2) != 0; } 786 bool ?>? (const char * s1, const string_res & s2) { return strcmp(s1, s2) > 0; } 787 bool ?>=?(const char * s1, const string_res & s2) { return strcmp(s1, s2) >= 0; } 788 bool ?<=?(const char * s1, const string_res & s2) { return strcmp(s1, s2) <= 0; } 789 bool ?<? (const char * s1, const string_res & s2) { return strcmp(s1, s2) < 0; } 790 742 int strcmp$( const char * s1, size_t l1, const char * s2, size_t l2 ) { 743 int ret = memcmp( s1, s2, min( l1, l2 ) ); 744 if ( ret != 0 ) return ret; 745 return l1 - l2; 746 } 791 747 792 748 //////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.