Changes in libcfa/src/fstream.hfa [d0502a3:f451177]
- File:
-
- 1 edited
-
libcfa/src/fstream.hfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.hfa
rd0502a3 rf451177 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 19 16:29:17 202013 // Update Count : 18912 // Last Modified On : Tue Apr 27 22:00:30 2021 13 // Update Count : 226 14 14 // 15 15 16 16 #pragma once 17 17 18 #include "bits/weakso_locks.hfa" 18 #include "bits/weakso_locks.hfa" // mutex_lock 19 19 #include "iostream.hfa" 20 20 #include <exception.hfa> … … 24 24 25 25 26 enum { sepSize = 16 };26 enum { ofstream_sepSize = 16 }; 27 27 struct ofstream { 28 void * $file; 29 bool $sepDefault; 30 bool $sepOnOff; 31 bool $nlOnOff; 32 bool $prt; // print text 33 bool $sawNL; 34 const char * $sepCur; 35 char $separator[sepSize]; 36 char $tupleSeparator[sepSize]; 37 // multiple_acquisition_lock lock; 28 void * file$; 29 bool sepDefault$; 30 bool sepOnOff$; 31 bool nlOnOff$; 32 bool prt$; // print text 33 bool sawNL$; 34 const char * sepCur$; 35 char separator$[ofstream_sepSize]; 36 char tupleSeparator$[ofstream_sepSize]; 37 multiple_acquisition_lock lock$; 38 bool acquired$; 38 39 }; // ofstream 39 40 41 // Satisfies ostream 42 40 43 // private 41 bool $sepPrt( ofstream & );42 void $sepReset( ofstream & );43 void $sepReset( ofstream &, bool );44 const char * $sepGetCur( ofstream & );45 void $sepSetCur( ofstream &, const char [] );46 bool $getNL( ofstream & );47 void $setNL( ofstream &, bool );48 bool $getANL( ofstream & );49 bool $getPrt( ofstream & );50 void $setPrt( ofstream &, bool );44 bool sepPrt$( ofstream & ); 45 void sepReset$( ofstream & ); 46 void sepReset$( ofstream &, bool ); 47 const char * sepGetCur$( ofstream & ); 48 void sepSetCur$( ofstream &, const char [] ); 49 bool getNL$( ofstream & ); 50 void setNL$( ofstream &, bool ); 51 bool getANL$( ofstream & ); 52 bool getPrt$( ofstream & ); 53 void setPrt$( ofstream &, bool ); 51 54 52 55 // public … … 63 66 void sepSetTuple( ofstream &, const char [] ); 64 67 65 void ends( ofstream & os ); 66 int fail( ofstream & ); 68 void ends( ofstream & ); 69 int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) )); 70 71 bool fail( ofstream & ); 67 72 int flush( ofstream & ); 68 void open( ofstream &, const char name[], const char mode[] ); 73 void open( ofstream &, const char name[], const char mode[] ); // FIX ME: use default = "w" 69 74 void open( ofstream &, const char name[] ); 70 75 void close( ofstream & ); 71 76 ofstream & write( ofstream &, const char data[], size_t size ); 72 int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));73 77 74 void ?{}( ofstream & os ); 75 void ?{}( ofstream & os, const char name[], const char mode[] ); 76 void ?{}( ofstream & os, const char name[] ); 77 void ^?{}( ofstream & os ); 78 void acquire( ofstream & ); 79 void release( ofstream & ); 80 81 struct osacquire { 82 ofstream & os; 83 }; 84 void ?{}( osacquire & acq, ofstream & ); 85 void ^?{}( osacquire & acq ); 86 87 void ?{}( ofstream & ); 88 void ?{}( ofstream &, const char name[], const char mode[] ); // FIX ME: use default = "w" 89 void ?{}( ofstream &, const char name[] ); 90 void ^?{}( ofstream & ); 91 92 // private 93 static inline ofstream & nl$( ofstream & os ) { return nl( os ); } // remember basic_ostream nl 94 // public 95 ofstream & nl( ofstream & os ); // override basic_ostream nl 78 96 79 97 extern ofstream & sout, & stdout, & serr, & stderr; // aliases … … 85 103 86 104 struct ifstream { 87 void * $file; 88 bool $nlOnOff; 105 void * file$; 106 bool nlOnOff$; 107 multiple_acquisition_lock lock$; 108 bool acquired$; 89 109 }; // ifstream 110 111 // Satisfies istream 90 112 91 113 // public … … 93 115 void nlOff( ifstream & ); 94 116 bool getANL( ifstream & ); 95 int fail( ifstream & is ); 117 void ends( ifstream & ); 118 int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) )); 119 120 bool fail( ifstream & is ); 96 121 int eof( ifstream & is ); 97 void open( ifstream & is, const char name[], const char mode[] ); 122 void open( ifstream & is, const char name[], const char mode[] ); // FIX ME: use default = "r" 98 123 void open( ifstream & is, const char name[] ); 99 124 void close( ifstream & is ); 100 125 ifstream & read( ifstream & is, char * data, size_t size ); 101 126 ifstream & ungetc( ifstream & is, char c ); 102 int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) )); 127 128 void acquire( ifstream & is ); 129 void release( ifstream & is ); 130 131 struct isacquire { 132 ifstream & is; 133 }; 134 void ?{}( isacquire & acq, ifstream & is ); 135 void ^?{}( isacquire & acq ); 103 136 104 137 void ?{}( ifstream & is ); 105 void ?{}( ifstream & is, const char name[], const char mode[] ); 138 void ?{}( ifstream & is, const char name[], const char mode[] ); // FIX ME: use default = "r" 106 139 void ?{}( ifstream & is, const char name[] ); 107 140 void ^?{}( ifstream & is ); … … 113 146 114 147 115 DATA_EXCEPTION(Open_Failure)(148 EHM_EXCEPTION(Open_Failure)( 116 149 union { 117 150 ofstream * ostream; … … 122 155 ); 123 156 124 void ?{}( Open_Failure & this, ofstream & ostream);125 void ?{}( Open_Failure & this, ifstream & istream);157 void ?{}( Open_Failure & this, ofstream & ); 158 void ?{}( Open_Failure & this, ifstream & ); 126 159 127 160 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.