]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/wfstream.h
Override default handling so that we can position windows off-screen like on other...
[wxWidgets.git] / interface / wx / wfstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wfstream.h
3 // Purpose: interface of wxTempFileOutputStream
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxTempFileOutputStream
11
12 wxTempFileOutputStream is an output stream based on wxTempFile.
13 It provides a relatively safe way to replace the contents of the
14 existing file.
15
16 @library{wxbase}
17 @category{streams}
18
19 @see wxTempFile
20 */
21 class wxTempFileOutputStream : public wxOutputStream
22 {
23 public:
24 /**
25 Associates wxTempFileOutputStream with the file to be replaced and opens it.
26
27 @warning
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.
33 */
34 wxTempFileOutputStream(const wxString& fileName);
35
36 /**
37 Validate changes: deletes the old file of the given name and renames the new
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
41 either the old file couldn't be deleted or that the new file couldn't be renamed
42 to the old name.
43 */
44 virtual bool Commit();
45
46 /**
47 Discard changes: the old file contents are not changed, the temporary file is
48 deleted.
49 */
50 virtual void Discard();
51 };
52
53
54
55 /**
56 @class wxFFileOutputStream
57
58 This class represents data written to a file.
59 There are actually two such groups of classes: this one is based on wxFFile
60 whereas wxFileOutputStream is based in the wxFile class.
61
62 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
63 (file) and will thus not return ::wxInvalidOffset for that.
64
65 @library{wxbase}
66 @category{streams}
67
68 @see wxBufferedOutputStream, wxFFileInputStream, wxFileOutputStream, wxFileInputStream
69 */
70 class wxFFileOutputStream : public wxOutputStream
71 {
72 public:
73 /**
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.
78 */
79 wxFFileOutputStream(const wxString& filename,
80 const wxString& mode = "wb");
81
82 /**
83 Initializes a file stream in write-only mode using the file I/O object file.
84 */
85 wxFFileOutputStream(wxFFile& file);
86
87 /**
88 Initializes a file stream in write-only mode using the file descriptor fp.
89 */
90 wxFFileOutputStream(FILE* fp);
91
92 /**
93 Destructor.
94 */
95 virtual ~wxFFileOutputStream();
96
97 /**
98 Returns @true if the stream is initialized and ready.
99 */
100 bool IsOk() const;
101 };
102
103
104
105 /**
106 @class wxFileOutputStream
107
108 This class represents data written to a file.
109 There are actually two such groups of classes: this one is based on wxFile
110 whereas wxFFileOutputStream is based in the wxFFile class.
111
112 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
113 (file) and will thus not return ::wxInvalidOffset for that.
114
115 @library{wxbase}
116 @category{streams}
117
118 @see wxBufferedOutputStream, wxFileInputStream, wxFFileOutputStream, wxFFileInputStream
119 */
120 class wxFileOutputStream : public wxOutputStream
121 {
122 public:
123 /**
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.
128 */
129 wxFileOutputStream(const wxString& ofileName);
130
131 /**
132 Initializes a file stream in write-only mode using the file I/O object file.
133 */
134 wxFileOutputStream(wxFile& file);
135
136 /**
137 Initializes a file stream in write-only mode using the file descriptor @e fd.
138 */
139 wxFileOutputStream(int fd);
140
141 /**
142 Destructor.
143 */
144 virtual ~wxFileOutputStream();
145
146 /**
147 Returns @true if the stream is initialized and ready.
148 */
149 bool IsOk() const;
150 };
151
152
153
154 /**
155 @class wxFileInputStream
156
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.
160
161 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
162 and will thus not return ::wxInvalidOffset for that.
163
164 @library{wxbase}
165 @category{streams}
166
167 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
168 */
169 class wxFileInputStream : public wxInputStream
170 {
171 public:
172 /**
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.
177 */
178 wxFileInputStream(const wxString& ifileName);
179
180 /**
181 Initializes a file stream in read-only mode using the file I/O object file.
182 */
183 wxFileInputStream(wxFile& file);
184
185 /**
186 Initializes a file stream in read-only mode using the specified file descriptor.
187 */
188 wxFileInputStream(int fd);
189
190 /**
191 Destructor.
192 */
193 virtual ~wxFileInputStream();
194
195 /**
196 Returns @true if the stream is initialized and ready.
197 */
198 bool IsOk() const;
199 };
200
201
202
203 /**
204 @class wxFFileInputStream
205
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.
209
210 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
211 and will thus not return ::wxInvalidOffset for that.
212
213 @library{wxbase}
214 @category{streams}
215
216 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
217 */
218 class wxFFileInputStream : public wxInputStream
219 {
220 public:
221 /**
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.
226 */
227 wxFFileInputStream(const wxString& filename,
228 const wxString& mode = "rb");
229
230 /**
231 Initializes a file stream in read-only mode using the file I/O object file.
232 */
233 wxFFileInputStream(wxFFile& file);
234
235 /**
236 Initializes a file stream in read-only mode using the specified file pointer @a fp.
237 */
238 wxFFileInputStream(FILE* fp);
239
240 /**
241 Destructor.
242 */
243 virtual ~wxFFileInputStream();
244
245 /**
246 Returns @true if the stream is initialized and ready.
247 */
248 bool IsOk() const;
249 };
250
251
252
253 /**
254 @class wxFFileStream
255
256 @todo describe this class.
257
258 @library{wxbase}
259 @category{streams}
260
261 @see wxStreamBuffer
262 */
263 class wxFFileStream : public wxFFileOutputStream
264 {
265 public:
266 /**
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.
272 */
273 wxFFileStream(const wxString& iofileName, const wxString& mode = "w+b");
274 };
275
276
277
278 /**
279 @class wxFileStream
280
281 @todo describe this class.
282
283 @library{wxbase}
284 @category{streams}
285
286 @see wxStreamBuffer
287 */
288 class wxFileStream : public wxFileOutputStream
289 {
290 public:
291 /**
292 Initializes a new file stream in read-write mode using the specified
293 @a iofileName name.
294
295 @warning
296 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
297 */
298 wxFileStream(const wxString& iofileName);
299 };
300