]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/wfstream.h
Fix wxWebView documentation warnings.
[wxWidgets.git] / interface / wx / wfstream.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: wfstream.h
e54c96f1 3// Purpose: interface of wxTempFileOutputStream
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxTempFileOutputStream
7c913512 11
e25cd775
FM
12 wxTempFileOutputStream is an output stream based on wxTempFile.
13 It provides a relatively safe way to replace the contents of the
23324ae1 14 existing file.
7c913512 15
23324ae1
FM
16 @library{wxbase}
17 @category{streams}
7c913512 18
e54c96f1 19 @see wxTempFile
23324ae1
FM
20*/
21class wxTempFileOutputStream : public wxOutputStream
22{
23public:
24 /**
25 Associates wxTempFileOutputStream with the file to be replaced and opens it.
9690b006
FM
26
27 @warning
e25cd775
FM
28 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
29
30 Call Commit() or wxOutputStream::Close() to replace the old file and close
31 this one. Calling Discard() (or allowing the destructor to do it) will
32 discard the changes.
23324ae1
FM
33 */
34 wxTempFileOutputStream(const wxString& fileName);
35
36 /**
37 Validate changes: deletes the old file of the given name and renames the new
e25cd775
FM
38 file to the old name. Returns @true if both actions succeeded.
39
40 If @false is returned it may unfortunately mean two quite different things: either that
23324ae1
FM
41 either the old file couldn't be deleted or that the new file couldn't be renamed
42 to the old name.
43 */
adaaa686 44 virtual bool Commit();
23324ae1
FM
45
46 /**
47 Discard changes: the old file contents are not changed, the temporary file is
48 deleted.
49 */
adaaa686 50 virtual void Discard();
23324ae1
FM
51};
52
53
e54c96f1 54
23324ae1
FM
55/**
56 @class wxFFileOutputStream
7c913512 57
e25cd775
FM
58 This class represents data written to a file.
59 There are actually two such groups of classes: this one is based on wxFFile
e4d531ee 60 whereas wxFileOutputStream is based in the wxFile class.
7c913512 61
e25cd775
FM
62 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
63 (file) and will thus not return ::wxInvalidOffset for that.
7c913512 64
23324ae1
FM
65 @library{wxbase}
66 @category{streams}
7c913512 67
e4d531ee 68 @see wxBufferedOutputStream, wxFFileInputStream, wxFileOutputStream, wxFileInputStream
23324ae1
FM
69*/
70class wxFFileOutputStream : public wxOutputStream
71{
72public:
23324ae1 73 /**
9690b006
FM
74 Open the given file @a filename with mode @a mode.
75
76 @warning
77 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1
FM
78 */
79 wxFFileOutputStream(const wxString& filename,
95b4a59e 80 const wxString& mode = "wb");
e25cd775
FM
81
82 /**
83 Initializes a file stream in write-only mode using the file I/O object file.
84 */
7c913512 85 wxFFileOutputStream(wxFFile& file);
e25cd775
FM
86
87 /**
88 Initializes a file stream in write-only mode using the file descriptor fp.
89 */
4cc4bfaf 90 wxFFileOutputStream(FILE* fp);
23324ae1
FM
91
92 /**
93 Destructor.
94 */
adaaa686 95 virtual ~wxFFileOutputStream();
23324ae1
FM
96
97 /**
98 Returns @true if the stream is initialized and ready.
99 */
328f5751 100 bool IsOk() const;
7f297193
VZ
101
102 /**
103 Returns the underlying file object.
104 @since 2.9.5
105 */
106 wxFFile* GetFile() const;
23324ae1
FM
107};
108
109
e54c96f1 110
23324ae1
FM
111/**
112 @class wxFileOutputStream
7c913512 113
e25cd775
FM
114 This class represents data written to a file.
115 There are actually two such groups of classes: this one is based on wxFile
e4d531ee 116 whereas wxFFileOutputStream is based in the wxFFile class.
7c913512 117
e25cd775
FM
118 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
119 (file) and will thus not return ::wxInvalidOffset for that.
7c913512 120
23324ae1
FM
121 @library{wxbase}
122 @category{streams}
7c913512 123
e4d531ee 124 @see wxBufferedOutputStream, wxFileInputStream, wxFFileOutputStream, wxFFileInputStream
23324ae1
FM
125*/
126class wxFileOutputStream : public wxOutputStream
127{
128public:
23324ae1 129 /**
9690b006 130 Creates a new file with @a ofileName name and initializes the stream in write-only mode.
3e97b550 131
9690b006
FM
132 @warning
133 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1
FM
134 */
135 wxFileOutputStream(const wxString& ofileName);
e25cd775
FM
136
137 /**
138 Initializes a file stream in write-only mode using the file I/O object file.
139 */
7c913512 140 wxFileOutputStream(wxFile& file);
e25cd775
FM
141
142 /**
143 Initializes a file stream in write-only mode using the file descriptor @e fd.
144 */
7c913512 145 wxFileOutputStream(int fd);
23324ae1
FM
146
147 /**
148 Destructor.
149 */
adaaa686 150 virtual ~wxFileOutputStream();
23324ae1
FM
151
152 /**
153 Returns @true if the stream is initialized and ready.
154 */
328f5751 155 bool IsOk() const;
7f297193
VZ
156
157 /**
158 Returns the underlying file object.
159 @since 2.9.5
160 */
161 wxFile* GetFile() const;
23324ae1
FM
162};
163
164
e54c96f1 165
23324ae1
FM
166/**
167 @class wxFileInputStream
7c913512 168
e25cd775
FM
169 This class represents data read in from a file.
170 There are actually two such groups of classes: this one is based on wxFile
171 whereas wxFFileInputStream is based in the wxFFile class.
7c913512 172
e25cd775
FM
173 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
174 and will thus not return ::wxInvalidOffset for that.
7c913512 175
23324ae1
FM
176 @library{wxbase}
177 @category{streams}
7c913512 178
e54c96f1 179 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
23324ae1
FM
180*/
181class wxFileInputStream : public wxInputStream
182{
183public:
23324ae1 184 /**
9690b006 185 Opens the specified file using its @a ifileName name in read-only mode.
3e97b550 186
9690b006
FM
187 @warning
188 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1
FM
189 */
190 wxFileInputStream(const wxString& ifileName);
e25cd775
FM
191
192 /**
193 Initializes a file stream in read-only mode using the file I/O object file.
194 */
7c913512 195 wxFileInputStream(wxFile& file);
e25cd775
FM
196
197 /**
198 Initializes a file stream in read-only mode using the specified file descriptor.
199 */
7c913512 200 wxFileInputStream(int fd);
23324ae1
FM
201
202 /**
203 Destructor.
204 */
adaaa686 205 virtual ~wxFileInputStream();
23324ae1
FM
206
207 /**
208 Returns @true if the stream is initialized and ready.
209 */
328f5751 210 bool IsOk() const;
7f297193
VZ
211
212 /**
213 Returns the underlying file object.
214 @since 2.9.5
215 */
216 wxFile* GetFile() const;
23324ae1
FM
217};
218
219
e54c96f1 220
23324ae1
FM
221/**
222 @class wxFFileInputStream
7c913512 223
e25cd775
FM
224 This class represents data read in from a file.
225 There are actually two such groups of classes: this one is based on wxFFile
226 whereas wxFileInputStream is based in the wxFile class.
7c913512 227
e25cd775
FM
228 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
229 and will thus not return ::wxInvalidOffset for that.
7c913512 230
23324ae1
FM
231 @library{wxbase}
232 @category{streams}
7c913512 233
e54c96f1 234 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
23324ae1
FM
235*/
236class wxFFileInputStream : public wxInputStream
237{
238public:
23324ae1 239 /**
9690b006
FM
240 Opens the specified file using its @a filename name using the specified @a mode.
241
242 @warning
243 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1
FM
244 */
245 wxFFileInputStream(const wxString& filename,
246 const wxString& mode = "rb");
e25cd775
FM
247
248 /**
249 Initializes a file stream in read-only mode using the file I/O object file.
250 */
7c913512 251 wxFFileInputStream(wxFFile& file);
e25cd775
FM
252
253 /**
254 Initializes a file stream in read-only mode using the specified file pointer @a fp.
255 */
4cc4bfaf 256 wxFFileInputStream(FILE* fp);
23324ae1
FM
257
258 /**
259 Destructor.
260 */
adaaa686 261 virtual ~wxFFileInputStream();
23324ae1
FM
262
263 /**
264 Returns @true if the stream is initialized and ready.
265 */
328f5751 266 bool IsOk() const;
7f297193
VZ
267
268 /**
269 Returns the underlying file object.
270 @since 2.9.5
271 */
272 wxFFile* GetFile() const;
23324ae1
FM
273};
274
275
e54c96f1 276
23324ae1
FM
277/**
278 @class wxFFileStream
7c913512 279
3e97b550
VZ
280 This stream allows to both read from and write to a file using buffered
281 STDIO functions.
7c913512 282
23324ae1 283 @library{wxbase}
e25cd775 284 @category{streams}
7c913512 285
3e97b550 286 @see wxFFileInputStream, wxFFileOutputStream, wxFileStream
23324ae1 287*/
3e97b550
VZ
288class wxFFileStream : public wxFFileInputStream,
289 public wxFFileOutputStream
23324ae1
FM
290{
291public:
292 /**
9690b006
FM
293 Initializes a new file stream in the given @a mode using the specified
294 @a iofileName name.
3e97b550 295
9690b006
FM
296 @warning
297 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1 298 */
02e22828 299 wxFFileStream(const wxString& iofileName, const wxString& mode = "w+b");
3e97b550
VZ
300
301 /**
302 Returns @true if the stream is initialized and ready.
303
304 This method returns @true if the stream can be both read from and
305 written to.
306 */
307 bool IsOk() const;
23324ae1
FM
308};
309
310
e54c96f1 311
23324ae1
FM
312/**
313 @class wxFileStream
7c913512 314
3e97b550
VZ
315 This class represents data that can be both read from and written to a file.
316 There are actually two such groups of classes: this one is based on wxFile
317 whereas wxFFileStream is based in the wxFFile class.
7c913512 318
23324ae1 319 @library{wxbase}
e25cd775 320 @category{streams}
7c913512 321
3e97b550 322 @see wxFileInputStream, wxFileOutputStream, wxFFileStream
23324ae1 323*/
3e97b550
VZ
324class wxFileStream : public wxFileOutputStream,
325 public wxFileInputStream
23324ae1
FM
326{
327public:
328 /**
7c913512 329 Initializes a new file stream in read-write mode using the specified
9690b006 330 @a iofileName name.
3e97b550 331
9690b006 332 @warning
3e97b550 333 You should use IsOk() to verify if the constructor succeeded.
23324ae1
FM
334 */
335 wxFileStream(const wxString& iofileName);
3e97b550
VZ
336
337 /**
338 Returns @true if the stream is initialized and ready.
339
340 This method returns @true if the stream can be both read from and
341 written to.
342 */
343 bool IsOk() const;
23324ae1 344};
e54c96f1 345