Changeset ee70ff5 for libcfa/src/collections/string_res.cfa
- Timestamp:
- Apr 2, 2025, 11:12:18 PM (9 months ago)
- Branches:
- master
- Children:
- 9aa8dcc
- Parents:
- f8913b7c
- File:
-
- 1 edited
-
libcfa/src/collections/string_res.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string_res.cfa
rf8913b7c ree70ff5 10 10 // Created On : Fri Sep 03 11:00:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 14 15:45:24202513 // Update Count : 8812 // Last Modified On : Tue Apr 1 23:29:58 2025 13 // Update Count : 91 14 14 // 15 15 … … 193 193 194 194 // Returns the size of the string in bytes 195 size_t size(const string_res & s) with(s) {195 size_t len(const string_res & s) with(s) { 196 196 return Handle.lnth; 197 197 } … … 255 255 fini: { 256 256 char rfmt[5] = { ' ', delimiters[0], '%', 'n', '\0' }; 257 int l en = -1;// may not be set in fmt258 args = fmt( is, rfmt, &l en );// remove leading whitespace and quote259 if ( eof( is ) || l en== -1 ) break fini;257 int l = -1; // may not be set in fmt 258 args = fmt( is, rfmt, &l ); // remove leading whitespace and quote 259 if ( eof( is ) || l == -1 ) break fini; 260 260 261 261 // Change the remainder of the read into a getline by reseting the closing delimiter. … … 353 353 void ?{}( string_res & s, ssize_t rhs ) { 354 354 char buf[64]; 355 int l en;356 snprintf( buf, sizeof(buf)-1, "%zd%n", rhs, &l en);357 ( s ){ buf, l en};355 int l; 356 snprintf( buf, sizeof(buf)-1, "%zd%n", rhs, &l ); 357 ( s ){ buf, l }; 358 358 } 359 359 void ?{}( string_res & s, size_t rhs ) { 360 360 char buf[64]; 361 int l en;362 snprintf( buf, sizeof(buf)-1, "%zu%n", rhs, &l en);363 ( s ){ buf, l en};361 int l; 362 snprintf( buf, sizeof(buf)-1, "%zu%n", rhs, &l ); 363 ( s ){ buf, l }; 364 364 } 365 365 void ?{}( string_res & s, double rhs ) { 366 366 char buf[64]; 367 int l en;368 snprintf( buf, sizeof(buf)-1, "%g%n", rhs, &l en);369 ( s ){ buf, l en};367 int l; 368 snprintf( buf, sizeof(buf)-1, "%g%n", rhs, &l ); 369 ( s ){ buf, l }; 370 370 } 371 371 void ?{}( string_res & s, long double rhs ) { 372 372 char buf[64]; 373 int l en;374 snprintf( buf, sizeof(buf)-1, "%Lg%n", rhs, &l en);375 ( s ){ buf, l en};373 int l; 374 snprintf( buf, sizeof(buf)-1, "%Lg%n", rhs, &l ); 375 ( s ){ buf, l }; 376 376 } 377 377 void ?{}( string_res & s, double _Complex rhs ) { 378 378 char buf[64]; 379 int l en;380 snprintf( buf, sizeof(buf)-1, "%g+%gi%n", creal( rhs ), cimag( rhs ), &l en);381 ( s ){ buf, l en};379 int l; 380 snprintf( buf, sizeof(buf)-1, "%g+%gi%n", creal( rhs ), cimag( rhs ), &l ); 381 ( s ){ buf, l }; 382 382 } 383 383 void ?{}( string_res & s, long double _Complex rhs ) { 384 384 char buf[64]; 385 int l en;386 snprintf( buf, sizeof(buf)-1, "%Lg+%Lgi%n", creall( rhs ), cimagl( rhs ), &l en);387 ( s ){ buf, l en};385 int l; 386 snprintf( buf, sizeof(buf)-1, "%Lg+%Lgi%n", creall( rhs ), cimagl( rhs ), &l ); 387 ( s ){ buf, l }; 388 388 } 389 389 … … 794 794 795 795 bool contains(const string_res & s, char ch) { 796 for ( i; size(s) ) {796 for ( i; len(s) ) { 797 797 if (s[i] == ch) return true; 798 798 } … … 941 941 942 942 int exclude(const string_res & s, const charclass_res & mask) { 943 for ( i; size(s) ) {943 for ( i; len(s) ) { 944 944 if ( test(mask, s[i]) ) return i; 945 945 } 946 return size(s);946 return len(s); 947 947 } 948 948 949 949 int include(const string_res & s, const charclass_res & mask) { 950 for ( i; size(s) ) {950 for ( i; len(s) ) { 951 951 if ( ! test(mask, s[i]) ) return i; 952 952 } 953 return size(s);953 return len(s); 954 954 } 955 955
Note:
See TracChangeset
for help on using the changeset viewer.