]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/wfstream.h
wxSocket::Initialize() and Shutdown() are for main thread only.
[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$
6// Licence: wxWindows license
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
FM
124 Creates a new file with @a ofileName name and initializes the stream in write-only mode.
125
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
FM
173 Opens the specified file using its @a ifileName name in read-only mode.
174
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
e25cd775 256 @todo describe this class.
7c913512 257
23324ae1 258 @library{wxbase}
e25cd775 259 @category{streams}
7c913512 260
e54c96f1 261 @see wxStreamBuffer
23324ae1
FM
262*/
263class wxFFileStream : public wxFFileOutputStream
264{
265public:
266 /**
9690b006
FM
267 Initializes a new file stream in the given @a mode using the specified
268 @a iofileName name.
269
270 @warning
271 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1 272 */
02e22828 273 wxFFileStream(const wxString& iofileName, const wxString& mode = "w+b");
23324ae1
FM
274};
275
276
e54c96f1 277
23324ae1
FM
278/**
279 @class wxFileStream
7c913512 280
e25cd775 281 @todo describe this class.
7c913512 282
23324ae1 283 @library{wxbase}
e25cd775 284 @category{streams}
7c913512 285
e54c96f1 286 @see wxStreamBuffer
23324ae1
FM
287*/
288class wxFileStream : public wxFileOutputStream
289{
290public:
291 /**
7c913512 292 Initializes a new file stream in read-write mode using the specified
9690b006
FM
293 @a iofileName name.
294
295 @warning
296 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
23324ae1
FM
297 */
298 wxFileStream(const wxString& iofileName);
299};
e54c96f1 300