Changeset fd54fef for libcfa/src/iostream.hfa
- Timestamp:
- Jan 19, 2021, 8:44:29 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- dafbde8
- Parents:
- 2f47ea4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.hfa
r2f47ea4 rfd54fef 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) … … 56 56 }; // ostream 57 57 58 // trait writeable( otypeT ) {59 // forall( dtype ostype| ostream( ostype ) ) ostype & ?|?( ostype &, T );58 // trait writeable( T ) { 59 // forall( ostype & | ostream( ostype ) ) ostype & ?|?( ostype &, T ); 60 60 // }; // writeable 61 61 62 trait writeable( otype T, dtype ostype| ostream( ostype ) ) {62 trait writeable( T, ostype & | ostream( ostype ) ) { 63 63 ostype & ?|?( ostype &, T ); 64 64 }; // writeable … … 66 66 // implement writable for intrinsic types 67 67 68 forall( dtype ostype| ostream( ostype ) ) {68 forall( ostype & | ostream( ostype ) ) { 69 69 ostype & ?|?( ostype &, bool ); 70 70 void ?|?( ostype &, bool ); … … 140 140 141 141 // tuples 142 forall( dtype ostype, otype T, ttype Params| writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {142 forall( ostype &, T, Params... | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) { 143 143 ostype & ?|?( ostype & os, T arg, Params rest ); 144 144 void ?|?( ostype & os, T arg, Params rest ); … … 146 146 147 147 // writes the range [begin, end) to the given stream 148 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 ) ) { 149 149 void write( iterator_type begin, iterator_type end, ostype & os ); 150 150 void write_reverse( iterator_type begin, iterator_type end, ostype & os ); … … 153 153 // *********************************** manipulators *********************************** 154 154 155 forall( otypeT )155 forall( T ) 156 156 struct _Ostream_Manip { 157 157 T val; // polymorphic base-type … … 193 193 _Ostream_Manip(T) & sign( _Ostream_Manip(T) & fmt ) { fmt.flags.sign = true; return fmt; } \ 194 194 } /* distribution */ \ 195 forall( dtype ostype| ostream( ostype ) ) { \195 forall( ostype & | ostream( ostype ) ) { \ 196 196 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \ 197 197 void ?|?( ostype & os, _Ostream_Manip(T) f ); \ … … 234 234 _Ostream_Manip(T) & nodp( _Ostream_Manip(T) & fmt ) { fmt.flags.nobsdp = true; return fmt; } \ 235 235 } /* distribution */ \ 236 forall( dtype ostype| ostream( ostype ) ) { \236 forall( ostype & | ostream( ostype ) ) { \ 237 237 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \ 238 238 void ?|?( ostype & os, _Ostream_Manip(T) f ); \ … … 254 254 _Ostream_Manip(char) & nobase( _Ostream_Manip(char) & fmt ) { fmt.flags.nobsdp = true; return fmt; } 255 255 } // distribution 256 forall( dtype ostype| ostream( ostype ) ) {256 forall( ostype & | ostream( ostype ) ) { 257 257 ostype & ?|?( ostype & os, _Ostream_Manip(char) f ); 258 258 void ?|?( ostype & os, _Ostream_Manip(char) f ); … … 272 272 _Ostream_Manip(const char *) & nobase( _Ostream_Manip(const char *) & fmt ) { fmt.flags.nobsdp = true; return fmt; } 273 273 } // distribution 274 forall( dtype ostype| ostream( ostype ) ) {274 forall( ostype & | ostream( ostype ) ) { 275 275 ostype & ?|?( ostype & os, _Ostream_Manip(const char *) f ); 276 276 void ?|?( ostype & os, _Ostream_Manip(const char *) f ); … … 281 281 282 282 283 trait istream( dtype istype) {283 trait istream( istype & ) { 284 284 void nlOn( istype & ); // read newline 285 285 void nlOff( istype & ); // scan newline … … 294 294 }; // istream 295 295 296 trait readable( otypeT ) {297 forall( dtype istype| istream( istype ) ) istype & ?|?( istype &, T );296 trait readable( T ) { 297 forall( istype & | istream( istype ) ) istype & ?|?( istype &, T ); 298 298 }; // readable 299 299 300 forall( dtype istype| istream( istype ) ) {300 forall( istype & | istream( istype ) ) { 301 301 istype & ?|?( istype &, bool & ); 302 302 … … 363 363 _Istream_Cstr & wdi( unsigned int w, _Istream_Cstr & fmt ) { fmt.wd = w; return fmt; } 364 364 } // distribution 365 forall( dtype istype| istream( istype ) ) istype & ?|?( istype & is, _Istream_Cstr f );365 forall( istype & | istream( istype ) ) istype & ?|?( istype & is, _Istream_Cstr f ); 366 366 367 367 struct _Istream_Char { … … 373 373 _Istream_Char & ignore( _Istream_Char & fmt ) { fmt.ignore = true; return fmt; } 374 374 } // distribution 375 forall( dtype istype| istream( istype ) ) istype & ?|?( istype & is, _Istream_Char f );376 377 forall( dtype T| sized( T ) )375 forall( istype & | istream( istype ) ) istype & ?|?( istype & is, _Istream_Char f ); 376 377 forall( T & | sized( T ) ) 378 378 struct _Istream_Manip { 379 379 T & val; // polymorphic base-type … … 389 389 _Istream_Manip(T) & wdi( unsigned int w, _Istream_Manip(T) & fmt ) { fmt.wd = w; return fmt; } \ 390 390 } /* distribution */ \ 391 forall( dtype istype| istream( istype ) ) { \391 forall( istype & | istream( istype ) ) { \ 392 392 istype & ?|?( istype & is, _Istream_Manip(T) f ); \ 393 393 } // ?|? … … 418 418 #include <time_t.hfa> // Duration (constructors) / Time (constructors) 419 419 420 forall( dtype ostype| ostream( ostype ) ) {420 forall( ostype & | ostream( ostype ) ) { 421 421 ostype & ?|?( ostype & os, Duration dur ); 422 422 void ?|?( ostype & os, Duration dur );
Note: See TracChangeset
for help on using the changeset viewer.