]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/wfstream.h
few other fixes for wxChar => wxString
[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.
e25cd775
FM
26 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
27
28 Call Commit() or wxOutputStream::Close() to replace the old file and close
29 this one. Calling Discard() (or allowing the destructor to do it) will
30 discard the changes.
23324ae1
FM
31 */
32 wxTempFileOutputStream(const wxString& fileName);
33
34 /**
35 Validate changes: deletes the old file of the given name and renames the new
e25cd775
FM
36 file to the old name. Returns @true if both actions succeeded.
37
38 If @false is returned it may unfortunately mean two quite different things: either that
23324ae1
FM
39 either the old file couldn't be deleted or that the new file couldn't be renamed
40 to the old name.
41 */
adaaa686 42 virtual bool Commit();
23324ae1
FM
43
44 /**
45 Discard changes: the old file contents are not changed, the temporary file is
46 deleted.
47 */
adaaa686 48 virtual void Discard();
23324ae1
FM
49};
50
51
e54c96f1 52
23324ae1
FM
53/**
54 @class wxFFileOutputStream
7c913512 55
e25cd775
FM
56 This class represents data written to a file.
57 There are actually two such groups of classes: this one is based on wxFFile
58 whereas wxFileInputStream is based in the wxFile class.
7c913512 59
e25cd775
FM
60 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
61 (file) and will thus not return ::wxInvalidOffset for that.
7c913512 62
23324ae1
FM
63 @library{wxbase}
64 @category{streams}
7c913512 65
e54c96f1 66 @see wxBufferedOutputStream, wxFFileInputStream, wxFileInputStream
23324ae1
FM
67*/
68class wxFFileOutputStream : public wxOutputStream
69{
70public:
23324ae1
FM
71 /**
72 Initializes a file stream in write-only mode using the file descriptor @e fp.
73 */
74 wxFFileOutputStream(const wxString& filename,
95b4a59e 75 const wxString& mode = "wb");
e25cd775
FM
76
77 /**
78 Initializes a file stream in write-only mode using the file I/O object file.
79 */
7c913512 80 wxFFileOutputStream(wxFFile& file);
e25cd775
FM
81
82 /**
83 Initializes a file stream in write-only mode using the file descriptor fp.
84 */
4cc4bfaf 85 wxFFileOutputStream(FILE* fp);
23324ae1
FM
86
87 /**
88 Destructor.
89 */
adaaa686 90 virtual ~wxFFileOutputStream();
23324ae1
FM
91
92 /**
93 Returns @true if the stream is initialized and ready.
94 */
328f5751 95 bool IsOk() const;
23324ae1
FM
96};
97
98
e54c96f1 99
23324ae1
FM
100/**
101 @class wxFileOutputStream
7c913512 102
e25cd775
FM
103 This class represents data written to a file.
104 There are actually two such groups of classes: this one is based on wxFile
105 whereas wxFFileInputStream is based in the wxFFile class.
7c913512 106
e25cd775
FM
107 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
108 (file) and will thus not return ::wxInvalidOffset for that.
7c913512 109
23324ae1
FM
110 @library{wxbase}
111 @category{streams}
7c913512 112
e54c96f1 113 @see wxBufferedOutputStream, wxFileInputStream, wxFFileInputStream
23324ae1
FM
114*/
115class wxFileOutputStream : public wxOutputStream
116{
117public:
23324ae1 118 /**
e25cd775 119 Creates a new file with ofilename name and initializes the stream in write-only mode.
23324ae1
FM
120 */
121 wxFileOutputStream(const wxString& ofileName);
e25cd775
FM
122
123 /**
124 Initializes a file stream in write-only mode using the file I/O object file.
125 */
7c913512 126 wxFileOutputStream(wxFile& file);
e25cd775
FM
127
128 /**
129 Initializes a file stream in write-only mode using the file descriptor @e fd.
130 */
7c913512 131 wxFileOutputStream(int fd);
23324ae1
FM
132
133 /**
134 Destructor.
135 */
adaaa686 136 virtual ~wxFileOutputStream();
23324ae1
FM
137
138 /**
139 Returns @true if the stream is initialized and ready.
140 */
328f5751 141 bool IsOk() const;
23324ae1
FM
142};
143
144
e54c96f1 145
23324ae1
FM
146/**
147 @class wxFileInputStream
7c913512 148
e25cd775
FM
149 This class represents data read in from a file.
150 There are actually two such groups of classes: this one is based on wxFile
151 whereas wxFFileInputStream is based in the wxFFile class.
7c913512 152
e25cd775
FM
153 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
154 and will thus not return ::wxInvalidOffset for that.
7c913512 155
23324ae1
FM
156 @library{wxbase}
157 @category{streams}
7c913512 158
e54c96f1 159 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
23324ae1
FM
160*/
161class wxFileInputStream : public wxInputStream
162{
163public:
23324ae1 164 /**
e25cd775 165 Opens the specified file using its ifilename name in read-only mode.
23324ae1
FM
166 */
167 wxFileInputStream(const wxString& ifileName);
e25cd775
FM
168
169 /**
170 Initializes a file stream in read-only mode using the file I/O object file.
171 */
7c913512 172 wxFileInputStream(wxFile& file);
e25cd775
FM
173
174 /**
175 Initializes a file stream in read-only mode using the specified file descriptor.
176 */
7c913512 177 wxFileInputStream(int fd);
23324ae1
FM
178
179 /**
180 Destructor.
181 */
adaaa686 182 virtual ~wxFileInputStream();
23324ae1
FM
183
184 /**
185 Returns @true if the stream is initialized and ready.
186 */
328f5751 187 bool IsOk() const;
23324ae1
FM
188};
189
190
e54c96f1 191
23324ae1
FM
192/**
193 @class wxFFileInputStream
7c913512 194
e25cd775
FM
195 This class represents data read in from a file.
196 There are actually two such groups of classes: this one is based on wxFFile
197 whereas wxFileInputStream is based in the wxFile class.
7c913512 198
e25cd775
FM
199 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
200 and will thus not return ::wxInvalidOffset for that.
7c913512 201
23324ae1
FM
202 @library{wxbase}
203 @category{streams}
7c913512 204
e54c96f1 205 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
23324ae1
FM
206*/
207class wxFFileInputStream : public wxInputStream
208{
209public:
23324ae1 210 /**
e25cd775 211 Opens the specified file using its filename name using the specified mode.
23324ae1
FM
212 */
213 wxFFileInputStream(const wxString& filename,
214 const wxString& mode = "rb");
e25cd775
FM
215
216 /**
217 Initializes a file stream in read-only mode using the file I/O object file.
218 */
7c913512 219 wxFFileInputStream(wxFFile& file);
e25cd775
FM
220
221 /**
222 Initializes a file stream in read-only mode using the specified file pointer @a fp.
223 */
4cc4bfaf 224 wxFFileInputStream(FILE* fp);
23324ae1
FM
225
226 /**
227 Destructor.
228 */
adaaa686 229 virtual ~wxFFileInputStream();
23324ae1
FM
230
231 /**
232 Returns @true if the stream is initialized and ready.
233 */
328f5751 234 bool IsOk() const;
23324ae1
FM
235};
236
237
e54c96f1 238
23324ae1
FM
239/**
240 @class wxFFileStream
7c913512 241
e25cd775 242 @todo describe this class.
7c913512 243
23324ae1 244 @library{wxbase}
e25cd775 245 @category{streams}
7c913512 246
e54c96f1 247 @see wxStreamBuffer
23324ae1
FM
248*/
249class wxFFileStream : public wxFFileOutputStream
250{
251public:
252 /**
7c913512 253 Initializes a new file stream in read-write mode using the specified
e25cd775 254 @a iofilename name.
23324ae1 255 */
02e22828 256 wxFFileStream(const wxString& iofileName, const wxString& mode = "w+b");
23324ae1
FM
257};
258
259
e54c96f1 260
23324ae1
FM
261/**
262 @class wxFileStream
7c913512 263
e25cd775 264 @todo describe this class.
7c913512 265
23324ae1 266 @library{wxbase}
e25cd775 267 @category{streams}
7c913512 268
e54c96f1 269 @see wxStreamBuffer
23324ae1
FM
270*/
271class wxFileStream : public wxFileOutputStream
272{
273public:
274 /**
7c913512 275 Initializes a new file stream in read-write mode using the specified
e25cd775 276 @a iofilename name.
23324ae1
FM
277 */
278 wxFileStream(const wxString& iofileName);
279};
e54c96f1 280