Changeset 737988b
- Timestamp:
- Sep 5, 2023, 4:22:53 PM (15 months ago)
- Branches:
- master
- Children:
- efe39bb
- Parents:
- ff56dd2e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string.cfa
rff56dd2e r737988b 129 129 130 130 void ?|?( ifstream & in, string & this ) { 131 (ifstream &)(in | this); ends( in);131 in | (*this.inner); 132 132 } 133 133 134 134 ifstream & ?|?( ifstream & is, _Istream_Sstr f ) { 135 // .---------------, 136 // | | | | |...|0|0| null terminator and guard if missing 137 // `---------------' 138 enum { gwd = 128 + 1, wd = gwd - 1 }; // guard and unguard width 139 char cstr[gwd]; // read in chunks 140 bool cont = false; 141 142 _Istream_Cstr cf = { cstr, (_Istream_str_base)f }; 143 if ( ! cf.flags.rwd ) cf.wd = wd; 144 145 cstr[wd] = '\0'; // guard null terminate string 146 try { 147 is | cf; 148 } catch( cstring_length * ) { 149 cont = true; 150 } finally { 151 if ( ! cf.flags.ignore ) f.s = cstr; // ok to initialize string 152 } // try 153 for ( ; cont; ) { // overflow read ? 154 cont = false; 155 try { 156 is | cf; 157 } catch( cstring_length * ) { 158 cont = true; // continue not allowed 159 } finally { 160 if ( ! cf.flags.ignore ) f.s += cstr; // build string chunk at a time 161 } // try 162 } // for 163 return is; 135 _Istream_Rstr f2 = {f.s.inner, (_Istream_str_base)f}; 136 return is | f2; 164 137 } // ?|? 165 138
Note: See TracChangeset
for help on using the changeset viewer.