Changes in libcfa/src/iostream.hfa [467c8b7:fd54fef]
- File:
-
- 1 edited
-
libcfa/src/iostream.hfa (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.hfa
r467c8b7 rfd54fef 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jan 16 11:24:48 202113 // Update Count : 35 112 // Last Modified On : Tue Aug 11 22:16:14 2020 13 // Update Count : 350 14 14 // 15 15 … … 22 22 23 23 24 trait ostream( dtype ostype) {24 trait ostream( ostype & ) { 25 25 // private 26 26 bool $sepPrt( ostype & ); // get separator state (on/off) … … 41 41 void nlOn( ostype & ); // turn auto-newline state on 42 42 void nlOff( ostype & ); // turn auto-newline state off 43 void acquire( ostype & ); // acquire mutex lock44 43 45 44 const char * sepGet( ostype & ); // get separator string … … 57 56 }; // ostream 58 57 59 // trait writeable( otypeT ) {60 // forall( dtype ostype| ostream( ostype ) ) ostype & ?|?( ostype &, T );58 // trait writeable( T ) { 59 // forall( ostype & | ostream( ostype ) ) ostype & ?|?( ostype &, T ); 61 60 // }; // writeable 62 61 63 trait writeable( otype T, dtype ostype| ostream( ostype ) ) {62 trait writeable( T, ostype & | ostream( ostype ) ) { 64 63 ostype & ?|?( ostype &, T ); 65 64 }; // writeable … … 67 66 // implement writable for intrinsic types 68 67 69 forall( dtype ostype| ostream( ostype ) ) {68 forall( ostype & | ostream( ostype ) ) { 70 69 ostype & ?|?( ostype &, bool ); 71 70 void ?|?( ostype &, bool ); … … 138 137 ostype & nlOn( ostype & ); 139 138 ostype & nlOff( ostype & ); 140 ostype & acquire( ostype & );141 139 } // distribution 142 140 143 141 // tuples 144 forall( dtype ostype, otype T, ttype Params| writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {142 forall( ostype &, T, Params... | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) { 145 143 ostype & ?|?( ostype & os, T arg, Params rest ); 146 144 void ?|?( ostype & os, T arg, Params rest ); … … 148 146 149 147 // writes the range [begin, end) to the given stream 150 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otypeiterator_type | iterator( iterator_type, elt_type ) ) {148 forall( ostype &, elt_type | writeable( elt_type, ostype ), iterator_type | iterator( iterator_type, elt_type ) ) { 151 149 void write( iterator_type begin, iterator_type end, ostype & os ); 152 150 void write_reverse( iterator_type begin, iterator_type end, ostype & os ); … … 155 153 // *********************************** manipulators *********************************** 156 154 157 forall( otypeT )155 forall( T ) 158 156 struct _Ostream_Manip { 159 157 T val; // polymorphic base-type … … 195 193 _Ostream_Manip(T) & sign( _Ostream_Manip(T) & fmt ) { fmt.flags.sign = true; return fmt; } \ 196 194 } /* distribution */ \ 197 forall( dtype ostype| ostream( ostype ) ) { \195 forall( ostype & | ostream( ostype ) ) { \ 198 196 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \ 199 197 void ?|?( ostype & os, _Ostream_Manip(T) f ); \ … … 236 234 _Ostream_Manip(T) & nodp( _Ostream_Manip(T) & fmt ) { fmt.flags.nobsdp = true; return fmt; } \ 237 235 } /* distribution */ \ 238 forall( dtype ostype| ostream( ostype ) ) { \236 forall( ostype & | ostream( ostype ) ) { \ 239 237 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \ 240 238 void ?|?( ostype & os, _Ostream_Manip(T) f ); \ … … 256 254 _Ostream_Manip(char) & nobase( _Ostream_Manip(char) & fmt ) { fmt.flags.nobsdp = true; return fmt; } 257 255 } // distribution 258 forall( dtype ostype| ostream( ostype ) ) {256 forall( ostype & | ostream( ostype ) ) { 259 257 ostype & ?|?( ostype & os, _Ostream_Manip(char) f ); 260 258 void ?|?( ostype & os, _Ostream_Manip(char) f ); … … 274 272 _Ostream_Manip(const char *) & nobase( _Ostream_Manip(const char *) & fmt ) { fmt.flags.nobsdp = true; return fmt; } 275 273 } // distribution 276 forall( dtype ostype| ostream( ostype ) ) {274 forall( ostype & | ostream( ostype ) ) { 277 275 ostype & ?|?( ostype & os, _Ostream_Manip(const char *) f ); 278 276 void ?|?( ostype & os, _Ostream_Manip(const char *) f ); … … 283 281 284 282 285 trait istream( dtype istype) {283 trait istream( istype & ) { 286 284 void nlOn( istype & ); // read newline 287 285 void nlOff( istype & ); // scan newline … … 296 294 }; // istream 297 295 298 trait readable( otypeT ) {299 forall( dtype istype| istream( istype ) ) istype & ?|?( istype &, T );296 trait readable( T ) { 297 forall( istype & | istream( istype ) ) istype & ?|?( istype &, T ); 300 298 }; // readable 301 299 302 forall( dtype istype| istream( istype ) ) {300 forall( istype & | istream( istype ) ) { 303 301 istype & ?|?( istype &, bool & ); 304 302 … … 365 363 _Istream_Cstr & wdi( unsigned int w, _Istream_Cstr & fmt ) { fmt.wd = w; return fmt; } 366 364 } // distribution 367 forall( dtype istype| istream( istype ) ) istype & ?|?( istype & is, _Istream_Cstr f );365 forall( istype & | istream( istype ) ) istype & ?|?( istype & is, _Istream_Cstr f ); 368 366 369 367 struct _Istream_Char { … … 375 373 _Istream_Char & ignore( _Istream_Char & fmt ) { fmt.ignore = true; return fmt; } 376 374 } // distribution 377 forall( dtype istype| istream( istype ) ) istype & ?|?( istype & is, _Istream_Char f );378 379 forall( dtype T| sized( T ) )375 forall( istype & | istream( istype ) ) istype & ?|?( istype & is, _Istream_Char f ); 376 377 forall( T & | sized( T ) ) 380 378 struct _Istream_Manip { 381 379 T & val; // polymorphic base-type … … 391 389 _Istream_Manip(T) & wdi( unsigned int w, _Istream_Manip(T) & fmt ) { fmt.wd = w; return fmt; } \ 392 390 } /* distribution */ \ 393 forall( dtype istype| istream( istype ) ) { \391 forall( istype & | istream( istype ) ) { \ 394 392 istype & ?|?( istype & is, _Istream_Manip(T) f ); \ 395 393 } // ?|? … … 420 418 #include <time_t.hfa> // Duration (constructors) / Time (constructors) 421 419 422 forall( dtype ostype| ostream( ostype ) ) {420 forall( ostype & | ostream( ostype ) ) { 423 421 ostype & ?|?( ostype & os, Duration dur ); 424 422 void ?|?( ostype & os, Duration dur );
Note:
See TracChangeset
for help on using the changeset viewer.