Changes in libcfa/src/fstream.hfa [8d321f9:4cae032]
- File:
-
- 1 edited
-
libcfa/src/fstream.hfa (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.hfa
r8d321f9 r4cae032 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 : 1 8912 // Last Modified On : Fri Nov 29 06:56:02 2019 13 // Update Count : 168 14 14 // 15 15 … … 17 17 18 18 #include "iostream.hfa" 19 #include <exception.hfa>20 19 21 20 22 // *********************************** ofstream ***********************************21 //*********************************** ofstream *********************************** 23 22 24 23 25 24 enum { sepSize = 16 }; 26 25 struct ofstream { 27 void * $file;28 bool $sepDefault;29 bool $sepOnOff;30 bool $nlOnOff;31 bool $prt; // print text32 bool $sawNL;33 const char * $sepCur;34 char $separator[sepSize];35 char $tupleSeparator[sepSize];26 void * file; 27 bool sepDefault; 28 bool sepOnOff; 29 bool nlOnOff; 30 bool prt; // print text 31 bool sawNL; 32 const char * sepCur; 33 char separator[sepSize]; 34 char tupleSeparator[sepSize]; 36 35 }; // ofstream 37 36 38 37 // private 39 bool $sepPrt( ofstream & );40 void $sepReset( ofstream & );41 void $sepReset( ofstream &, bool );42 const char * $sepGetCur( ofstream & );43 void $sepSetCur( ofstream &, const char []);44 bool $getNL( ofstream & );45 void $setNL( ofstream &, bool );46 bool $getANL( ofstream & );47 bool $getPrt( ofstream & );48 void $setPrt( ofstream &, bool );38 bool sepPrt( ofstream & ); 39 void sepReset( ofstream & ); 40 void sepReset( ofstream &, bool ); 41 const char * sepGetCur( ofstream & ); 42 void sepSetCur( ofstream &, const char * ); 43 bool getNL( ofstream & ); 44 void setNL( ofstream &, bool ); 45 bool getANL( ofstream & ); 46 bool getPrt( ofstream & ); 47 void setPrt( ofstream &, bool ); 49 48 50 49 // public … … 57 56 58 57 const char * sepGet( ofstream & ); 59 void sepSet( ofstream &, const char []);58 void sepSet( ofstream &, const char * ); 60 59 const char * sepGetTuple( ofstream & ); 61 void sepSetTuple( ofstream &, const char []);60 void sepSetTuple( ofstream &, const char * ); 62 61 63 62 void ends( ofstream & os ); 64 63 int fail( ofstream & ); 65 64 int flush( ofstream & ); 66 void open( ofstream &, const char name[], const char mode[]);67 void open( ofstream &, const char name[]);65 void open( ofstream &, const char * name, const char * mode ); 66 void open( ofstream &, const char * name ); 68 67 void close( ofstream & ); 69 ofstream & write( ofstream &, const char data[], size_t size );70 int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));68 ofstream & write( ofstream &, const char * data, size_t size ); 69 int fmt( ofstream &, const char format[], ... ); 71 70 72 71 void ?{}( ofstream & os ); 73 void ?{}( ofstream & os, const char name[], const char mode[]);74 void ?{}( ofstream & os, const char name[]);72 void ?{}( ofstream & os, const char * name, const char * mode ); 73 void ?{}( ofstream & os, const char * name ); 75 74 void ^?{}( ofstream & os ); 76 75 … … 79 78 80 79 81 // *********************************** ifstream ***********************************80 //*********************************** ifstream *********************************** 82 81 83 82 84 83 struct ifstream { 85 void * $file;86 bool $nlOnOff;84 void * file; 85 bool nlOnOff; 87 86 }; // ifstream 88 87 … … 93 92 int fail( ifstream & is ); 94 93 int eof( ifstream & is ); 95 void open( ifstream & is, const char name[], const char mode[]);96 void open( ifstream & is, const char name[]);94 void open( ifstream & is, const char * name, const char * mode ); 95 void open( ifstream & is, const char * name ); 97 96 void close( ifstream & is ); 98 97 ifstream & read( ifstream & is, char * data, size_t size ); 99 98 ifstream & ungetc( ifstream & is, char c ); 100 int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));99 int fmt( ifstream &, const char format[], ... ); 101 100 102 101 void ?{}( ifstream & is ); 103 void ?{}( ifstream & is, const char name[], const char mode[]);104 void ?{}( ifstream & is, const char name[]);102 void ?{}( ifstream & is, const char * name, const char * mode ); 103 void ?{}( ifstream & is, const char * name ); 105 104 void ^?{}( ifstream & is ); 106 105 107 106 extern ifstream & sin, & stdin; // aliases 108 109 110 // *********************************** exceptions ***********************************111 112 113 DATA_EXCEPTION(Open_Failure)(114 union {115 ofstream * ostream;116 ifstream * istream;117 };118 // TEMPORARY: need polymorphic exceptions119 int tag; // 1 => ostream; 0 => istream120 );121 122 void ?{}( Open_Failure & this, ofstream & ostream );123 void ?{}( Open_Failure & this, ifstream & istream );124 107 125 108 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.