Changeset 4dab7e8 for libcfa/src
- Timestamp:
- Aug 5, 2024, 11:13:27 PM (3 months ago)
- Branches:
- master
- Children:
- 1c957a11, c4d6c90
- Parents:
- 0e6cf54c
- Location:
- libcfa/src/collections
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string.cfa
r0e6cf54c r4dab7e8 10 10 // Created On : Fri Sep 03 11:00:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon A pr 15 21:56:28202413 // Update Count : 2 6012 // Last Modified On : Mon Aug 5 23:12:05 2024 13 // Update Count : 273 14 14 // 15 15 … … 45 45 } 46 46 47 void ?{}( string & s, const string & s2, size_t maxlen ) {47 void ?{}( string & s, const string & s2, size_t maxlen ) { 48 48 (s.inner) { malloc() }; 49 49 ?{}( *s.inner, *s2.inner, COPY_VALUE, maxlen ); … … 65 65 } 66 66 67 void ?{}( string & s, const char * c, size_t size ) {67 void ?{}( string & s, const char * c, size_t size ) { 68 68 (s.inner) { malloc() }; 69 69 ?{}( *s.inner, c, size ); … … 98 98 (s.inner) { malloc() }; 99 99 ?{}( *s.inner, rhs ); 100 } 101 102 string str( ssize_t rhs ) { 103 string s = rhs; 104 return s; 105 } 106 107 string str( size_t rhs ) { 108 string s = rhs; 109 return s; 110 } 111 112 string str( double rhs ) { 113 string s = rhs; 114 return s; 115 } 116 117 string str( long double rhs ) { 118 string s = rhs; 119 return s; 120 } 121 122 string str( double _Complex rhs ) { 123 string s = rhs; 124 return s; 125 } 126 127 string str( long double _Complex rhs ) { 128 string s = rhs; 129 return s; 100 130 } 101 131 … … 115 145 116 146 void ?{}( string & s, string_WithSharedEdits src ) { 117 ?{}( s, *src.s->inner, 0, src.s->inner->Handle.lnth );147 ?{}( s, *src.s->inner, 0, src.s->inner->Handle.lnth ); 118 148 } 119 149 … … 121 151 // Assignment 122 152 123 string & ?=?( string & s, const string & c) {153 string & ?=?( string & s, const string & c ) { 124 154 (*s.inner) = (*c.inner); 125 155 return s; 126 156 } 127 157 128 string & ?=?( string & s, string & c) {158 string & ?=?( string & s, string & c ) { 129 159 (*s.inner) = (*c.inner); 130 160 return s; … … 141 171 } 142 172 143 string & assign( string & s, const string & c, size_t n) {144 assign( *s.inner, *c.inner, n);145 return s; 146 } 147 148 string & assign( string & s, const char * c, size_t n) {149 assign( *s.inner, c, n);173 string & assign( string & s, const string & c, size_t n ) { 174 assign( *s.inner, *c.inner, n ); 175 return s; 176 } 177 178 string & assign( string & s, const char * c, size_t n ) { 179 assign( *s.inner, c, n ); 150 180 return s; 151 181 } … … 205 235 } 206 236 207 ifstream & ?|?( ifstream & in, string & s) {237 ifstream & ?|?( ifstream & in, string & s ) { 208 238 return in | (*s.inner); // read to internal string_res 209 239 } … … 236 266 // Comparison 237 267 238 int strcmp(const string & s1, const string & s2) { return strcmp(*s1.inner, *s2.inner); }239 bool ?==?( const string & s1, const string & s2) { return *s1.inner == *s2.inner; }240 bool ?!=?( const string & s1, const string & s2) { return *s1.inner != *s2.inner; }241 bool ?>? ( const string & s1, const string & s2) { return *s1.inner > *s2.inner; }242 bool ?>=?( const string & s1, const string & s2) { return *s1.inner >= *s2.inner; }243 bool ?<=?( const string & s1, const string & s2) { return *s1.inner <= *s2.inner; }244 bool ?<? ( const string & s1, const string & s2) { return *s1.inner < *s2.inner; }245 246 int strcmp(const string & s1, const char * s2) { return strcmp(*s1.inner, s2 ); }247 bool ?==?( const string & s1, const char * s2) { return *s1.inner == s2; }248 bool ?!=?( const string & s1, const char * s2) { return *s1.inner != s2; }249 bool ?>? ( const string & s1, const char * s2) { return *s1.inner > s2; }250 bool ?>=?( const string & s1, const char * s2) { return *s1.inner >= s2; }251 bool ?<=?( const string & s1, const char * s2) { return *s1.inner <= s2; }252 bool ?<? ( const string & s1, const char * s2) { return *s1.inner < s2; }253 254 int strcmp(const char * s1, const string & s2) { return strcmp( s1, *s2.inner); }255 bool ?==?( const char * s1, const string & s2) { return s1 == *s2.inner; }256 bool ?!=?( const char * s1, const string & s2) { return s1 != *s2.inner; }257 bool ?>? ( const char * s1, const string & s2) { return s1 > *s2.inner; }258 bool ?>=?( const char * s1, const string & s2) { return s1 >= *s2.inner; }259 bool ?<=?( const char * s1, const string & s2) { return s1 <= *s2.inner; }260 bool ?<? ( const char * s1, const string & s2) { return s1 < *s2.inner; }268 int strcmp( const string & s1, const string & s2 ) { return strcmp( *s1.inner, *s2.inner ); } 269 bool ?==?( const string & s1, const string & s2 ) { return *s1.inner == *s2.inner; } 270 bool ?!=?( const string & s1, const string & s2 ) { return *s1.inner != *s2.inner; } 271 bool ?>? ( const string & s1, const string & s2 ) { return *s1.inner > *s2.inner; } 272 bool ?>=?( const string & s1, const string & s2 ) { return *s1.inner >= *s2.inner; } 273 bool ?<=?( const string & s1, const string & s2 ) { return *s1.inner <= *s2.inner; } 274 bool ?<? ( const string & s1, const string & s2 ) { return *s1.inner < *s2.inner; } 275 276 int strcmp( const string & s1, const char * s2 ) { return strcmp( *s1.inner, s2 ); } 277 bool ?==?( const string & s1, const char * s2 ) { return *s1.inner == s2; } 278 bool ?!=?( const string & s1, const char * s2 ) { return *s1.inner != s2; } 279 bool ?>? ( const string & s1, const char * s2 ) { return *s1.inner > s2; } 280 bool ?>=?( const string & s1, const char * s2 ) { return *s1.inner >= s2; } 281 bool ?<=?( const string & s1, const char * s2 ) { return *s1.inner <= s2; } 282 bool ?<? ( const string & s1, const char * s2 ) { return *s1.inner < s2; } 283 284 int strcmp( const char * s1, const string & s2 ) { return strcmp( s1, *s2.inner ); } 285 bool ?==?( const char * s1, const string & s2 ) { return s1 == *s2.inner; } 286 bool ?!=?( const char * s1, const string & s2 ) { return s1 != *s2.inner; } 287 bool ?>? ( const char * s1, const string & s2 ) { return s1 > *s2.inner; } 288 bool ?>=?( const char * s1, const string & s2 ) { return s1 >= *s2.inner; } 289 bool ?<=?( const char * s1, const string & s2 ) { return s1 <= *s2.inner; } 290 bool ?<? ( const char * s1, const string & s2 ) { return s1 < *s2.inner; } 261 291 262 292 … … 264 294 // Getter 265 295 266 size_t size( const string & s) {296 size_t size( const string & s ) { 267 297 return size( *s.inner ); 268 298 } … … 271 301 // Concatenation 272 302 273 void ?+=?( string & s, char c) {303 void ?+=?( string & s, char c ) { 274 304 (*s.inner) += c; 275 305 } 276 306 277 void ?+=?( string & s, const string & s2) {307 void ?+=?( string & s, const string & s2 ) { 278 308 (*s.inner) += (*s2.inner); 279 309 } 280 310 281 void append( string & s, const string & s2, size_t maxlen) {311 void append( string & s, const string & s2, size_t maxlen ) { 282 312 append( (*s.inner), (*s2.inner), maxlen ); 283 313 } 284 314 285 void ?+=?( string & s, const char * c) {315 void ?+=?( string & s, const char * c ) { 286 316 (*s.inner) += c; 287 317 } 288 318 289 void append( string & s, const char * buffer, size_t bsize) {319 void append( string & s, const char * buffer, size_t bsize ) { 290 320 append( (*s.inner), buffer, bsize ); 291 321 } 292 322 293 string ?+?( const string & s, char c) {323 string ?+?( const string & s, char c ) { 294 324 string ret = s; 295 325 ret += c; … … 297 327 } 298 328 299 string ?+?(const string & s, const string & s2) { 329 string ?+?( char c, const string & s ) { 330 string ret = s; 331 ret += c; 332 return ret; 333 } 334 335 string ?+?( const string & s, const string & s2 ) { 300 336 string ret = s; 301 337 ret += s2; … … 303 339 } 304 340 305 string ?+?(const char * s1, const char * s2) { 341 string ?+?( const char * s, char c ) { 342 string ret = s; 343 ret += c; 344 return ret; 345 } 346 347 string ?+?( char c, const char * s ) { 348 string ret = c; 349 ret += s; 350 return ret; 351 } 352 353 string ?+?( const char * s1, const char * s2 ) { 306 354 string ret = s1; 307 355 ret += s2; … … 309 357 } 310 358 311 string ?+?(const string & s, const char * c) { 359 string ?+?( const char * s1, string & s2 ) { 360 string ret = s1; 361 ret += s2; 362 return ret; 363 } 364 365 string ?+?( const string & s, const char * c ) { 312 366 string ret = s; 313 367 ret += c; … … 318 372 // Repetition 319 373 320 void ?*=?( string & s, size_t factor) {374 void ?*=?( string & s, size_t factor ) { 321 375 (*s.inner) *= factor; 322 376 } 323 377 324 string ?*?( const string & s, size_t factor) {378 string ?*?( const string & s, size_t factor ) { 325 379 string ret = s; 326 380 ret *= factor; … … 328 382 } 329 383 330 string ?*?( char c, size_t factor) {384 string ?*?( char c, size_t factor ) { 331 385 string ret = c; 332 386 ret *= factor; … … 334 388 } 335 389 336 string ?*?( const char * s, size_t factor) {390 string ?*?( const char * s, size_t factor ) { 337 391 string ret = s; 338 392 ret *= factor; … … 343 397 // Character access 344 398 345 char ?[?]( const string & s, size_t index) {399 char ?[?]( const string & s, size_t index ) { 346 400 return (*s.inner)[index]; 347 401 } 348 402 349 string ?[?]( string & s, size_t index) {403 string ?[?]( string & s, size_t index ) { 350 404 string ret = { *s.inner, index, 1 }; 351 405 return ret`shareEdits; … … 355 409 // Search 356 410 357 bool contains( const string & s, char ch) {411 bool contains( const string & s, char ch ) { 358 412 return contains( *s.inner, ch ); 359 413 } 360 414 361 int find( const string & s, char search) {415 int find( const string & s, char search ) { 362 416 return find( *s.inner, search ); 363 417 } 364 418 365 int find( const string & s, const string & search) {419 int find( const string & s, const string & search ) { 366 420 return find( *s.inner, *search.inner ); 367 421 } 368 422 369 int find( const string & s, const char * search) {370 return find( *s.inner, search );371 } 372 373 int find( const string & s, const char * search, size_t searchsize) {374 return find( *s.inner, search, searchsize );375 } 376 377 int findFrom( const string & s, size_t fromPos, char search) {423 int find( const string & s, const char * search ) { 424 return find( *s.inner, search ); 425 } 426 427 int find( const string & s, const char * search, size_t searchsize ) { 428 return find( *s.inner, search, searchsize ); 429 } 430 431 int findFrom( const string & s, size_t fromPos, char search ) { 378 432 return findFrom( *s.inner, fromPos, search ); 379 433 } 380 434 381 int findFrom( const string & s, size_t fromPos, const string & search) {435 int findFrom( const string & s, size_t fromPos, const string & search ) { 382 436 return findFrom( *s.inner, fromPos, *search.inner ); 383 437 } 384 438 385 int findFrom( const string & s, size_t fromPos, const char * search) {439 int findFrom( const string & s, size_t fromPos, const char * search ) { 386 440 return findFrom( *s.inner, fromPos, search ); 387 441 } 388 442 389 int findFrom( const string & s, size_t fromPos, const char * search, size_t searchsize) {443 int findFrom( const string & s, size_t fromPos, const char * search, size_t searchsize ) { 390 444 return findFrom( *s.inner, fromPos, search, searchsize ); 391 445 } 392 446 393 bool includes( const string & s, const string & search) {447 bool includes( const string & s, const string & search ) { 394 448 return includes( *s.inner, *search.inner ); 395 449 } 396 450 397 bool includes( const string & s, const char * search) {451 bool includes( const string & s, const char * search ) { 398 452 return includes( *s.inner, search ); 399 453 } 400 454 401 bool includes( const string & s, const char * search, size_t searchsize) {455 bool includes( const string & s, const char * search, size_t searchsize ) { 402 456 return includes( *s.inner, search, searchsize ); 403 457 } 404 458 405 bool startsWith( const string & s, const string & prefix) {459 bool startsWith( const string & s, const string & prefix ) { 406 460 return startsWith( *s.inner, *prefix.inner ); 407 461 } 408 462 409 bool startsWith( const string & s, const char * prefix) {463 bool startsWith( const string & s, const char * prefix ) { 410 464 return startsWith( *s.inner, prefix ); 411 465 } 412 466 413 bool startsWith( const string & s, const char * prefix, size_t prefixsize) {467 bool startsWith( const string & s, const char * prefix, size_t prefixsize ) { 414 468 return startsWith( *s.inner, prefix, prefixsize ); 415 469 } 416 470 417 bool endsWith( const string & s, const string & suffix) {471 bool endsWith( const string & s, const string & suffix ) { 418 472 return endsWith( *s.inner, *suffix.inner ); 419 473 } 420 474 421 bool endsWith( const string & s, const char * suffix) {475 bool endsWith( const string & s, const char * suffix ) { 422 476 return endsWith( *s.inner, suffix ); 423 477 } 424 478 425 bool endsWith( const string & s, const char * suffix, size_t suffixsize) {479 bool endsWith( const string & s, const char * suffix, size_t suffixsize ) { 426 480 return endsWith( *s.inner, suffix, suffixsize ); 427 481 } … … 431 485 // charclass, include, exclude 432 486 433 void ?{}( charclass & s, const string & chars ) {487 void ?{}( charclass & s, const string & chars ) { 434 488 (s.inner) { malloc() }; 435 489 ?{}( *s.inner, *(const string_res *)chars.inner ); … … 453 507 454 508 455 int exclude( const string & s, const charclass & mask) {509 int exclude( const string & s, const charclass & mask ) { 456 510 return exclude( *s.inner, *mask.inner ); 457 511 } 458 512 /* 459 StrSlice exclude( string & s, const charclass & mask) {513 StrSlice exclude( string & s, const charclass & mask ) { 460 514 } 461 515 */ 462 516 463 int include( const string & s, const charclass & mask) {517 int include( const string & s, const charclass & mask ) { 464 518 return include( *s.inner, *mask.inner ); 465 519 } 466 520 467 521 /* 468 StrSlice include( string & s, const charclass & mask) {522 StrSlice include( string & s, const charclass & mask ) { 469 523 } 470 524 */ 471 -
libcfa/src/collections/string.hfa
r0e6cf54c r4dab7e8 10 10 // Created On : Fri Sep 03 11:00:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 6 20:59:18202413 // Update Count : 1 1812 // Last Modified On : Mon Aug 5 23:06:14 2024 13 // Update Count : 128 14 14 // 15 15 … … 28 28 29 29 // Getters 30 size_t size( const string & s);31 static inline size_t strlen( const string & s) { return size( s ); }30 size_t size( const string & s ); 31 static inline size_t strlen( const string & s ) { return size( s ); } 32 32 33 33 // RAII, assignment 34 void ?{}( string & s); // empty string35 void ?{}( string & s, const string & s2);36 void ?{}( string & s, const string & s2, size_t maxlen);37 void ?{}( string & s, string & s2);38 39 void ?{}( string & s, char);40 void ?{}( string & s, const char * c);// copy from string literal (NULL-terminated)41 void ?{}( string & s, const char * c, size_t size);// copy specific length from buffer34 void ?{}( string & s ); // empty string 35 void ?{}( string & s, const string & s2 ); 36 void ?{}( string & s, const string & s2, size_t maxlen ); 37 void ?{}( string & s, string & s2 ); 38 39 void ?{}( string & s, char ); 40 void ?{}( string & s, const char * c ); // copy from string literal (NULL-terminated) 41 void ?{}( string & s, const char * c, size_t size ); // copy specific length from buffer 42 42 43 43 void ?{}( string & s, ssize_t rhs ); … … 48 48 void ?{}( string & s, long double _Complex rhs ); 49 49 50 string & ?=?(string & s, const string & c); 51 string & ?=?(string & s, string & c); 52 string & ?=?(string & s, const char * c); // copy from "literal" 53 string & ?=?(string & s, char c); // copy from 'l' 54 string & assign(string & s, const string & c, size_t n); 55 string & assign(string & s, const char * c, size_t n); 56 57 static inline string & strcpy(string & s, const char * c) { s = c; return s; } 58 static inline string & strncpy(string & s, const char * c, size_t n) { assign( s, c, n); return s; } 59 static inline string & strcpy(string & s, const string & c) { s = c; return s; } 60 static inline string & strncpy(string & s, const string & c, size_t n) { assign(s, c, n); return s; } 50 string str( ssize_t rhs ); 51 string str( size_t rhs ); 52 string str( double rhs ); 53 string str( long double rhs ); 54 string str( double _Complex rhs ); 55 string str( long double _Complex rhs ); 56 57 string & ?=?( string & s, const string & c ); 58 string & ?=?( string & s, string & c ); 59 string & ?=?( string & s, const char * c ); // copy from "literal" 60 string & ?=?( string & s, char c ); // copy from 'l' 61 string & assign( string & s, const string & c, size_t n ); 62 string & assign( string & s, const char * c, size_t n ); 63 64 static inline string & strcpy( string & s, const char * c ) { s = c; return s; } 65 static inline string & strncpy( string & s, const char * c, size_t n ) { assign( s, c, n ); return s; } 66 static inline string & strcpy( string & s, const string & c ) { s = c; return s; } 67 static inline string & strncpy( string & s, const string & c, size_t n ) { assign( s, c, n ); return s; } 61 68 62 69 string & ?=?( string & s, ssize_t rhs ); … … 67 74 string & ?=?( string & s, long double _Complex rhs ); 68 75 69 void ^?{}( string & s);76 void ^?{}( string & s ); 70 77 71 78 // Alternate construction: request shared edits … … 77 84 78 85 // IO Operator 79 ofstream & ?|?( ofstream & out, const string & s);80 void ?|?( ofstream & out, const string & s);81 ifstream & ?|?( ifstream & in, string & s);86 ofstream & ?|?( ofstream & out, const string & s ); 87 void ?|?( ofstream & out, const string & s ); 88 ifstream & ?|?( ifstream & in, string & s ); 82 89 83 90 static inline { … … 145 152 146 153 // Concatenation 147 void ?+=?(string & s, char c); // append a character 148 void ?+=?(string & s, const string & s2); // append-concatenate to first string 149 void append(string & s, const string & s2, size_t maxlen); // append-concatenate to first string, up to maxlen 150 void ?+=?(string & s, const char * s2); // append-concatenate NULL-terminated string to first string 151 void append(string & s, const char * buffer, size_t bsize); // append-concatenate given range to first string 152 153 string ?+?(const string & s, char c); // add a character to a copy of the string 154 string ?+?(const string & s, const string & s2); // copy and concatenate both strings 155 string ?+?(const char * s1, const char * s2); // copy and concatenate both strings 156 string ?+?(const string & s, const char * c); // copy and concatenate with NULL-terminated string 157 158 static inline string & strcat(string & s, const string & s2) { s += s2; return s; } 159 static inline string & strcat(string & s, const char * c) { s += c; return s; } 160 static inline string & strncat(string & s, const string & s2, size_t maxlen) { append(s, s2, maxlen); return s; } 161 static inline string & strncat(string & s, const char * buffer, size_t bsize) { append(s, buffer, bsize); return s; } 154 void ?+=?( string & s, char c ); // append a character 155 void ?+=?( string & s, const string & s2 ); // append-concatenate to first string 156 void append( string & s, const string & s2, size_t maxlen ); // append-concatenate to first string, up to maxlen 157 void ?+=?( string & s, const char * s2 ); // append-concatenate NULL-terminated string to first string 158 void append( string & s, const char * buffer, size_t bsize ); // append-concatenate given range to first string 159 160 string ?+?( const string & s, char c ); // add a character to a copy of the string 161 string ?+?( char c, const string & s ); // add a character to a copy of the string 162 string ?+?( const string & s, const string & s2 ); // copy and concatenate both strings 163 string ?+?( const char * s, char c ); // copy and concatenate both strings 164 string ?+?( char c, const char * s ); // copy and concatenate both strings 165 string ?+?( const char * s1, const char * s2 ); // copy and concatenate both strings 166 string ?+?( const char * s1, string & s2 ); // copy and concatenate both strings 167 string ?+?( const string & s, const char * c ); // copy and concatenate with NULL-terminated string 168 169 static inline string & strcat( string & s, const string & s2 ) { s += s2; return s; } 170 static inline string & strcat( string & s, const char * c ) { s += c; return s; } 171 static inline string & strncat( string & s, const string & s2, size_t maxlen ) { append( s, s2, maxlen ); return s; } 172 static inline string & strncat( string & s, const char * buffer, size_t bsize ) { append( s, buffer, bsize ); return s; } 162 173 163 174 // Repetition 164 string ?*?( const string & s, size_t factor);165 void ?*=?( string & s, size_t factor);166 string ?*?( char c, size_t factor);167 string ?*?( const char *s, size_t factor);175 string ?*?( const string & s, size_t factor ); 176 void ?*=?( string & s, size_t factor ); 177 string ?*?( char c, size_t factor ); 178 string ?*?( const char *s, size_t factor ); 168 179 169 180 // Character access 170 char ?[?]( const string & s, size_t index);171 string ?[?]( string & s, size_t index);// mutable length-1 slice of original172 //char codePointAt(const string & s, size_t index );// to revisit under Unicode181 char ?[?]( const string & s, size_t index ); 182 string ?[?]( string & s, size_t index ); // mutable length-1 slice of original 183 //char codePointAt(const string & s, size_t index ); // to revisit under Unicode 173 184 174 185 // Comparisons 175 int strcmp (const string &, const string &);176 bool ?==?( const string &, const string &);177 bool ?!=?( const string &, const string &);178 bool ?>? ( const string &, const string &);179 bool ?>=?( const string &, const string &);180 bool ?<=?( const string &, const string &);181 bool ?<? ( const string &, const string &);182 183 int strcmp (const string &, const char *);184 bool ?==?( const string &, const char *);185 bool ?!=?( const string &, const char *);186 bool ?>? ( const string &, const char *);187 bool ?>=?( const string &, const char *);188 bool ?<=?( const string &, const char *);189 bool ?<? ( const string &, const char *);190 191 int strcmp (const char *, const string &);192 bool ?==?( const char *, const string &);193 bool ?!=?( const char *, const string &);194 bool ?>? ( const char *, const string &);195 bool ?>=?( const char *, const string &);196 bool ?<=?( const char *, const string &);197 bool ?<? ( const char *, const string &);186 int strcmp ( const string &, const string &); 187 bool ?==?( const string &, const string &); 188 bool ?!=?( const string &, const string &); 189 bool ?>? ( const string &, const string &); 190 bool ?>=?( const string &, const string &); 191 bool ?<=?( const string &, const string &); 192 bool ?<? ( const string &, const string &); 193 194 int strcmp( const string &, const char *); 195 bool ?==?( const string &, const char *); 196 bool ?!=?( const string &, const char *); 197 bool ?>? ( const string &, const char *); 198 bool ?>=?( const string &, const char *); 199 bool ?<=?( const string &, const char *); 200 bool ?<? ( const string &, const char *); 201 202 int strcmp( const char *, const string &); 203 bool ?==?( const char *, const string &); 204 bool ?!=?( const char *, const string &); 205 bool ?>? ( const char *, const string &); 206 bool ?>=?( const char *, const string &); 207 bool ?<=?( const char *, const string &); 208 bool ?<? ( const char *, const string &); 198 209 199 210 200 211 // Slicing 201 string ?()( string & s, size_t start, size_t len ); 202 string ?()( string & s, size_t start );212 string ?()( string & s, size_t start, size_t len ); // TODO const? 213 string ?()( string & s, size_t start ); 203 214 204 215 // String search 205 bool contains( const string & s, char ch);// single character206 207 int find( const string & s, char search);208 int find( const string & s, const string & search);209 int find( const string & s, const char * search);210 int find( const string & s, const char * search, size_t searchsize);211 212 int findFrom( const string & s, size_t fromPos, char search);213 int findFrom( const string & s, size_t fromPos, const string & search);214 int findFrom( const string & s, size_t fromPos, const char * search);215 int findFrom( const string & s, size_t fromPos, const char * search, size_t searchsize);216 217 bool includes( const string & s, const string & search);218 bool includes( const string & s, const char * search);219 bool includes( const string & s, const char * search, size_t searchsize);220 221 bool startsWith( const string & s, const string & prefix);222 bool startsWith( const string & s, const char * prefix);223 bool startsWith( const string & s, const char * prefix, size_t prefixsize);224 225 bool endsWith( const string & s, const string & suffix);226 bool endsWith( const string & s, const char * suffix);227 bool endsWith( const string & s, const char * suffix, size_t suffixsize);216 bool contains( const string & s, char ch ); // single character 217 218 int find( const string & s, char search ); 219 int find( const string & s, const string & search ); 220 int find( const string & s, const char * search ); 221 int find( const string & s, const char * search, size_t searchsize ); 222 223 int findFrom( const string & s, size_t fromPos, char search ); 224 int findFrom( const string & s, size_t fromPos, const string & search ); 225 int findFrom( const string & s, size_t fromPos, const char * search ); 226 int findFrom( const string & s, size_t fromPos, const char * search, size_t searchsize ); 227 228 bool includes( const string & s, const string & search ); 229 bool includes( const string & s, const char * search ); 230 bool includes( const string & s, const char * search, size_t searchsize ); 231 232 bool startsWith( const string & s, const string & prefix ); 233 bool startsWith( const string & s, const char * prefix ); 234 bool startsWith( const string & s, const char * prefix, size_t prefixsize ); 235 236 bool endsWith( const string & s, const string & suffix ); 237 bool endsWith( const string & s, const char * suffix ); 238 bool endsWith( const string & s, const char * suffix, size_t suffixsize ); 228 239 229 240 // Modifiers 230 void padStart( string & s, size_t n);231 void padStart( string & s, size_t n, char padding);232 void padEnd( string & s, size_t n);233 void padEnd( string & s, size_t n, char padding);241 void padStart( string & s, size_t n ); 242 void padStart( string & s, size_t n, char padding ); 243 void padEnd( string & s, size_t n ); 244 void padEnd( string & s, size_t n, char padding ); 234 245 235 246 … … 239 250 240 251 void ?{}( charclass & ) = void; 241 void ?{}( charclass &, charclass ) = void;242 charclass ?=?( charclass &, charclass ) = void;243 244 void ?{}( charclass &, const string & chars );252 void ?{}( charclass &, charclass ) = void; 253 charclass ?=?( charclass &, charclass ) = void; 254 255 void ?{}( charclass &, const string & chars ); 245 256 void ?{}( charclass &, const char * chars ); 246 257 void ?{}( charclass &, const char * chars, size_t charssize ); 247 258 void ^?{}( charclass & ); 248 259 249 int include( const string & s, const charclass & mask);250 251 int exclude( const string & s, const charclass & mask);260 int include( const string & s, const charclass & mask ); 261 262 int exclude( const string & s, const charclass & mask ); 252 263 253 264 /* 254 265 What to do with? 255 StrRet include( string & s, const charclass & mask);256 StrRet exclude( string & s, const charclass & mask);266 StrRet include( string & s, const charclass & mask ); 267 StrRet exclude( string & s, const charclass & mask ); 257 268 */
Note: See TracChangeset
for help on using the changeset viewer.