Changeset ae0c1c3 for libcfa/src/iostream.hfa
- Timestamp:
- Apr 25, 2025, 7:08:53 PM (9 months ago)
- Branches:
- master
- Children:
- 7d02d35, ecfa58be
- Parents:
- 65bd3c2
- File:
-
- 1 edited
-
libcfa/src/iostream.hfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.hfa
r65bd3c2 rae0c1c3 22 22 23 23 forall( ostype & ) 24 struct basic_ostream_data { 25 // private 26 bool (*sepPrt$)( ostype & ); // get separator state (on/off) 27 void (*sepReset$)( ostype & ); // set separator state to default state 28 void (*sepReset$)( ostype &, bool ); // set separator and default state 29 const char * (*sepGetCur$)( ostype & ); // get current separator string 30 void (*sepSetCur$)( ostype &, const char [] ); // set current separator string 31 bool (*getNL$)( ostype & ); // get newline 32 bool (*setNL$)( ostype &, bool ); // set newline 33 bool (*getANL$)( ostype & ); // get auto newline (on/off) 34 bool (*setANL$)( ostype &, bool ); // set auto newline (on/off), and return previous state 35 bool (*getPrt$)( ostype & ); // get fmt called in output cascade 36 bool (*setPrt$)( ostype &, bool ); // set fmt called in output cascade 37 // public 38 void (*nlOn)( ostype & ); // turn auto-newline state on 39 void (*nlOff)( ostype & ); // turn auto-newline state off 40 41 void (*sep)( ostype & ); // turn separator state on 42 void (*nosep)( ostype & ); // turn separator state off 43 bool (*sepOn)( ostype & ); // set default state to on, and return previous state 44 bool (*sepOff)( ostype & ); // set default state to off, and return previous state 45 const char * (*sepGet)( ostype & ); // get separator string 46 void (*sepSet)( ostype &, const char [] ); // set separator to string (15 character maximum) 47 const char * (*sepGetTuple)( ostype & ); // get tuple separator string 48 void (*sepSetTuple)( ostype &, const char [] ); // set tuple separator to string (15 character maximum) 49 50 void (*ends)( ostype & ); // end of output statement 51 int (*fmt)( ostype &, const char format[], ... ) __attribute__(( format(printf, 2, 3) )); 52 }; // basic_ostream 53 54 forall( ostype & ) 55 struct ostream_data { 56 inline basic_ostream_data( ostype ); 57 bool (*fail)( ostype & ); // operation failed? 58 void (*clearerr)( ostype & ); 59 int (*flush)( ostype & ); 60 void (*open)( ostype &, const char name[], const char mode[] ); 61 void (*close)( ostype & ); 62 ostype & (*write)( ostype &, const char [], size_t ); 63 }; // ostream 64 65 forall( ostype & ) 24 66 trait basic_ostream { 25 // private 26 bool sepPrt$( ostype & ); // get separator state (on/off) 27 void sepReset$( ostype & ); // set separator state to default state 28 void sepReset$( ostype &, bool ); // set separator and default state 29 const char * sepGetCur$( ostype & ); // get current separator string 30 void sepSetCur$( ostype &, const char [] ); // set current separator string 31 bool getNL$( ostype & ); // get newline 32 bool setNL$( ostype &, bool ); // set newline 33 bool getANL$( ostype & ); // get auto newline (on/off) 34 bool setANL$( ostype &, bool ); // set auto newline (on/off), and return previous state 35 bool getPrt$( ostype & ); // get fmt called in output cascade 36 bool setPrt$( ostype &, bool ); // set fmt called in output cascade 37 // public 38 void nlOn( ostype & ); // turn auto-newline state on 39 void nlOff( ostype & ); // turn auto-newline state off 40 41 void sep( ostype & ); // turn separator state on 42 void nosep( ostype & ); // turn separator state off 43 bool sepOn( ostype & ); // set default state to on, and return previous state 44 bool sepOff( ostype & ); // set default state to off, and return previous state 45 const char * sepGet( ostype & ); // get separator string 46 void sepSet( ostype &, const char [] ); // set separator to string (15 character maximum) 47 const char * sepGetTuple( ostype & ); // get tuple separator string 48 void sepSetTuple( ostype &, const char [] ); // set tuple separator to string (15 character maximum) 49 50 void ends( ostype & ); // end of output statement 51 int fmt( ostype &, const char format[], ... ) __attribute__(( format(printf, 2, 3) )); 52 }; // basic_ostream 67 basic_ostream_data(ostype) const & basic_ostream_table; 68 }; 53 69 54 70 forall( ostype & | basic_ostream( ostype ) ) 55 71 trait ostream { 56 bool fail( ostype & ); // operation failed? 57 void clearerr( ostype & ); 58 int flush( ostype & ); 59 void open( ostype &, const char name[], const char mode[] ); 60 void close( ostype & ); 61 ostype & write( ostype &, const char [], size_t ); 62 }; // ostream 72 ostream_data(ostype) const & ostream_table; 73 }; 63 74 64 75 // forall( T ) … … 77 88 #define OSTYPE_VOID_IMPL( os, T ) \ 78 89 void ?|?( ostype & os, T t ) { \ 79 (ostype &)(os | t); ends( os ); \ 90 (ostype &)(os | t); \ 91 basic_ostream_table.ends( os ); \ 80 92 } // ?|? 81 93 … … 308 320 309 321 forall( istype & ) 322 struct basic_istream_data { 323 // private 324 bool (*getANL$)( istype & ); // get scan newline (on/off) 325 bool (*setANL$)( istype &, bool ); // set scan newline (on/off) 326 // public 327 void (*nlOn)( istype & ); // read newline 328 void (*nlOff)( istype & ); // scan newline 329 int (*fmt)( istype &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) )); 330 istype & (*ungetc)( char, istype & ); 331 bool (*eof)( istype & ); 332 void (*clearerr)( istype & ); 333 }; // basic_istream 334 335 forall( istype & ) 336 struct istream_data { 337 inline basic_istream_data( istype ); 338 bool (*fail)( istype & ); 339 void (*open)( istype & is, const char name[], const char mode[] ); 340 void (*open)( istype & is, const char name[] ); 341 void (*close)( istype & is ); 342 istype & (*read)( istype &, char [], size_t ); 343 }; // istream 344 345 forall( istype & ) 310 346 trait basic_istream { 311 // private 312 bool getANL$( istype & ); // get scan newline (on/off) 313 bool setANL$( istype &, bool ); // set scan newline (on/off) 314 // public 315 void nlOn( istype & ); // read newline 316 void nlOff( istype & ); // scan newline 317 int fmt( istype &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) )); 318 istype & ungetc( char, istype & ); 319 bool eof( istype & ); 320 void clearerr( istype & ); 321 }; // basic_istream 347 basic_istream_data(istype) const & basic_istream_table; 348 }; 322 349 323 350 forall( istype & | basic_istream( istype ) ) 324 351 trait istream { 325 bool fail( istype & ); 326 void open( istype & is, const char name[], const char mode[] ); 327 void open( istype & is, const char name[] ); 328 void close( istype & is ); 329 istype & read( istype &, char [], size_t ); 330 }; // istream 352 istream_data(istype) const & istream_table; 353 }; 331 354 332 355 forall( T )
Note:
See TracChangeset
for help on using the changeset viewer.