]> git.saurik.com Git - wxWidgets.git/blob - interface/wfstream.h
execute the usual cleanup code from EVT_END_SESSION handler under MSW, otherwise...
[wxWidgets.git] / interface / 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 @wxheader{wfstream.h}
12
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.
16
17 @library{wxbase}
18 @category{streams}
19
20 @see wxTempFile
21 */
22 class wxTempFileOutputStream : public wxOutputStream
23 {
24 public:
25 /**
26 Associates wxTempFileOutputStream with the file to be replaced and opens it.
27 You should use
28 wxStreamBase::IsOk to verify if the constructor succeeded.
29 Call Commit() or wxOutputStream::Close to
30 replace the old file and close this one. Calling Discard()
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
52
53 /**
54 @class wxFFileOutputStream
55 @wxheader{wfstream.h}
56
57 This class represents data written to a file. There are actually
58 two such groups of classes: this one is based on wxFFile
59 whereas wxFileInputStream is based in
60 the wxFile class.
61
62 Note that wxOutputStream::SeekO
63 can seek beyond the end of the stream (file) and will thus not return
64 @e wxInvalidOffset for that.
65
66 @library{wxbase}
67 @category{streams}
68
69 @see wxBufferedOutputStream, wxFFileInputStream, wxFileInputStream
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,
79 const wxString& mode = "w+b");
80 wxFFileOutputStream(wxFFile& file);
81 wxFFileOutputStream(FILE* fp);
82 //@}
83
84 /**
85 Destructor.
86 */
87 ~wxFFileOutputStream();
88
89 /**
90 Returns @true if the stream is initialized and ready.
91 */
92 bool IsOk() const;
93 };
94
95
96
97 /**
98 @class wxFileOutputStream
99 @wxheader{wfstream.h}
100
101 This class represents data written to a file. There are actually
102 two such groups of classes: this one is based on wxFile
103 whereas wxFFileInputStream is based in
104 the wxFFile class.
105
106 Note that wxOutputStream::SeekO
107 can seek beyond the end of the stream (file) and will thus not return
108 @e wxInvalidOffset for that.
109
110 @library{wxbase}
111 @category{streams}
112
113 @see wxBufferedOutputStream, wxFileInputStream, wxFFileInputStream
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);
123 wxFileOutputStream(wxFile& file);
124 wxFileOutputStream(int fd);
125 //@}
126
127 /**
128 Destructor.
129 */
130 ~wxFileOutputStream();
131
132 /**
133 Returns @true if the stream is initialized and ready.
134 */
135 bool IsOk() const;
136 };
137
138
139
140 /**
141 @class wxFileInputStream
142 @wxheader{wfstream.h}
143
144 This class represents data read in from a file. There are actually
145 two such groups of classes: this one is based on wxFile
146 whereas wxFFileInputStream is based in
147 the wxFFile class.
148
149 Note that wxInputStream::SeekI
150 can seek beyond the end of the stream (file) and will thus not return
151 @e wxInvalidOffset for that.
152
153 @library{wxbase}
154 @category{streams}
155
156 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
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);
166 wxFileInputStream(wxFile& file);
167 wxFileInputStream(int fd);
168 //@}
169
170 /**
171 Destructor.
172 */
173 ~wxFileInputStream();
174
175 /**
176 Returns @true if the stream is initialized and ready.
177 */
178 bool IsOk() const;
179 };
180
181
182
183 /**
184 @class wxFFileInputStream
185 @wxheader{wfstream.h}
186
187 This class represents data read in from a file. There are actually
188 two such groups of classes: this one is based on wxFFile
189 whereas wxFileInputStream is based in
190 the wxFile class.
191
192 Note that wxInputStream::SeekI
193 can seek beyond the end of the stream (file) and will thus not return
194 @e wxInvalidOffset for that.
195
196 @library{wxbase}
197 @category{streams}
198
199 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
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");
211 wxFFileInputStream(wxFFile& file);
212 wxFFileInputStream(FILE* fp);
213 //@}
214
215 /**
216 Destructor.
217 */
218 ~wxFFileInputStream();
219
220 /**
221 Returns @true if the stream is initialized and ready.
222 */
223 bool IsOk() const;
224 };
225
226
227
228 /**
229 @class wxFFileStream
230 @wxheader{wfstream.h}
231
232
233 @library{wxbase}
234 @category{FIXME}
235
236 @see wxStreamBuffer
237 */
238 class wxFFileStream : public wxFFileOutputStream
239 {
240 public:
241 /**
242 Initializes a new file stream in read-write mode using the specified
243 @e iofilename name.
244 */
245 wxFFileStream(const wxString& iofileName);
246 };
247
248
249
250 /**
251 @class wxFileStream
252 @wxheader{wfstream.h}
253
254
255 @library{wxbase}
256 @category{FIXME}
257
258 @see wxStreamBuffer
259 */
260 class wxFileStream : public wxFileOutputStream
261 {
262 public:
263 /**
264 Initializes a new file stream in read-write mode using the specified
265 @e iofilename name.
266 */
267 wxFileStream(const wxString& iofileName);
268 };
269