Changeset 92d8cda for libcfa/src/collections/string_res.cfa
- Timestamp:
- Sep 6, 2023, 11:49:02 AM (2 years ago)
- Branches:
- master
- Children:
- 4a40fca7, 79b05224, 9d47c1f
- Parents:
- 1f10959 (diff), 1fc111c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string_res.cfa
r1f10959 r92d8cda 245 245 s = temp; 246 246 return in; 247 } 248 249 void ?|?( ifstream & in, string_res & this ) { 250 (ifstream &)(in | this); ends( in ); 251 } 252 253 ifstream & ?|?( ifstream & is, _Istream_Rstr f ) { 254 // .---------------, 255 // | | | | |...|0|0| null terminator and guard if missing 256 // `---------------' 257 enum { gwd = 128 + 1, wd = gwd - 1 }; // guard and unguard width 258 char cstr[gwd]; // read in chunks 259 bool cont = false; 260 261 _Istream_Cstr cf = { cstr, (_Istream_str_base)f }; 262 if ( ! cf.flags.rwd ) cf.wd = wd; 263 264 cstr[wd] = '\0'; // guard null terminate string 265 try { 266 is | cf; 267 } catch( cstring_length * ) { 268 cont = true; 269 } finally { 270 if ( ! cf.flags.ignore ) *(f.s) = cstr; // ok to initialize string 271 } // try 272 for ( ; cont; ) { // overflow read ? 273 cont = false; 274 try { 275 is | cf; 276 } catch( cstring_length * ) { 277 cont = true; // continue not allowed 278 } finally { 279 if ( ! cf.flags.ignore ) *(f.s) += cstr; // build string chunk at a time 280 } // try 281 } // for 282 return is; 283 } // ?|? 284 285 void ?|?( ifstream & in, _Istream_Rstr f ) { 286 (ifstream &)(in | f); ends( in ); 247 287 } 248 288
Note:
See TracChangeset
for help on using the changeset viewer.