[f450f2f] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
| 7 | // string -- variable-length, mutable run of text, with value semantics
|
---|
| 8 | //
|
---|
| 9 | // Author : Michael L. Brooks
|
---|
| 10 | // Created On : Fri Sep 03 11:00:00 2021
|
---|
[6264087] | 11 | // Last Modified By : Peter A. Buhr
|
---|
[5ad6f0d] | 12 | // Last Modified On : Sun Apr 13 21:03:35 2025
|
---|
| 13 | // Update Count : 284
|
---|
[f450f2f] | 14 | //
|
---|
| 15 |
|
---|
| 16 | #pragma once
|
---|
| 17 |
|
---|
[3f631d6] | 18 | #include <iostream.hfa>
|
---|
[9018dcf] | 19 | #include <string_res.hfa>
|
---|
[f450f2f] | 20 |
|
---|
[d03a386] | 21 | static struct __cfa_string_preference_boost_t {} __cfa_string_preference_boost;
|
---|
| 22 | #define PBOOST forall ( | { __cfa_string_preference_boost_t __cfa_string_preference_boost; } )
|
---|
| 23 |
|
---|
[f450f2f] | 24 | struct string {
|
---|
[4223317] | 25 | string_res * inner;
|
---|
[f450f2f] | 26 | };
|
---|
| 27 |
|
---|
| 28 | // RAII, assignment
|
---|
[234c432] | 29 | void ^?{}( string & s );
|
---|
| 30 |
|
---|
[4223317] | 31 | void ?{}( string & s ); // empty string
|
---|
[570e7ad] | 32 | void ?{}( string & s, string s2, size_t maxlen );
|
---|
[d03a386] | 33 | PBOOST void ?{}( string & s, string s2 );
|
---|
[4dab7e8] | 34 | void ?{}( string & s, char );
|
---|
| 35 | void ?{}( string & s, const char * c ); // copy from string literal (NULL-terminated)
|
---|
| 36 | void ?{}( string & s, const char * c, size_t size ); // copy specific length from buffer
|
---|
[479fbe3] | 37 |
|
---|
[570e7ad] | 38 | void ?{}( string & s, signed long int rhs );
|
---|
[f2898df] | 39 | void ?{}( string & s, size_t rhs );
|
---|
| 40 | void ?{}( string & s, double rhs );
|
---|
| 41 | void ?{}( string & s, long double rhs );
|
---|
| 42 | void ?{}( string & s, double _Complex rhs );
|
---|
| 43 | void ?{}( string & s, long double _Complex rhs );
|
---|
[570e7ad] | 44 | static inline void ?{}( string & s, int rhs ) { (s){(signed long int) rhs}; }
|
---|
[f2898df] | 45 |
|
---|
[4223317] | 46 | // string str( ssize_t rhs );
|
---|
| 47 | // string str( size_t rhs );
|
---|
| 48 | // string str( double rhs );
|
---|
| 49 | // string str( long double rhs );
|
---|
| 50 | // string str( double _Complex rhs );
|
---|
| 51 | // string str( long double _Complex rhs );
|
---|
[4dab7e8] | 52 |
|
---|
[d03a386] | 53 | PBOOST string & ?=?( string & s, string c );
|
---|
[4dab7e8] | 54 | string & ?=?( string & s, const char * c ); // copy from "literal"
|
---|
| 55 | string & ?=?( string & s, char c ); // copy from 'l'
|
---|
| 56 | string & assign( string & s, const string & c, size_t n );
|
---|
| 57 | string & assign( string & s, const char * c, size_t n );
|
---|
[570e7ad] | 58 | string & ?=?( string & s, signed long int rhs );
|
---|
[f2898df] | 59 | string & ?=?( string & s, size_t rhs );
|
---|
| 60 | string & ?=?( string & s, double rhs );
|
---|
| 61 | string & ?=?( string & s, long double rhs );
|
---|
| 62 | string & ?=?( string & s, double _Complex rhs );
|
---|
| 63 | string & ?=?( string & s, long double _Complex rhs );
|
---|
[570e7ad] | 64 | static inline string & ?=?( string & s, int rhs ) { return s = ((signed long int) rhs); } // to match cost of (char * int): int
|
---|
[f2898df] | 65 |
|
---|
[234c432] | 66 | static inline string & strcpy( string & s, const char * c ) { s = c; return s; }
|
---|
| 67 | static inline string & strncpy( string & s, const char * c, size_t n ) { assign( s, c, n ); return s; }
|
---|
| 68 | static inline string & strcpy( string & s, const string & c ) { s = c; return s; }
|
---|
| 69 | static inline string & strncpy( string & s, const string & c, size_t n ) { assign( s, c, n ); return s; }
|
---|
[f450f2f] | 70 |
|
---|
| 71 | // Alternate construction: request shared edits
|
---|
[8c2723f] | 72 | struct string_Share {
|
---|
[4223317] | 73 | string * s;
|
---|
[f450f2f] | 74 | };
|
---|
[8c2723f] | 75 | string_Share ?`share( string & s );
|
---|
| 76 | void ?{}( string & s, string_Share src );
|
---|
[f450f2f] | 77 |
|
---|
[234c432] | 78 | // Getters
|
---|
| 79 | static inline size_t len( const string & s ) { return len( *s.inner ); }
|
---|
| 80 | static inline size_t len( const char * cs ) { return strlen( cs ); };
|
---|
| 81 | static inline size_t strlen( const string & s ) { return len( s ); }
|
---|
[5ad6f0d] | 82 | size_t strnlen( const string & s, size_t maxlen );
|
---|
[234c432] | 83 |
|
---|
[f450f2f] | 84 | // IO Operator
|
---|
[3f631d6] | 85 | forall( ostype & | basic_ostream( ostype ) ) {
|
---|
| 86 | ostype & ?|?( ostype & out, string s );
|
---|
| 87 | void ?|?( ostype & out, string s );
|
---|
| 88 | }
|
---|
| 89 | forall( istype & | basic_istream( istype ) )
|
---|
| 90 | istype & ?|?( istype & in, string & s );
|
---|
[7e1dbd7] | 91 |
|
---|
[34c6e1e6] | 92 | static inline {
|
---|
[1a7203d] | 93 | _Ostream_Manip(string) bin( string s ) { return (_Ostream_Manip(string))@{ s, 1, 0, 'b', { .all = 0 } }; }
|
---|
| 94 | _Ostream_Manip(string) oct( string s ) { return (_Ostream_Manip(string))@{ s, 1, 0, 'o', { .all = 0 } }; }
|
---|
| 95 | _Ostream_Manip(string) hex( string s ) { return (_Ostream_Manip(string))@{ s, 1, 0, 'x', { .all = 0 } }; }
|
---|
| 96 | _Ostream_Manip(string) wd( unsigned int w, string s ) { return (_Ostream_Manip(string))@{ s, w, 0, 's', { .all = 0 } }; }
|
---|
| 97 | _Ostream_Manip(string) wd( unsigned int w, unsigned int pc, string s ) { return (_Ostream_Manip(string))@{ s, w, pc, 's', { .flags.pc = true } }; }
|
---|
[34c6e1e6] | 98 | _Ostream_Manip(string) & wd( unsigned int w, _Ostream_Manip(string) & fmt ) { fmt.wd = w; return fmt; }
|
---|
| 99 | _Ostream_Manip(string) & wd( unsigned int w, unsigned int pc, _Ostream_Manip(string) & fmt ) { fmt.wd = w; fmt.pc = pc; fmt.flags.pc = true; return fmt; }
|
---|
| 100 | _Ostream_Manip(string) & left( _Ostream_Manip(string) & fmt ) { fmt.flags.left = true; return fmt; }
|
---|
| 101 | _Ostream_Manip(string) & nobase( _Ostream_Manip(string) & fmt ) { fmt.flags.nobsdp = true; return fmt; }
|
---|
| 102 | } // distribution
|
---|
[dab6e39] | 103 |
|
---|
[3f631d6] | 104 | forall( ostype & | basic_ostream( ostype ) ) {
|
---|
| 105 | ostype & ?|?( ostype & os, _Ostream_Manip(string) f );
|
---|
| 106 | void ?|?( ostype & os, _Ostream_Manip(string) );
|
---|
| 107 | }
|
---|
[34c6e1e6] | 108 |
|
---|
[211def2] | 109 | struct _Istream_Swidth {
|
---|
| 110 | string & s;
|
---|
| 111 | inline _Istream_str_base;
|
---|
| 112 | }; // _Istream_Swidth
|
---|
| 113 |
|
---|
[30548de] | 114 | struct _Istream_Squote {
|
---|
[211def2] | 115 | _Istream_Swidth sstr;
|
---|
[30548de] | 116 | }; // _Istream_Squote
|
---|
[211def2] | 117 |
|
---|
[34c6e1e6] | 118 | struct _Istream_Sstr {
|
---|
[7e1dbd7] | 119 | string & s;
|
---|
[38de914] | 120 | inline _Istream_str_base;
|
---|
[211def2] | 121 | // _Istream_Swidth sstr;
|
---|
[34c6e1e6] | 122 | }; // _Istream_Sstr
|
---|
[7e1dbd7] | 123 |
|
---|
| 124 | static inline {
|
---|
| 125 | // read width does not include null terminator
|
---|
[1a7203d] | 126 | _Istream_Swidth wdi( unsigned int rwd, string & s ) { return (_Istream_Swidth)@{ .s = s, { {.scanset = 0p}, .wd = rwd, {.flags.rwd = true} } }; }
|
---|
[34c6e1e6] | 127 | _Istream_Sstr getline( string & s, const char delimiter = '\n' ) {
|
---|
[1a7203d] | 128 | return (_Istream_Sstr)@{ .s = s, { {.delimiters = { delimiter, '\0' } }, .wd = -1, {.flags.delimiter = true} } };
|
---|
[211def2] | 129 | }
|
---|
| 130 | _Istream_Sstr & getline( _Istream_Swidth & f, const char delimiter = '\n' ) {
|
---|
| 131 | f.delimiters[0] = delimiter; f.delimiters[1] = '\0'; f.flags.delimiter = true; return (_Istream_Sstr &)f;
|
---|
| 132 | }
|
---|
[30548de] | 133 | _Istream_Squote quote( string & s, const char Ldelimiter = '\"', const char Rdelimiter = '\0' ) {
|
---|
| 134 | return (_Istream_Squote)@{ { .s = s, { {.delimiters = { Ldelimiter, Rdelimiter, '\0' }}, .wd = -1, {.flags.rwd = true} } } };
|
---|
[7e1dbd7] | 135 | }
|
---|
[30548de] | 136 | _Istream_Squote & quote( _Istream_Swidth & f, const char Ldelimiter = '"', const char Rdelimiter = '\0' ) {
|
---|
[211def2] | 137 | f.delimiters[0] = Ldelimiter; f.delimiters[1] = Rdelimiter; f.delimiters[2] = '\0';
|
---|
[30548de] | 138 | return (_Istream_Squote &)f;
|
---|
[7e1dbd7] | 139 | }
|
---|
[1a7203d] | 140 | _Istream_Sstr incl( const char scanset[], string & s ) { return (_Istream_Sstr)@{ .s = s, { {.scanset = scanset}, .wd = -1, {.flags.inex = false} } }; }
|
---|
[211def2] | 141 | _Istream_Sstr & incl( const char scanset[], _Istream_Swidth & f ) { f.scanset = scanset; f.flags.inex = false; return (_Istream_Sstr &)f; }
|
---|
[1a7203d] | 142 | _Istream_Sstr excl( const char scanset[], string & s ) { return (_Istream_Sstr)@{ .s = s, { {.scanset = scanset}, .wd = -1, {.flags.inex = true} } }; }
|
---|
[211def2] | 143 | _Istream_Sstr & excl( const char scanset[], _Istream_Swidth & f ) { f.scanset = scanset; f.flags.inex = true; return (_Istream_Sstr &)f; }
|
---|
[1a7203d] | 144 | _Istream_Sstr ignore( string & s ) { return (_Istream_Sstr)@{ .s = s, { {.scanset = 0p}, .wd = -1, {.flags.ignore = true} } }; }
|
---|
[211def2] | 145 | _Istream_Sstr & ignore( _Istream_Swidth & f ) { f.flags.ignore = true; return (_Istream_Sstr &)f; }
|
---|
[30548de] | 146 | _Istream_Squote & ignore( _Istream_Squote & f ) { f.sstr.flags.ignore = true; return (_Istream_Squote &)f; }
|
---|
[211def2] | 147 | _Istream_Sstr & ignore( _Istream_Sstr & f ) { f.flags.ignore = true; return (_Istream_Sstr &)f; }
|
---|
[7e1dbd7] | 148 | } // distribution
|
---|
[dab6e39] | 149 |
|
---|
[3f631d6] | 150 | forall( istype & | basic_istream( istype ) ) {
|
---|
[30548de] | 151 | istype & ?|?( istype & is, _Istream_Squote f );
|
---|
[3f631d6] | 152 | istype & ?|?( istype & is, _Istream_Sstr f );
|
---|
| 153 | static inline istype & ?|?( istype & is, _Istream_Swidth f ) { return is | *(_Istream_Sstr *)&f; }
|
---|
| 154 | }
|
---|
[f450f2f] | 155 |
|
---|
| 156 | // Concatenation
|
---|
[6b765d5] | 157 | void ?+=?( string & s, char c );
|
---|
[c4f8c4bf] | 158 | PBOOST void ?+=?( string & s, string );
|
---|
[6b765d5] | 159 | void append( string & s, const string & s2, size_t maxlen );
|
---|
| 160 | void ?+=?( string & s, const char * s2 );
|
---|
| 161 | void append( string & s, const char * buffer, size_t bsize );
|
---|
| 162 |
|
---|
[570e7ad] | 163 | string ?+?( string s, char c );
|
---|
| 164 | string ?+?( char c, string s );
|
---|
[d03a386] | 165 | PBOOST string ?+?( string s, string s2 );
|
---|
[6b765d5] | 166 | string ?+?( const char * s, char c ); // not backwards compatible
|
---|
| 167 | string ?+?( char c, const char * s );
|
---|
| 168 | string ?+?( const char * c, const char * s );
|
---|
[570e7ad] | 169 | string ?+?( const char * c, string s );
|
---|
| 170 | string ?+?( string s, const char * c );
|
---|
[6b765d5] | 171 | string ?+?( char, char ); // not being called 8-(
|
---|
[4dab7e8] | 172 |
|
---|
| 173 | static inline string & strcat( string & s, const string & s2 ) { s += s2; return s; }
|
---|
| 174 | static inline string & strcat( string & s, const char * c ) { s += c; return s; }
|
---|
| 175 | static inline string & strncat( string & s, const string & s2, size_t maxlen ) { append( s, s2, maxlen ); return s; }
|
---|
| 176 | static inline string & strncat( string & s, const char * buffer, size_t bsize ) { append( s, buffer, bsize ); return s; }
|
---|
[e891349] | 177 |
|
---|
[f450f2f] | 178 | // Repetition
|
---|
[570e7ad] | 179 |
|
---|
| 180 | // Type `signed long long int` chosen for `factor` argument to achieve cost detente.
|
---|
| 181 | // This way, the call `'a' * 3` gets the same safe conversion cost calling here as for
|
---|
| 182 | // the built-in definition `int * int`.
|
---|
| 183 | typedef signed long long int strmul_factor_t;
|
---|
| 184 |
|
---|
| 185 | void ?*=?( string & s, strmul_factor_t factor );
|
---|
| 186 | string ?*?( char c, strmul_factor_t factor ); // not backwards compatible
|
---|
[d03a386] | 187 | PBOOST string ?*?( string s, strmul_factor_t factor );
|
---|
[570e7ad] | 188 | string ?*?( const char * s, strmul_factor_t factor );
|
---|
| 189 | static inline string ?*?( strmul_factor_t factor, char s ) { return s * factor; }
|
---|
[d03a386] | 190 | PBOOST static inline string ?*?( strmul_factor_t factor, string s ) { return s * factor; }
|
---|
[570e7ad] | 191 | static inline string ?*?( strmul_factor_t factor, const char * s ) { return s * factor; }
|
---|
[f450f2f] | 192 |
|
---|
| 193 | // Character access
|
---|
[4dab7e8] | 194 | char ?[?]( const string & s, size_t index );
|
---|
| 195 | string ?[?]( string & s, size_t index ); // mutable length-1 slice of original
|
---|
| 196 | //char codePointAt(const string & s, size_t index ); // to revisit under Unicode
|
---|
[f450f2f] | 197 |
|
---|
| 198 | // Comparisons
|
---|
[5ad6f0d] | 199 | static inline int strcmp( const string & s1, const string & s2 ) { return strcmp( *s1.inner, *s2.inner ); }
|
---|
| 200 | int strncmp( const string & s1, const string & s2, size_t maxlen );
|
---|
| 201 | static inline bool ?==?( const string & s1, const string & s2 ) { return *s1.inner == *s2.inner; }
|
---|
| 202 | static inline bool ?!=?( const string & s1, const string & s2 ) { return *s1.inner != *s2.inner; }
|
---|
| 203 | static inline bool ?>? ( const string & s1, const string & s2 ) { return *s1.inner > *s2.inner; }
|
---|
| 204 | static inline bool ?>=?( const string & s1, const string & s2 ) { return *s1.inner >= *s2.inner; }
|
---|
| 205 | static inline bool ?<=?( const string & s1, const string & s2 ) { return *s1.inner <= *s2.inner; }
|
---|
| 206 | static inline bool ?<? ( const string & s1, const string & s2 ) { return *s1.inner < *s2.inner; }
|
---|
| 207 |
|
---|
| 208 | static inline int strcmp( const string & s1, const char * s2 ) { return strcmp( *s1.inner, s2 ); }
|
---|
| 209 | int strncmp( const string & s1, const char * s2, size_t maxlen );
|
---|
| 210 | static inline bool ?==?( const string & s1, const char * s2 ) { return *s1.inner == s2; }
|
---|
| 211 | static inline bool ?!=?( const string & s1, const char * s2 ) { return *s1.inner != s2; }
|
---|
| 212 | static inline bool ?>? ( const string & s1, const char * s2 ) { return *s1.inner > s2; }
|
---|
| 213 | static inline bool ?>=?( const string & s1, const char * s2 ) { return *s1.inner >= s2; }
|
---|
| 214 | static inline bool ?<=?( const string & s1, const char * s2 ) { return *s1.inner <= s2; }
|
---|
| 215 | static inline bool ?<? ( const string & s1, const char * s2 ) { return *s1.inner < s2; }
|
---|
| 216 |
|
---|
| 217 | static inline int strcmp( const char * s1, const string & s2 ) { return strcmp( s1, *s2.inner ); }
|
---|
| 218 | int strncmp( const char * s1, const string & s2, size_t maxlen );
|
---|
| 219 | static inline bool ?==?( const char * s1, const string & s2 ) { return s1 == *s2.inner; }
|
---|
| 220 | static inline bool ?!=?( const char * s1, const string & s2 ) { return s1 != *s2.inner; }
|
---|
| 221 | static inline bool ?>? ( const char * s1, const string & s2 ) { return s1 > *s2.inner; }
|
---|
| 222 | static inline bool ?>=?( const char * s1, const string & s2 ) { return s1 >= *s2.inner; }
|
---|
| 223 | static inline bool ?<=?( const char * s1, const string & s2 ) { return s1 <= *s2.inner; }
|
---|
| 224 | static inline bool ?<? ( const char * s1, const string & s2 ) { return s1 < *s2.inner; }
|
---|
[416b443] | 225 |
|
---|
[f450f2f] | 226 | // String search
|
---|
[4dab7e8] | 227 | bool contains( const string & s, char ch ); // single character
|
---|
[f450f2f] | 228 |
|
---|
[9018dcf] | 229 | //int find( const string & s, size_t start, size_t len, const string & key, size_t kstart, size_t klen );
|
---|
| 230 | size_t find$( const string_res & s, size_t start, size_t len, const string & key_res, size_t kstart, size_t klen );
|
---|
[f450f2f] | 231 |
|
---|
[9018dcf] | 232 | size_t find( const string & s, char key );
|
---|
| 233 | size_t find( const string & s, const char * key );
|
---|
| 234 | size_t find( const string & s, const string & key );
|
---|
| 235 | size_t find( const string & s, const char * key, size_t keysize );
|
---|
| 236 |
|
---|
| 237 | size_t find( const string & s, size_t start, char key );
|
---|
| 238 | size_t find( const string & s, size_t start, const string & key );
|
---|
| 239 | size_t find( const string & s, size_t start, const char * key );
|
---|
| 240 | size_t find( const string & s, size_t start, const char * key, size_t keysize );
|
---|
[08ed947] | 241 |
|
---|
[ed5023d1] | 242 | bool includes( const string & s, const string & mask );
|
---|
| 243 | bool includes( const string & s, const char * mask );
|
---|
| 244 | bool includes( const string & s, const char * mask, size_t masksize );
|
---|
[f450f2f] | 245 |
|
---|
[4dab7e8] | 246 | bool startsWith( const string & s, const string & prefix );
|
---|
| 247 | bool startsWith( const string & s, const char * prefix );
|
---|
| 248 | bool startsWith( const string & s, const char * prefix, size_t prefixsize );
|
---|
[f450f2f] | 249 |
|
---|
[4dab7e8] | 250 | bool endsWith( const string & s, const string & suffix );
|
---|
| 251 | bool endsWith( const string & s, const char * suffix );
|
---|
| 252 | bool endsWith( const string & s, const char * suffix, size_t suffixsize );
|
---|
[f450f2f] | 253 |
|
---|
[ed5023d1] | 254 | // Slicing
|
---|
[9018dcf] | 255 | string ?()( string & s, ssize_t start, ssize_t len );
|
---|
| 256 | static inline string ?()( const string & s, ssize_t start, ssize_t len ) { string & w = (string &)s; return w( start, len ); } // FIX ME
|
---|
[ed5023d1] | 257 | string ?()( string & s, ssize_t start );
|
---|
[9018dcf] | 258 | static inline string ?()( const string & s, ssize_t start ) { string & w = (string &)s; return w( start ); } // FIX ME
|
---|
[ed5023d1] | 259 | static inline string ?()( string & s, char m ) { return s( find( s, m ), 1 )`share; }
|
---|
[9018dcf] | 260 | static inline string ?()( const string & s, char m ) { string & w = (string &)s; return w( find( s, m ), 1 )`share; } // FIX ME
|
---|
[ed5023d1] | 261 | static inline string ?()( string & s, const char * m ) { return s( find( s, m ), len( m ) )`share; }
|
---|
[9018dcf] | 262 | static inline string ?()( const string & s, const char * m ) { string & w = (string &)s; return w( find( s, m ), len( m ) )`share; } // FIX ME
|
---|
[ed5023d1] | 263 | static inline string ?()( string & s, const string & m ) { return s( find( s, m ), len( m ) )`share; }
|
---|
[9018dcf] | 264 | static inline string ?()( const string & s, const string & m ) { string & w = (string &)s; return w( find( s, m ), len( m ) )`share; } // FIX ME
|
---|
[f450f2f] | 265 |
|
---|
| 266 | struct charclass {
|
---|
[4223317] | 267 | charclass_res * inner;
|
---|
[f450f2f] | 268 | };
|
---|
| 269 |
|
---|
| 270 | void ?{}( charclass & ) = void;
|
---|
[4dab7e8] | 271 | void ?{}( charclass &, charclass ) = void;
|
---|
| 272 | charclass ?=?( charclass &, charclass ) = void;
|
---|
[f450f2f] | 273 |
|
---|
[4dab7e8] | 274 | void ?{}( charclass &, const string & chars );
|
---|
[f450f2f] | 275 | void ?{}( charclass &, const char * chars );
|
---|
| 276 | void ?{}( charclass &, const char * chars, size_t charssize );
|
---|
| 277 | void ^?{}( charclass & );
|
---|
| 278 |
|
---|
[9018dcf] | 279 | size_t include( const string & s, const charclass & mask );
|
---|
[5ad6f0d] | 280 | static inline size_t include( const char * cs, const charclass & mask ) { const string s = cs; return include( s, mask ); }
|
---|
| 281 | static inline string include( const string & s, const charclass & mask ) { return s( 0, include( s, mask ) ); }
|
---|
| 282 | static inline string include( const char * cs, const charclass & mask ) { const string s = cs; return s( 0, include( s, mask ) ); }
|
---|
[9018dcf] | 283 |
|
---|
| 284 | size_t exclude( const string & s, const charclass & mask );
|
---|
[5ad6f0d] | 285 | static inline size_t exclude( const char * cs, const charclass & mask ) { const string s = cs; return exclude( s, mask ); }
|
---|
| 286 | static inline string exclude( const string & s, const charclass & mask ) { return s( 0, exclude( s, mask ) ); }
|
---|
| 287 | static inline string exclude( const char * cs, const charclass & mask ) { const string s = cs; return s( 0, exclude( s, mask ) ); }
|
---|
| 288 |
|
---|
| 289 | size_t include( const string & s, int (*f)( int ) );
|
---|
| 290 | static inline size_t include( const char * cs, int (*f)( int ) ) { const string S = cs; return include( S, f ); }
|
---|
| 291 | static inline string include( const string & s, int (*f)( int ) ) { return s( 0, include( s, f ) ); }
|
---|
| 292 | static inline string include( const char * cs, int (*f)( int ) ) { const string s = cs; return s( 0, include( s, f ) ); }
|
---|
| 293 |
|
---|
| 294 | size_t exclude( const string & s, int (*f)( int ) );
|
---|
| 295 | static inline size_t exclude( const char * cs, int (*f)( int ) ) { const string s = cs; return exclude( s, f ); }
|
---|
| 296 | static inline string exclude( const string & s, int (*f)( int ) ) { return s( 0, exclude( s, f ) ); }
|
---|
| 297 | static inline string exclude( const char * cs, int (*f)( int ) ) { const string s = cs; return s( 0, exclude( s, f ) ); }
|
---|
| 298 |
|
---|
| 299 | string replace( const string & s, const string & from, const string & to );
|
---|
| 300 | static inline string replace( const char * s, const char * from, const char * to ) { string S = s, From = from, To = to; return replace( S, From, To ); }
|
---|
| 301 | static inline string replace( const string & s, const char * from, const char * to ) { const string From = from, To = to; return replace( s, From, To ); }
|
---|
| 302 | static inline string replace( const string & s, const char * from, const string & to ) { const string From = from; return replace( s, From, to ); }
|
---|
| 303 | static inline string replace( const string & s, string & from, const char * to ) { const string To = to; return replace( s, from, To ); }
|
---|
[9018dcf] | 304 |
|
---|
| 305 | string translate( const string & s, int (*f)( int ) );
|
---|
[5ad6f0d] | 306 | static inline string translate( const char * c, int (*f)( int ) ) { const string S = c; return translate( S, f ); }
|
---|
[d03a386] | 307 |
|
---|
| 308 | #ifndef _COMPILING_STRING_CFA_
|
---|
| 309 | #undef PBOOST
|
---|
| 310 | #endif
|
---|