]> git.saurik.com Git - wxWidgets.git/blob - interface/wfstream.h
b9bc3e7e6a66591390a22dfb3cec07b3be9ed669
[wxWidgets.git] / interface / wfstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wfstream.h
3 // Purpose: documentation for wxTempFileOutputStream class
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 @seealso
21 wxTempFile
22 */
23 class wxTempFileOutputStream : public wxOutputStream
24 {
25 public:
26 /**
27 Associates wxTempFileOutputStream with the file to be replaced and opens it.
28 You should use
29 wxStreamBase::IsOk to verify if the constructor succeeded.
30 Call Commit() or wxOutputStream::Close to
31 replace the old file and close this one. Calling Discard()
32 (or allowing the destructor to do it) will 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. If @false is
39 returned it may unfortunately mean two quite different things: either that
40 either the old file couldn't be deleted or that the new file couldn't be renamed
41 to the old name.
42 */
43 bool Commit();
44
45 /**
46 Discard changes: the old file contents are not changed, the temporary file is
47 deleted.
48 */
49 void Discard();
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 @seealso
70 wxBufferedOutputStream, wxFFileInputStream, wxFileInputStream
71 */
72 class wxFFileOutputStream : public wxOutputStream
73 {
74 public:
75 //@{
76 /**
77 Initializes a file stream in write-only mode using the file descriptor @e fp.
78 */
79 wxFFileOutputStream(const wxString& filename,
80 const wxString& mode = "w+b");
81 wxFFileOutputStream(wxFFile& file);
82 wxFFileOutputStream(FILE* fp);
83 //@}
84
85 /**
86 Destructor.
87 */
88 ~wxFFileOutputStream();
89
90 /**
91 Returns @true if the stream is initialized and ready.
92 */
93 bool IsOk();
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 @seealso
114 wxBufferedOutputStream, wxFileInputStream, wxFFileInputStream
115 */
116 class wxFileOutputStream : public wxOutputStream
117 {
118 public:
119 //@{
120 /**
121 Initializes a file stream in write-only mode using the file descriptor @e fd.
122 */
123 wxFileOutputStream(const wxString& ofileName);
124 wxFileOutputStream(wxFile& file);
125 wxFileOutputStream(int fd);
126 //@}
127
128 /**
129 Destructor.
130 */
131 ~wxFileOutputStream();
132
133 /**
134 Returns @true if the stream is initialized and ready.
135 */
136 bool IsOk();
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 @seealso
157 wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
158 */
159 class wxFileInputStream : public wxInputStream
160 {
161 public:
162 //@{
163 /**
164 Initializes a file stream in read-only mode using the specified file descriptor.
165 */
166 wxFileInputStream(const wxString& ifileName);
167 wxFileInputStream(wxFile& file);
168 wxFileInputStream(int fd);
169 //@}
170
171 /**
172 Destructor.
173 */
174 ~wxFileInputStream();
175
176 /**
177 Returns @true if the stream is initialized and ready.
178 */
179 bool IsOk();
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 @seealso
200 wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
201 */
202 class wxFFileInputStream : public wxInputStream
203 {
204 public:
205 //@{
206 /**
207 Initializes a file stream in read-only mode using the specified file pointer @e
208 fp.
209 */
210 wxFFileInputStream(const wxString& filename,
211 const wxString& mode = "rb");
212 wxFFileInputStream(wxFFile& file);
213 wxFFileInputStream(FILE* fp);
214 //@}
215
216 /**
217 Destructor.
218 */
219 ~wxFFileInputStream();
220
221 /**
222 Returns @true if the stream is initialized and ready.
223 */
224 bool IsOk();
225 };
226
227
228 /**
229 @class wxFFileStream
230 @wxheader{wfstream.h}
231
232
233 @library{wxbase}
234 @category{FIXME}
235
236 @seealso
237 wxStreamBuffer
238 */
239 class wxFFileStream : public wxFFileOutputStream
240 {
241 public:
242 /**
243 Initializes a new file stream in read-write mode using the specified
244 @e iofilename name.
245 */
246 wxFFileStream(const wxString& iofileName);
247 };
248
249
250 /**
251 @class wxFileStream
252 @wxheader{wfstream.h}
253
254
255 @library{wxbase}
256 @category{FIXME}
257
258 @seealso
259 wxStreamBuffer
260 */
261 class wxFileStream : public wxFileOutputStream
262 {
263 public:
264 /**
265 Initializes a new file stream in read-write mode using the specified
266 @e iofilename name.
267 */
268 wxFileStream(const wxString& iofileName);
269 };