Ignore:
Timestamp:
Sep 5, 2023, 4:08:32 PM (10 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
737988b
Parents:
3c7e3c4
Message:

Duplicate manipulator read-to-string code for string_res, and test.

File:
1 edited

Legend:

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

    r3c7e3c4 rff56dd2e  
    102102void ?|?(ofstream &out, const string_res &s);
    103103ifstream & ?|?(ifstream &in, string_res &s);
     104void ?|?( ifstream & in, string_res & this );
     105
     106struct _Istream_Rstr {
     107        string_res * s;
     108        inline _Istream_str_base;
     109}; // _Istream_Rstr
     110
     111static inline {
     112        // read width does not include null terminator
     113        _Istream_Rstr wdi( unsigned int rwd, string_res & s ) { return (_Istream_Rstr)@{ &s, {{0p}, rwd, {.flags.rwd : true}} }; }
     114        _Istream_Rstr getline( string_res & s, const char delimiter = '\n' ) {
     115                return (_Istream_Rstr)@{ &s, {{.delimiter : { delimiter, '\0' } }, -1, {.flags.delimiter : true, .flags.inex : true}} };
     116        }
     117        _Istream_Rstr & getline( _Istream_Rstr & fmt, const char delimiter = '\n' ) {
     118                fmt.delimiter[0] = delimiter; fmt.delimiter[1] = '\0'; fmt.flags.delimiter = true; fmt.flags.inex = true; return fmt;
     119        }
     120        _Istream_Rstr incl( const char scanset[], string_res & s ) { return (_Istream_Rstr)@{ &s, {{scanset}, -1, {.flags.inex : false}} }; }
     121        _Istream_Rstr & incl( const char scanset[], _Istream_Rstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = false; return fmt; }
     122        _Istream_Rstr excl( const char scanset[], string_res & s ) { return (_Istream_Rstr)@{ &s, {{scanset}, -1, {.flags.inex : true}} }; }
     123        _Istream_Rstr & excl( const char scanset[], _Istream_Rstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = true; return fmt; }
     124        _Istream_Rstr ignore( string_res & s ) { return (_Istream_Rstr)@{ &s, {{0p}, -1, {.flags.ignore : true}} }; }
     125        _Istream_Rstr & ignore( _Istream_Rstr & fmt ) { fmt.flags.ignore = true; return fmt; }
     126} // distribution
     127ifstream & ?|?( ifstream & is, _Istream_Rstr f );
     128void ?|?( ifstream & is, _Istream_Rstr t );
    104129
    105130// Concatenation
Note: See TracChangeset for help on using the changeset viewer.