]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/wfstream.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTempFileOutputStream
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 @class wxTempFileOutputStream
11 wxTempFileOutputStream is an output stream based on wxTempFile.
12 It provides a relatively safe way to replace the contents of the
20 class wxTempFileOutputStream
: public wxOutputStream
24 Associates wxTempFileOutputStream with the file to be replaced and opens it.
27 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
29 Call Commit() or wxOutputStream::Close() to replace the old file and close
30 this one. Calling Discard() (or allowing the destructor to do it) will
33 wxTempFileOutputStream(const wxString
& fileName
);
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.
39 If @false is 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
43 virtual bool Commit();
46 Discard changes: the old file contents are not changed, the temporary file is
49 virtual void Discard();
55 @class wxFFileOutputStream
57 This class represents data written to a file.
58 There are actually two such groups of classes: this one is based on wxFFile
59 whereas wxFileOutputStream is based in the wxFile class.
61 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
62 (file) and will thus not return ::wxInvalidOffset for that.
67 @see wxBufferedOutputStream, wxFFileInputStream, wxFileOutputStream, wxFileInputStream
69 class wxFFileOutputStream
: public wxOutputStream
73 Open the given file @a filename with mode @a mode.
76 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
78 wxFFileOutputStream(const wxString
& filename
,
79 const wxString
& mode
= "wb");
82 Initializes a file stream in write-only mode using the file I/O object file.
84 wxFFileOutputStream(wxFFile
& file
);
87 Initializes a file stream in write-only mode using the file descriptor fp.
89 wxFFileOutputStream(FILE* fp
);
94 virtual ~wxFFileOutputStream();
97 Returns @true if the stream is initialized and ready.
102 Returns the underlying file object.
105 wxFFile
* GetFile() const;
111 @class wxFileOutputStream
113 This class represents data written to a file.
114 There are actually two such groups of classes: this one is based on wxFile
115 whereas wxFFileOutputStream is based in the wxFFile class.
117 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
118 (file) and will thus not return ::wxInvalidOffset for that.
123 @see wxBufferedOutputStream, wxFileInputStream, wxFFileOutputStream, wxFFileInputStream
125 class wxFileOutputStream
: public wxOutputStream
129 Creates a new file with @a ofileName name and initializes the stream in write-only mode.
132 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
134 wxFileOutputStream(const wxString
& ofileName
);
137 Initializes a file stream in write-only mode using the file I/O object file.
139 wxFileOutputStream(wxFile
& file
);
142 Initializes a file stream in write-only mode using the file descriptor @e fd.
144 wxFileOutputStream(int fd
);
149 virtual ~wxFileOutputStream();
152 Returns @true if the stream is initialized and ready.
157 Returns the underlying file object.
160 wxFile
* GetFile() const;
166 @class wxFileInputStream
168 This class represents data read in from a file.
169 There are actually two such groups of classes: this one is based on wxFile
170 whereas wxFFileInputStream is based in the wxFFile class.
172 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
173 and will thus not return ::wxInvalidOffset for that.
178 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
180 class wxFileInputStream
: public wxInputStream
184 Opens the specified file using its @a ifileName name in read-only mode.
187 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
189 wxFileInputStream(const wxString
& ifileName
);
192 Initializes a file stream in read-only mode using the file I/O object file.
194 wxFileInputStream(wxFile
& file
);
197 Initializes a file stream in read-only mode using the specified file descriptor.
199 wxFileInputStream(int fd
);
204 virtual ~wxFileInputStream();
207 Returns @true if the stream is initialized and ready.
212 Returns the underlying file object.
215 wxFile
* GetFile() const;
221 @class wxFFileInputStream
223 This class represents data read in from a file.
224 There are actually two such groups of classes: this one is based on wxFFile
225 whereas wxFileInputStream is based in the wxFile class.
227 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
228 and will thus not return ::wxInvalidOffset for that.
233 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
235 class wxFFileInputStream
: public wxInputStream
239 Opens the specified file using its @a filename name using the specified @a mode.
242 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
244 wxFFileInputStream(const wxString
& filename
,
245 const wxString
& mode
= "rb");
248 Initializes a file stream in read-only mode using the file I/O object file.
250 wxFFileInputStream(wxFFile
& file
);
253 Initializes a file stream in read-only mode using the specified file pointer @a fp.
255 wxFFileInputStream(FILE* fp
);
260 virtual ~wxFFileInputStream();
263 Returns @true if the stream is initialized and ready.
268 Returns the underlying file object.
271 wxFFile
* GetFile() const;
279 This stream allows to both read from and write to a file using buffered
285 @see wxFFileInputStream, wxFFileOutputStream, wxFileStream
287 class wxFFileStream
: public wxFFileInputStream
,
288 public wxFFileOutputStream
292 Initializes a new file stream in the given @a mode using the specified
296 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
298 wxFFileStream(const wxString
& iofileName
, const wxString
& mode
= "w+b");
301 Returns @true if the stream is initialized and ready.
303 This method returns @true if the stream can be both read from and
314 This class represents data that can be both read from and written to a file.
315 There are actually two such groups of classes: this one is based on wxFile
316 whereas wxFFileStream is based in the wxFFile class.
321 @see wxFileInputStream, wxFileOutputStream, wxFFileStream
323 class wxFileStream
: public wxFileOutputStream
,
324 public wxFileInputStream
328 Initializes a new file stream in read-write mode using the specified
332 You should use IsOk() to verify if the constructor succeeded.
334 wxFileStream(const wxString
& iofileName
);
337 Returns @true if the stream is initialized and ready.
339 This method returns @true if the stream can be both read from and