Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.hfa

    r467c8b7 rfd54fef  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jan 16 11:24:48 2021
    13 // Update Count     : 351
     12// Last Modified On : Tue Aug 11 22:16:14 2020
     13// Update Count     : 350
    1414//
    1515
     
    2222
    2323
    24 trait ostream( dtype ostype ) {
     24trait ostream( ostype & ) {
    2525        // private
    2626        bool $sepPrt( ostype & );                                                       // get separator state (on/off)
     
    4141        void nlOn( ostype & );                                                          // turn auto-newline state on
    4242        void nlOff( ostype & );                                                         // turn auto-newline state off
    43         void acquire( ostype & );                                                       // acquire mutex lock
    4443
    4544        const char * sepGet( ostype & );                                        // get separator string
     
    5756}; // ostream
    5857
    59 // trait writeable( otype T ) {
    60 //      forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype &, T );
     58// trait writeable( T ) {
     59//      forall( ostype & | ostream( ostype ) ) ostype & ?|?( ostype &, T );
    6160// }; // writeable
    6261
    63 trait writeable( otype T, dtype ostype | ostream( ostype ) ) {
     62trait writeable( T, ostype & | ostream( ostype ) ) {
    6463        ostype & ?|?( ostype &, T );
    6564}; // writeable
     
    6766// implement writable for intrinsic types
    6867
    69 forall( dtype ostype | ostream( ostype ) ) {
     68forall( ostype & | ostream( ostype ) ) {
    7069        ostype & ?|?( ostype &, bool );
    7170        void ?|?( ostype &, bool );
     
    138137        ostype & nlOn( ostype & );
    139138        ostype & nlOff( ostype & );
    140         ostype & acquire( ostype & );
    141139} // distribution
    142140
    143141// tuples
    144 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     142forall( ostype &, T, Params... | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
    145143        ostype & ?|?( ostype & os, T arg, Params rest );
    146144        void ?|?( ostype & os, T arg, Params rest );
     
    148146
    149147// writes the range [begin, end) to the given stream
    150 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     148forall( ostype &, elt_type | writeable( elt_type, ostype ), iterator_type | iterator( iterator_type, elt_type ) ) {
    151149        void write( iterator_type begin, iterator_type end, ostype & os );
    152150        void write_reverse( iterator_type begin, iterator_type end, ostype & os );
     
    155153// *********************************** manipulators ***********************************
    156154
    157 forall( otype T )
     155forall( T )
    158156struct _Ostream_Manip {
    159157        T val;                                                                                          // polymorphic base-type
     
    195193        _Ostream_Manip(T) & sign( _Ostream_Manip(T) & fmt ) { fmt.flags.sign = true; return fmt; } \
    196194} /* distribution */ \
    197 forall( dtype ostype | ostream( ostype ) ) { \
     195forall( ostype & | ostream( ostype ) ) { \
    198196        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \
    199197        void ?|?( ostype & os, _Ostream_Manip(T) f ); \
     
    236234        _Ostream_Manip(T) & nodp( _Ostream_Manip(T) & fmt ) { fmt.flags.nobsdp = true; return fmt; } \
    237235} /* distribution */ \
    238 forall( dtype ostype | ostream( ostype ) ) { \
     236forall( ostype & | ostream( ostype ) ) { \
    239237        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \
    240238        void ?|?( ostype & os, _Ostream_Manip(T) f ); \
     
    256254        _Ostream_Manip(char) & nobase( _Ostream_Manip(char) & fmt ) { fmt.flags.nobsdp = true; return fmt; }
    257255} // distribution
    258 forall( dtype ostype | ostream( ostype ) ) {
     256forall( ostype & | ostream( ostype ) ) {
    259257        ostype & ?|?( ostype & os, _Ostream_Manip(char) f );
    260258        void ?|?( ostype & os, _Ostream_Manip(char) f );
     
    274272        _Ostream_Manip(const char *) & nobase( _Ostream_Manip(const char *) & fmt ) { fmt.flags.nobsdp = true; return fmt; }
    275273} // distribution
    276 forall( dtype ostype | ostream( ostype ) ) {
     274forall( ostype & | ostream( ostype ) ) {
    277275        ostype & ?|?( ostype & os, _Ostream_Manip(const char *) f );
    278276        void ?|?( ostype & os, _Ostream_Manip(const char *) f );
     
    283281
    284282
    285 trait istream( dtype istype ) {
     283trait istream( istype & ) {
    286284        void nlOn( istype & );                                                          // read newline
    287285        void nlOff( istype & );                                                         // scan newline
     
    296294}; // istream
    297295
    298 trait readable( otype T ) {
    299         forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, T );
     296trait readable( T ) {
     297        forall( istype & | istream( istype ) ) istype & ?|?( istype &, T );
    300298}; // readable
    301299
    302 forall( dtype istype | istream( istype ) ) {
     300forall( istype & | istream( istype ) ) {
    303301        istype & ?|?( istype &, bool & );
    304302
     
    365363        _Istream_Cstr & wdi( unsigned int w, _Istream_Cstr & fmt ) { fmt.wd = w; return fmt; }
    366364} // distribution
    367 forall( dtype istype | istream( istype ) ) istype & ?|?( istype & is, _Istream_Cstr f );
     365forall( istype & | istream( istype ) ) istype & ?|?( istype & is, _Istream_Cstr f );
    368366
    369367struct _Istream_Char {
     
    375373        _Istream_Char & ignore( _Istream_Char & fmt ) { fmt.ignore = true; return fmt; }
    376374} // distribution
    377 forall( dtype istype | istream( istype ) ) istype & ?|?( istype & is, _Istream_Char f );
    378 
    379 forall( dtype T | sized( T ) )
     375forall( istype & | istream( istype ) ) istype & ?|?( istype & is, _Istream_Char f );
     376
     377forall( T & | sized( T ) )
    380378struct _Istream_Manip {
    381379        T & val;                                                                                        // polymorphic base-type
     
    391389        _Istream_Manip(T) & wdi( unsigned int w, _Istream_Manip(T) & fmt ) { fmt.wd = w; return fmt; } \
    392390} /* distribution */ \
    393 forall( dtype istype | istream( istype ) ) { \
     391forall( istype & | istream( istype ) ) { \
    394392        istype & ?|?( istype & is, _Istream_Manip(T) f ); \
    395393} // ?|?
     
    420418#include <time_t.hfa>                                                                   // Duration (constructors) / Time (constructors)
    421419
    422 forall( dtype ostype | ostream( ostype ) ) {
     420forall( ostype & | ostream( ostype ) ) {
    423421        ostype & ?|?( ostype & os, Duration dur );
    424422        void ?|?( ostype & os, Duration dur );
Note: See TracChangeset for help on using the changeset viewer.