Changes in libcfa/src/fstream.hfa [f451177:d0502a3]
- File:
-
- 1 edited
-
libcfa/src/fstream.hfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.hfa
rf451177 rd0502a3 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Apr 27 22:00:30 202113 // Update Count : 22612 // Last Modified On : Fri Jun 19 16:29:17 2020 13 // Update Count : 189 14 14 // 15 15 16 16 #pragma once 17 17 18 #include "bits/weakso_locks.hfa" // mutex_lock18 #include "bits/weakso_locks.hfa" 19 19 #include "iostream.hfa" 20 20 #include <exception.hfa> … … 24 24 25 25 26 enum { ofstream_sepSize = 16 };26 enum { 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$[ofstream_sepSize]; 36 char tupleSeparator$[ofstream_sepSize]; 37 multiple_acquisition_lock lock$; 38 bool acquired$; 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; 39 38 }; // ofstream 40 39 41 // Satisfies ostream42 43 40 // private 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 );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 ); 54 51 55 52 // public … … 66 63 void sepSetTuple( ofstream &, const char [] ); 67 64 68 void ends( ofstream & ); 69 int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) )); 70 71 bool fail( ofstream & ); 65 void ends( ofstream & os ); 66 int fail( ofstream & ); 72 67 int flush( ofstream & ); 73 void open( ofstream &, const char name[], const char mode[] ); // FIX ME: use default = "w"68 void open( ofstream &, const char name[], const char mode[] ); 74 69 void open( ofstream &, const char name[] ); 75 70 void close( ofstream & ); 76 71 ofstream & write( ofstream &, const char data[], size_t size ); 72 int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) )); 77 73 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 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 ); 96 78 97 79 extern ofstream & sout, & stdout, & serr, & stderr; // aliases … … 103 85 104 86 struct ifstream { 105 void * file$; 106 bool nlOnOff$; 107 multiple_acquisition_lock lock$; 108 bool acquired$; 87 void * $file; 88 bool $nlOnOff; 109 89 }; // ifstream 110 111 // Satisfies istream112 90 113 91 // public … … 115 93 void nlOff( ifstream & ); 116 94 bool getANL( ifstream & ); 117 void ends( ifstream & ); 118 int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) )); 119 120 bool fail( ifstream & is ); 95 int fail( ifstream & is ); 121 96 int eof( ifstream & is ); 122 void open( ifstream & is, const char name[], const char mode[] ); // FIX ME: use default = "r"97 void open( ifstream & is, const char name[], const char mode[] ); 123 98 void open( ifstream & is, const char name[] ); 124 99 void close( ifstream & is ); 125 100 ifstream & read( ifstream & is, char * data, size_t size ); 126 101 ifstream & ungetc( ifstream & is, char c ); 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 ); 102 int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) )); 136 103 137 104 void ?{}( ifstream & is ); 138 void ?{}( ifstream & is, const char name[], const char mode[] ); // FIX ME: use default = "r"105 void ?{}( ifstream & is, const char name[], const char mode[] ); 139 106 void ?{}( ifstream & is, const char name[] ); 140 107 void ^?{}( ifstream & is ); … … 146 113 147 114 148 EHM_EXCEPTION(Open_Failure)(115 DATA_EXCEPTION(Open_Failure)( 149 116 union { 150 117 ofstream * ostream; … … 155 122 ); 156 123 157 void ?{}( Open_Failure & this, ofstream & );158 void ?{}( Open_Failure & this, ifstream & );124 void ?{}( Open_Failure & this, ofstream & ostream ); 125 void ?{}( Open_Failure & this, ifstream & istream ); 159 126 160 127 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.