Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/collections/string_res.hfa

    r211def2 rf2898df  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb  7 21:24:40 2024
    13 // Update Count     : 59
     12// Last Modified On : Thu Jan  4 11:28:06 2024
     13// Update Count     : 27
    1414//
    1515
     
    123123void ?|?(ofstream & out, const string_res & s);
    124124ifstream & ?|?(ifstream & in, string_res & s);
    125 
    126 struct _Istream_Rwidth {
    127         string_res * s;
    128         inline _Istream_str_base;
    129 }; // _Istream_Rwidth
    130 
    131 struct _Istream_Rquoted {
    132         // string_res * s;
    133         // inline _Istream_str_base;
    134         _Istream_Rwidth rstr;
    135 }; // _Istream_Rquoted
     125void ?|?( ifstream & in, string_res & s );
    136126
    137127struct _Istream_Rstr {
    138128        string_res * s;
    139129        inline _Istream_str_base;
    140 //      _Istream_Rwidth rstr;
    141130}; // _Istream_Rstr
    142131
    143132static inline {
    144133        // read width does not include null terminator
    145         _Istream_Rwidth wdi( unsigned int rwd, string_res & s ) { return (_Istream_Rwidth)@{ .s : &s, { {.scanset : 0p}, .wd : rwd, {.flags.rwd : true} } }; }
     134        _Istream_Rstr wdi( unsigned int rwd, string_res & s ) { return (_Istream_Rstr)@{ &s, {{0p}, rwd, {.flags.rwd : true}} }; }
    146135        _Istream_Rstr getline( string_res & s, const char delimiter = '\n' ) {
    147 //              return (_Istream_Rstr)@{ { .s : &s, { {.delimiters : { delimiter, '\0' } }, .wd : -1, {.flags.delimiter : true} } } };
    148                 return (_Istream_Rstr)@{ .s : &s, { {.delimiters : { delimiter, '\0' } }, .wd : -1, {.flags.delimiter : true} } };
     136                return (_Istream_Rstr)@{ &s, {{.delimiters : { delimiter, '\0' } }, -1, {.flags.delimiter : true, .flags.inex : true}} };
    149137        }
    150         _Istream_Rstr & getline( _Istream_Rwidth & f, const char delimiter = '\n' ) {
    151                 f.delimiters[0] = delimiter; f.delimiters[1] = '\0'; f.flags.delimiter = true; return (_Istream_Rstr &)f;
     138        _Istream_Rstr & getline( _Istream_Rstr & fmt, const char delimiter = '\n' ) {
     139                fmt.delimiters[0] = delimiter; fmt.delimiters[1] = '\0'; fmt.flags.delimiter = true; fmt.flags.inex = true; return fmt;
    152140        }
    153         _Istream_Rquoted quoted( string_res & s, const char Ldelimiter = '\"', const char Rdelimiter = '\0' ) {
    154                 return (_Istream_Rquoted)@{ { .s : &s, { {.delimiters : { Ldelimiter, Rdelimiter, '\0' }}, .wd : -1, {.flags.rwd : true} } } };
    155         }
    156         _Istream_Rquoted & quoted( _Istream_Rwidth & f, const char Ldelimiter = '"', const char Rdelimiter = '\0' ) {
    157                 f.delimiters[0] = Ldelimiter;  f.delimiters[1] = Rdelimiter;  f.delimiters[2] = '\0';
    158                 return (_Istream_Rquoted &)f;
    159         }
    160         _Istream_Rstr incl( const char scanset[], string_res & s ) { return (_Istream_Rstr)@{ .s : &s, { {.scanset : scanset}, .wd : -1, {.flags.inex : false} } }; }
    161         _Istream_Rstr & incl( const char scanset[], _Istream_Rwidth & f ) { f.scanset = scanset; f.flags.inex = false; return (_Istream_Rstr &)f; }
    162         _Istream_Rstr excl( const char scanset[], string_res & s ) { return (_Istream_Rstr)@{ .s : &s, { {.scanset : scanset}, .wd : -1, {.flags.inex : true} } }; }
    163         _Istream_Rstr & excl( const char scanset[], _Istream_Rwidth & f ) { f.scanset = scanset; f.flags.inex = true; return (_Istream_Rstr &)f; }
    164         _Istream_Rstr ignore( string_res & s ) { return (_Istream_Rstr)@{ .s : &s, { {.scanset : 0p}, .wd : -1, {.flags.ignore : true} } }; }
    165         _Istream_Rstr & ignore( _Istream_Rwidth & f ) { f.flags.ignore = true; return (_Istream_Rstr &)f; }
    166         _Istream_Rquoted & ignore( _Istream_Rquoted & f ) { f.rstr.flags.ignore = true; return (_Istream_Rquoted &)f; }
    167         _Istream_Rstr & ignore( _Istream_Rstr & f ) { f.flags.ignore = true; return (_Istream_Rstr &)f; }
     141        _Istream_Rstr incl( const char scanset[], string_res & s ) { return (_Istream_Rstr)@{ &s, {{scanset}, -1, {.flags.inex : false}} }; }
     142        _Istream_Rstr & incl( const char scanset[], _Istream_Rstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = false; return fmt; }
     143        _Istream_Rstr excl( const char scanset[], string_res & s ) { return (_Istream_Rstr)@{ &s, {{scanset}, -1, {.flags.inex : true}} }; }
     144        _Istream_Rstr & excl( const char scanset[], _Istream_Rstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = true; return fmt; }
     145        _Istream_Rstr ignore( string_res & s ) { return (_Istream_Rstr)@{ &s, {{0p}, -1, {.flags.ignore : true}} }; }
     146        _Istream_Rstr & ignore( _Istream_Rstr & fmt ) { fmt.flags.ignore = true; return fmt; }
    168147} // distribution
    169 ifstream & ?|?( ifstream & is, _Istream_Rquoted f );
    170148ifstream & ?|?( ifstream & is, _Istream_Rstr f );
    171 static inline ifstream & ?|?( ifstream & is, _Istream_Rwidth f ) { return is | *(_Istream_Rstr *)&f; }
     149void ?|?( ifstream & is, _Istream_Rstr t );
    172150
    173151// Concatenation
Note: See TracChangeset for help on using the changeset viewer.