Mercurial > hg > octave-nkf
comparison src/c-file-ptr-stream.h @ 4326:1cae4472c624
[project @ 2003-02-15 23:14:47 by jwe]
author | jwe |
---|---|
date | Sat, 15 Feb 2003 23:14:47 +0000 |
parents | da7226ca8b91 |
children | 19b8225bdaa2 |
comparison
equal
deleted
inserted
replaced
4325:f30803e587ac | 4326:1cae4472c624 |
---|---|
101 | 101 |
102 ~i_c_file_ptr_stream (void) { delete buf; buf = 0; } | 102 ~i_c_file_ptr_stream (void) { delete buf; buf = 0; } |
103 | 103 |
104 c_file_ptr_buf *rdbuf (void) { return buf; } | 104 c_file_ptr_buf *rdbuf (void) { return buf; } |
105 | 105 |
106 void close (void); | 106 void close (void) { if (buf) buf->close (); } |
107 | 107 |
108 private: | 108 private: |
109 | 109 |
110 c_file_ptr_buf *buf; | 110 c_file_ptr_buf *buf; |
111 }; | 111 }; |
121 | 121 |
122 ~o_c_file_ptr_stream (void) { delete buf; buf = 0; } | 122 ~o_c_file_ptr_stream (void) { delete buf; buf = 0; } |
123 | 123 |
124 c_file_ptr_buf *rdbuf (void) { return buf; } | 124 c_file_ptr_buf *rdbuf (void) { return buf; } |
125 | 125 |
126 void close (void); | 126 void close (void) { if (buf) buf->close (); } |
127 | |
128 private: | |
129 | |
130 c_file_ptr_buf *buf; | |
131 }; | |
132 | |
133 class | |
134 io_c_file_ptr_stream : public std::iostream | |
135 { | |
136 public: | |
137 | |
138 io_c_file_ptr_stream (FILE* f, | |
139 c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::fclose) | |
140 : std::iostream (0), buf (new c_file_ptr_buf (f, cf)) { init (buf); } | |
141 | |
142 ~io_c_file_ptr_stream (void) { delete buf; buf = 0; } | |
143 | |
144 c_file_ptr_buf *rdbuf (void) { return buf; } | |
145 | |
146 void close (void) { if (buf) buf->close (); } | |
127 | 147 |
128 private: | 148 private: |
129 | 149 |
130 c_file_ptr_buf *buf; | 150 c_file_ptr_buf *buf; |
131 }; | 151 }; |