]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/wfstream.h
Fixed drawing a check box in the undetermined state for non-themed MSW apps.
[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;
23324ae1
FM
101};
102
103
e54c96f1 104
23324ae1
FM
105/**
106 @class wxFileOutputStream
7c913512 107
e25cd775
FM
108 This class represents data written to a file.
109 There are actually two such groups of classes: this one is based on wxFile
e4d531ee 110 whereas wxFFileOutputStream is based in the wxFFile class.
7c913512 111
e25cd775
FM
112 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
113 (file) and will thus not return ::wxInvalidOffset for that.
7c913512 114
23324ae1
FM
115 @library{wxbase}
116 @category{streams}
7c913512 117
e4d531ee 118 @see wxBufferedOutputStream, wxFileInputStream, wxFFileOutputStream, wxFFileInputStream
23324ae1
FM
119*/
120class wxFileOutputStream : public wxOutputStream
121{
122public:
23324ae1 123 /**
9690b006 124 Creates a new file with @a ofileName name and initializes the stream in write-only mode.
3e97b550 125
9690b006
FM
126 @warning
127 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1
FM
128 */
129 wxFileOutputStream(const wxString& ofileName);
e25cd775
FM
130
131 /**
132 Initializes a file stream in write-only mode using the file I/O object file.
133 */
7c913512 134 wxFileOutputStream(wxFile& file);
e25cd775
FM
135
136 /**
137 Initializes a file stream in write-only mode using the file descriptor @e fd.
138 */
7c913512 139 wxFileOutputStream(int fd);
23324ae1
FM
140
141 /**
142 Destructor.
143 */
adaaa686 144 virtual ~wxFileOutputStream();
23324ae1
FM
145
146 /**
147 Returns @true if the stream is initialized and ready.
148 */
328f5751 149 bool IsOk() const;
23324ae1
FM
150};
151
152
e54c96f1 153
23324ae1
FM
154/**
155 @class wxFileInputStream
7c913512 156
e25cd775
FM
157 This class represents data read in from a file.
158 There are actually two such groups of classes: this one is based on wxFile
159 whereas wxFFileInputStream is based in the wxFFile class.
7c913512 160
e25cd775
FM
161 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
162 and will thus not return ::wxInvalidOffset for that.
7c913512 163
23324ae1
FM
164 @library{wxbase}
165 @category{streams}
7c913512 166
e54c96f1 167 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
23324ae1
FM
168*/
169class wxFileInputStream : public wxInputStream
170{
171public:
23324ae1 172 /**
9690b006 173 Opens the specified file using its @a ifileName name in read-only mode.
3e97b550 174
9690b006
FM
175 @warning
176 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1
FM
177 */
178 wxFileInputStream(const wxString& ifileName);
e25cd775
FM
179
180 /**
181 Initializes a file stream in read-only mode using the file I/O object file.
182 */
7c913512 183 wxFileInputStream(wxFile& file);
e25cd775
FM
184
185 /**
186 Initializes a file stream in read-only mode using the specified file descriptor.
187 */
7c913512 188 wxFileInputStream(int fd);
23324ae1
FM
189
190 /**
191 Destructor.
192 */
adaaa686 193 virtual ~wxFileInputStream();
23324ae1
FM
194
195 /**
196 Returns @true if the stream is initialized and ready.
197 */
328f5751 198 bool IsOk() const;
23324ae1
FM
199};
200
201
e54c96f1 202
23324ae1
FM
203/**
204 @class wxFFileInputStream
7c913512 205
e25cd775
FM
206 This class represents data read in from a file.
207 There are actually two such groups of classes: this one is based on wxFFile
208 whereas wxFileInputStream is based in the wxFile class.
7c913512 209
e25cd775
FM
210 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
211 and will thus not return ::wxInvalidOffset for that.
7c913512 212
23324ae1
FM
213 @library{wxbase}
214 @category{streams}
7c913512 215
e54c96f1 216 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
23324ae1
FM
217*/
218class wxFFileInputStream : public wxInputStream
219{
220public:
23324ae1 221 /**
9690b006
FM
222 Opens the specified file using its @a filename name using the specified @a mode.
223
224 @warning
225 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1
FM
226 */
227 wxFFileInputStream(const wxString& filename,
228 const wxString& mode = "rb");
e25cd775
FM
229
230 /**
231 Initializes a file stream in read-only mode using the file I/O object file.
232 */
7c913512 233 wxFFileInputStream(wxFFile& file);
e25cd775
FM
234
235 /**
236 Initializes a file stream in read-only mode using the specified file pointer @a fp.
237 */
4cc4bfaf 238 wxFFileInputStream(FILE* fp);
23324ae1
FM
239
240 /**
241 Destructor.
242 */
adaaa686 243 virtual ~wxFFileInputStream();
23324ae1
FM
244
245 /**
246 Returns @true if the stream is initialized and ready.
247 */
328f5751 248 bool IsOk() const;
23324ae1
FM
249};
250
251
e54c96f1 252
23324ae1
FM
253/**
254 @class wxFFileStream
7c913512 255
3e97b550
VZ
256 This stream allows to both read from and write to a file using buffered
257 STDIO functions.
7c913512 258
23324ae1 259 @library{wxbase}
e25cd775 260 @category{streams}
7c913512 261
3e97b550 262 @see wxFFileInputStream, wxFFileOutputStream, wxFileStream
23324ae1 263*/
3e97b550
VZ
264class wxFFileStream : public wxFFileInputStream,
265 public wxFFileOutputStream
23324ae1
FM
266{
267public:
268 /**
9690b006
FM
269 Initializes a new file stream in the given @a mode using the specified
270 @a iofileName name.
3e97b550 271
9690b006
FM
272 @warning
273 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1 274 */
02e22828 275 wxFFileStream(const wxString& iofileName, const wxString& mode = "w+b");
3e97b550
VZ
276
277 /**
278 Returns @true if the stream is initialized and ready.
279
280 This method returns @true if the stream can be both read from and
281 written to.
282 */
283 bool IsOk() const;
23324ae1
FM
284};
285
286
e54c96f1 287
23324ae1
FM
288/**
289 @class wxFileStream
7c913512 290
3e97b550
VZ
291 This class represents data that can be both read from and written to a file.
292 There are actually two such groups of classes: this one is based on wxFile
293 whereas wxFFileStream is based in the wxFFile class.
7c913512 294
23324ae1 295 @library{wxbase}
e25cd775 296 @category{streams}
7c913512 297
3e97b550 298 @see wxFileInputStream, wxFileOutputStream, wxFFileStream
23324ae1 299*/
3e97b550
VZ
300class wxFileStream : public wxFileOutputStream,
301 public wxFileInputStream
23324ae1
FM
302{
303public:
304 /**
7c913512 305 Initializes a new file stream in read-write mode using the specified
9690b006 306 @a iofileName name.
3e97b550 307
9690b006 308 @warning
3e97b550 309 You should use IsOk() to verify if the constructor succeeded.
23324ae1
FM
310 */
311 wxFileStream(const wxString& iofileName);
3e97b550
VZ
312
313 /**
314 Returns @true if the stream is initialized and ready.
315
316 This method returns @true if the stream can be both read from and
317 written to.
318 */
319 bool IsOk() const;
23324ae1 320};
e54c96f1 321