]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/wfstream.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTempFileOutputStream
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxTempFileOutputStream
12 wxTempFileOutputStream is an output stream based on wxTempFile.
13 It provides a relatively safe way to replace the contents of the
21 class wxTempFileOutputStream
: public wxOutputStream
25 Associates wxTempFileOutputStream with the file to be replaced and opens it.
28 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
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
34 wxTempFileOutputStream(const wxString
& fileName
);
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.
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
44 virtual bool Commit();
47 Discard changes: the old file contents are not changed, the temporary file is
50 virtual void Discard();
56 @class wxFFileOutputStream
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.
62 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
63 (file) and will thus not return ::wxInvalidOffset for that.
68 @see wxBufferedOutputStream, wxFFileInputStream, wxFileOutputStream, wxFileInputStream
70 class wxFFileOutputStream
: public wxOutputStream
74 Open the given file @a filename with mode @a mode.
77 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
79 wxFFileOutputStream(const wxString
& filename
,
80 const wxString
& mode
= "wb");
83 Initializes a file stream in write-only mode using the file I/O object file.
85 wxFFileOutputStream(wxFFile
& file
);
88 Initializes a file stream in write-only mode using the file descriptor fp.
90 wxFFileOutputStream(FILE* fp
);
95 virtual ~wxFFileOutputStream();
98 Returns @true if the stream is initialized and ready.
106 @class wxFileOutputStream
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.
112 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
113 (file) and will thus not return ::wxInvalidOffset for that.
118 @see wxBufferedOutputStream, wxFileInputStream, wxFFileOutputStream, wxFFileInputStream
120 class wxFileOutputStream
: public wxOutputStream
124 Creates a new file with @a ofileName name and initializes the stream in write-only mode.
127 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
129 wxFileOutputStream(const wxString
& ofileName
);
132 Initializes a file stream in write-only mode using the file I/O object file.
134 wxFileOutputStream(wxFile
& file
);
137 Initializes a file stream in write-only mode using the file descriptor @e fd.
139 wxFileOutputStream(int fd
);
144 virtual ~wxFileOutputStream();
147 Returns @true if the stream is initialized and ready.
155 @class wxFileInputStream
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.
161 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
162 and will thus not return ::wxInvalidOffset for that.
167 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
169 class wxFileInputStream
: public wxInputStream
173 Opens the specified file using its @a ifileName name in read-only mode.
176 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
178 wxFileInputStream(const wxString
& ifileName
);
181 Initializes a file stream in read-only mode using the file I/O object file.
183 wxFileInputStream(wxFile
& file
);
186 Initializes a file stream in read-only mode using the specified file descriptor.
188 wxFileInputStream(int fd
);
193 virtual ~wxFileInputStream();
196 Returns @true if the stream is initialized and ready.
204 @class wxFFileInputStream
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.
210 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
211 and will thus not return ::wxInvalidOffset for that.
216 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
218 class wxFFileInputStream
: public wxInputStream
222 Opens the specified file using its @a filename name using the specified @a mode.
225 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
227 wxFFileInputStream(const wxString
& filename
,
228 const wxString
& mode
= "rb");
231 Initializes a file stream in read-only mode using the file I/O object file.
233 wxFFileInputStream(wxFFile
& file
);
236 Initializes a file stream in read-only mode using the specified file pointer @a fp.
238 wxFFileInputStream(FILE* fp
);
243 virtual ~wxFFileInputStream();
246 Returns @true if the stream is initialized and ready.
256 This stream allows to both read from and write to a file using buffered
262 @see wxFFileInputStream, wxFFileOutputStream, wxFileStream
264 class wxFFileStream
: public wxFFileInputStream
,
265 public wxFFileOutputStream
269 Initializes a new file stream in the given @a mode using the specified
273 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
275 wxFFileStream(const wxString
& iofileName
, const wxString
& mode
= "w+b");
278 Returns @true if the stream is initialized and ready.
280 This method returns @true if the stream can be both read from and
291 This class represents data that can be both read from and written to a file.
292 There are actually two such groups of classes: this one is based on wxFile
293 whereas wxFFileStream is based in the wxFFile class.
298 @see wxFileInputStream, wxFileOutputStream, wxFFileStream
300 class wxFileStream
: public wxFileOutputStream
,
301 public wxFileInputStream
305 Initializes a new file stream in read-write mode using the specified
309 You should use IsOk() to verify if the constructor succeeded.
311 wxFileStream(const wxString
& iofileName
);
314 Returns @true if the stream is initialized and ready.
316 This method returns @true if the stream can be both read from and