Changeset 7abc3de
- Timestamp:
- Jan 17, 2024, 6:31:03 PM (6 months ago)
- Branches:
- master
- Children:
- 906d8fa
- Parents:
- 11f65b3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string.cfa
r11f65b3 r7abc3de 45 45 } 46 46 47 void ?{}( string & s, const string & s2, size_t maxlen) { 48 (s.inner) { malloc() }; 49 ?{}( *s.inner, *s2.inner, COPY_VALUE, maxlen ); 50 } 51 52 47 53 void ?{}( string & s, string & c ) { 48 54 ?{}( s, (const string &) c ); … … 51 57 void ?{}( string & s, const char c ) { 52 58 (s.inner) { malloc() }; 53 char cs[2] = { c, '\0' }; 54 ?{}( *s.inner, cs ); 59 ?{}( *s.inner, c ); 55 60 } 56 61 -
libcfa/src/collections/string.hfa
r11f65b3 r7abc3de 34 34 void ?{}(string & s); // empty string 35 35 void ?{}(string & s, const string & s2); 36 void ?{}(string & s, const string & s2, size_t maxlen); 36 37 void ?{}(string & s, string & s2); 37 38 -
libcfa/src/collections/string_res.hfa
r11f65b3 r7abc3de 78 78 (s){ rhs, strlen(rhs) }; 79 79 } 80 80 static inline void ?{}(string_res & s, char c ) { 81 ?{}( s, &c, 1); 82 } 83 84 // Deleting the copy constructors makes the compiler reject an attempt to call/return by value 81 85 void ?{}(string_res & s, const string_res & s2) = void; 82 86 void ?{}(string_res & s, string_res & s2) = void; … … 86 90 static inline void ?{}(string_res & s, const string_res & src, StrResInitMode mode ) { 87 91 ?{}( s, src, mode, 0, size(src)); 92 } 93 static inline void ?{}(string_res & s, const string_res & src, StrResInitMode mode, size_t maxlen ) { 94 ?{}( s, src, mode, 0, (size(src) > maxlen)?maxlen:size(src) ); 88 95 } 89 96 -
tests/collections/.expect/string-api-coverage.txt
r11f65b3 r7abc3de 14 14 true false 15 15 true false 16 1234567 16 17 123 17 18 hello 19 hell 18 20 hello 19 21 world 20 22 hello 21 23 world 24 Q 22 25 1234567 23 26 hello -
tests/collections/string-api-coverage.cfa
r11f65b3 r7abc3de 66 66 // 67 67 { 68 string b1 = { "1234567", 3 }; 69 sout | b1; // 123 68 string b1 = "1234567"; 69 sout | b1; // 1234567 70 71 string b1x = { "1234567", 3 }; 72 sout | b1x; // 123 70 73 71 74 string b2 = s; 72 75 sout | b2; // hello 76 77 string b2x = { s, 4 }; 78 sout | b2x; // hell 73 79 74 80 // todo: a plain string & … … 88 94 b4 = s_constref; 89 95 sout | b4; // world 96 97 string b5 = 'Q'; 98 sout | b5; // Q 99 100 90 101 } 91 102 assertWellFormedHandleList( 10 );
Note: See TracChangeset
for help on using the changeset viewer.