]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wfstream.h | |
e54c96f1 | 3 | // Purpose: interface of wxTempFileOutputStream |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxTempFileOutputStream | |
11 | @wxheader{wfstream.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | wxTempFileOutputStream is an output stream based on wxTempFile. It |
14 | provides a relatively safe way to replace the contents of the | |
15 | existing file. | |
7c913512 | 16 | |
23324ae1 FM |
17 | @library{wxbase} |
18 | @category{streams} | |
7c913512 | 19 | |
e54c96f1 | 20 | @see wxTempFile |
23324ae1 FM |
21 | */ |
22 | class wxTempFileOutputStream : public wxOutputStream | |
23 | { | |
24 | public: | |
25 | /** | |
26 | Associates wxTempFileOutputStream with the file to be replaced and opens it. | |
7c913512 | 27 | You should use |
23324ae1 | 28 | wxStreamBase::IsOk to verify if the constructor succeeded. |
23324ae1 | 29 | Call Commit() or wxOutputStream::Close to |
7c913512 | 30 | replace the old file and close this one. Calling Discard() |
23324ae1 FM |
31 | (or allowing the destructor to do it) will discard the changes. |
32 | */ | |
33 | wxTempFileOutputStream(const wxString& fileName); | |
34 | ||
35 | /** | |
36 | Validate changes: deletes the old file of the given name and renames the new | |
37 | file to the old name. Returns @true if both actions succeeded. If @false is | |
38 | returned it may unfortunately mean two quite different things: either that | |
39 | either the old file couldn't be deleted or that the new file couldn't be renamed | |
40 | to the old name. | |
41 | */ | |
42 | bool Commit(); | |
43 | ||
44 | /** | |
45 | Discard changes: the old file contents are not changed, the temporary file is | |
46 | deleted. | |
47 | */ | |
48 | void Discard(); | |
49 | }; | |
50 | ||
51 | ||
e54c96f1 | 52 | |
23324ae1 FM |
53 | /** |
54 | @class wxFFileOutputStream | |
55 | @wxheader{wfstream.h} | |
7c913512 | 56 | |
23324ae1 | 57 | This class represents data written to a file. There are actually |
7c913512 | 58 | two such groups of classes: this one is based on wxFFile |
23324ae1 FM |
59 | whereas wxFileInputStream is based in |
60 | the wxFile class. | |
7c913512 FM |
61 | |
62 | Note that wxOutputStream::SeekO | |
63 | can seek beyond the end of the stream (file) and will thus not return | |
23324ae1 | 64 | @e wxInvalidOffset for that. |
7c913512 | 65 | |
23324ae1 FM |
66 | @library{wxbase} |
67 | @category{streams} | |
7c913512 | 68 | |
e54c96f1 | 69 | @see wxBufferedOutputStream, wxFFileInputStream, wxFileInputStream |
23324ae1 FM |
70 | */ |
71 | class wxFFileOutputStream : public wxOutputStream | |
72 | { | |
73 | public: | |
74 | //@{ | |
75 | /** | |
76 | Initializes a file stream in write-only mode using the file descriptor @e fp. | |
77 | */ | |
78 | wxFFileOutputStream(const wxString& filename, | |
4cc4bfaf | 79 | const wxString& mode = "w+b"); |
7c913512 | 80 | wxFFileOutputStream(wxFFile& file); |
4cc4bfaf | 81 | wxFFileOutputStream(FILE* fp); |
23324ae1 FM |
82 | //@} |
83 | ||
84 | /** | |
85 | Destructor. | |
86 | */ | |
87 | ~wxFFileOutputStream(); | |
88 | ||
89 | /** | |
90 | Returns @true if the stream is initialized and ready. | |
91 | */ | |
328f5751 | 92 | bool IsOk() const; |
23324ae1 FM |
93 | }; |
94 | ||
95 | ||
e54c96f1 | 96 | |
23324ae1 FM |
97 | /** |
98 | @class wxFileOutputStream | |
99 | @wxheader{wfstream.h} | |
7c913512 | 100 | |
23324ae1 | 101 | This class represents data written to a file. There are actually |
7c913512 | 102 | two such groups of classes: this one is based on wxFile |
23324ae1 FM |
103 | whereas wxFFileInputStream is based in |
104 | the wxFFile class. | |
7c913512 FM |
105 | |
106 | Note that wxOutputStream::SeekO | |
107 | can seek beyond the end of the stream (file) and will thus not return | |
23324ae1 | 108 | @e wxInvalidOffset for that. |
7c913512 | 109 | |
23324ae1 FM |
110 | @library{wxbase} |
111 | @category{streams} | |
7c913512 | 112 | |
e54c96f1 | 113 | @see wxBufferedOutputStream, wxFileInputStream, wxFFileInputStream |
23324ae1 FM |
114 | */ |
115 | class wxFileOutputStream : public wxOutputStream | |
116 | { | |
117 | public: | |
118 | //@{ | |
119 | /** | |
120 | Initializes a file stream in write-only mode using the file descriptor @e fd. | |
121 | */ | |
122 | wxFileOutputStream(const wxString& ofileName); | |
7c913512 FM |
123 | wxFileOutputStream(wxFile& file); |
124 | wxFileOutputStream(int fd); | |
23324ae1 FM |
125 | //@} |
126 | ||
127 | /** | |
128 | Destructor. | |
129 | */ | |
130 | ~wxFileOutputStream(); | |
131 | ||
132 | /** | |
133 | Returns @true if the stream is initialized and ready. | |
134 | */ | |
328f5751 | 135 | bool IsOk() const; |
23324ae1 FM |
136 | }; |
137 | ||
138 | ||
e54c96f1 | 139 | |
23324ae1 FM |
140 | /** |
141 | @class wxFileInputStream | |
142 | @wxheader{wfstream.h} | |
7c913512 | 143 | |
23324ae1 | 144 | This class represents data read in from a file. There are actually |
7c913512 | 145 | two such groups of classes: this one is based on wxFile |
23324ae1 FM |
146 | whereas wxFFileInputStream is based in |
147 | the wxFFile class. | |
7c913512 FM |
148 | |
149 | Note that wxInputStream::SeekI | |
150 | can seek beyond the end of the stream (file) and will thus not return | |
23324ae1 | 151 | @e wxInvalidOffset for that. |
7c913512 | 152 | |
23324ae1 FM |
153 | @library{wxbase} |
154 | @category{streams} | |
7c913512 | 155 | |
e54c96f1 | 156 | @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream |
23324ae1 FM |
157 | */ |
158 | class wxFileInputStream : public wxInputStream | |
159 | { | |
160 | public: | |
161 | //@{ | |
162 | /** | |
163 | Initializes a file stream in read-only mode using the specified file descriptor. | |
164 | */ | |
165 | wxFileInputStream(const wxString& ifileName); | |
7c913512 FM |
166 | wxFileInputStream(wxFile& file); |
167 | wxFileInputStream(int fd); | |
23324ae1 FM |
168 | //@} |
169 | ||
170 | /** | |
171 | Destructor. | |
172 | */ | |
173 | ~wxFileInputStream(); | |
174 | ||
175 | /** | |
176 | Returns @true if the stream is initialized and ready. | |
177 | */ | |
328f5751 | 178 | bool IsOk() const; |
23324ae1 FM |
179 | }; |
180 | ||
181 | ||
e54c96f1 | 182 | |
23324ae1 FM |
183 | /** |
184 | @class wxFFileInputStream | |
185 | @wxheader{wfstream.h} | |
7c913512 | 186 | |
23324ae1 | 187 | This class represents data read in from a file. There are actually |
7c913512 | 188 | two such groups of classes: this one is based on wxFFile |
23324ae1 FM |
189 | whereas wxFileInputStream is based in |
190 | the wxFile class. | |
7c913512 FM |
191 | |
192 | Note that wxInputStream::SeekI | |
193 | can seek beyond the end of the stream (file) and will thus not return | |
23324ae1 | 194 | @e wxInvalidOffset for that. |
7c913512 | 195 | |
23324ae1 FM |
196 | @library{wxbase} |
197 | @category{streams} | |
7c913512 | 198 | |
e54c96f1 | 199 | @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream |
23324ae1 FM |
200 | */ |
201 | class wxFFileInputStream : public wxInputStream | |
202 | { | |
203 | public: | |
204 | //@{ | |
205 | /** | |
206 | Initializes a file stream in read-only mode using the specified file pointer @e | |
207 | fp. | |
208 | */ | |
209 | wxFFileInputStream(const wxString& filename, | |
210 | const wxString& mode = "rb"); | |
7c913512 | 211 | wxFFileInputStream(wxFFile& file); |
4cc4bfaf | 212 | wxFFileInputStream(FILE* fp); |
23324ae1 FM |
213 | //@} |
214 | ||
215 | /** | |
216 | Destructor. | |
217 | */ | |
218 | ~wxFFileInputStream(); | |
219 | ||
220 | /** | |
221 | Returns @true if the stream is initialized and ready. | |
222 | */ | |
328f5751 | 223 | bool IsOk() const; |
23324ae1 FM |
224 | }; |
225 | ||
226 | ||
e54c96f1 | 227 | |
23324ae1 FM |
228 | /** |
229 | @class wxFFileStream | |
230 | @wxheader{wfstream.h} | |
7c913512 FM |
231 | |
232 | ||
23324ae1 FM |
233 | @library{wxbase} |
234 | @category{FIXME} | |
7c913512 | 235 | |
e54c96f1 | 236 | @see wxStreamBuffer |
23324ae1 FM |
237 | */ |
238 | class wxFFileStream : public wxFFileOutputStream | |
239 | { | |
240 | public: | |
241 | /** | |
7c913512 | 242 | Initializes a new file stream in read-write mode using the specified |
23324ae1 FM |
243 | @e iofilename name. |
244 | */ | |
245 | wxFFileStream(const wxString& iofileName); | |
246 | }; | |
247 | ||
248 | ||
e54c96f1 | 249 | |
23324ae1 FM |
250 | /** |
251 | @class wxFileStream | |
252 | @wxheader{wfstream.h} | |
7c913512 FM |
253 | |
254 | ||
23324ae1 FM |
255 | @library{wxbase} |
256 | @category{FIXME} | |
7c913512 | 257 | |
e54c96f1 | 258 | @see wxStreamBuffer |
23324ae1 FM |
259 | */ |
260 | class wxFileStream : public wxFileOutputStream | |
261 | { | |
262 | public: | |
263 | /** | |
7c913512 | 264 | Initializes a new file stream in read-write mode using the specified |
23324ae1 FM |
265 | @e iofilename name. |
266 | */ | |
267 | wxFileStream(const wxString& iofileName); | |
268 | }; | |
e54c96f1 | 269 |