]>
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.
103 Returns the underlying file object.
106 wxFFile
* GetFile() const;
112 @class wxFileOutputStream
114 This class represents data written to a file.
115 There are actually two such groups of classes: this one is based on wxFile
116 whereas wxFFileOutputStream is based in the wxFFile class.
118 Note that wxOutputStream::SeekO() can seek beyond the end of the stream
119 (file) and will thus not return ::wxInvalidOffset for that.
124 @see wxBufferedOutputStream, wxFileInputStream, wxFFileOutputStream, wxFFileInputStream
126 class wxFileOutputStream
: public wxOutputStream
130 Creates a new file with @a ofileName name and initializes the stream in write-only mode.
133 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
135 wxFileOutputStream(const wxString
& ofileName
);
138 Initializes a file stream in write-only mode using the file I/O object file.
140 wxFileOutputStream(wxFile
& file
);
143 Initializes a file stream in write-only mode using the file descriptor @e fd.
145 wxFileOutputStream(int fd
);
150 virtual ~wxFileOutputStream();
153 Returns @true if the stream is initialized and ready.
158 Returns the underlying file object.
161 wxFile
* GetFile() const;
167 @class wxFileInputStream
169 This class represents data read in from a file.
170 There are actually two such groups of classes: this one is based on wxFile
171 whereas wxFFileInputStream is based in the wxFFile class.
173 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
174 and will thus not return ::wxInvalidOffset for that.
179 @see wxBufferedInputStream, wxFileOutputStream, wxFFileOutputStream
181 class wxFileInputStream
: public wxInputStream
185 Opens the specified file using its @a ifileName name in read-only mode.
188 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
190 wxFileInputStream(const wxString
& ifileName
);
193 Initializes a file stream in read-only mode using the file I/O object file.
195 wxFileInputStream(wxFile
& file
);
198 Initializes a file stream in read-only mode using the specified file descriptor.
200 wxFileInputStream(int fd
);
205 virtual ~wxFileInputStream();
208 Returns @true if the stream is initialized and ready.
213 Returns the underlying file object.
216 wxFile
* GetFile() const;
222 @class wxFFileInputStream
224 This class represents data read in from a file.
225 There are actually two such groups of classes: this one is based on wxFFile
226 whereas wxFileInputStream is based in the wxFile class.
228 Note that wxInputStream::SeekI() can seek beyond the end of the stream (file)
229 and will thus not return ::wxInvalidOffset for that.
234 @see wxBufferedInputStream, wxFFileOutputStream, wxFileOutputStream
236 class wxFFileInputStream
: public wxInputStream
240 Opens the specified file using its @a filename name using the specified @a mode.
243 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
245 wxFFileInputStream(const wxString
& filename
,
246 const wxString
& mode
= "rb");
249 Initializes a file stream in read-only mode using the file I/O object file.
251 wxFFileInputStream(wxFFile
& file
);
254 Initializes a file stream in read-only mode using the specified file pointer @a fp.
256 wxFFileInputStream(FILE* fp
);
261 virtual ~wxFFileInputStream();
264 Returns @true if the stream is initialized and ready.
269 Returns the underlying file object.
272 wxFFile
* GetFile() const;
280 This stream allows to both read from and write to a file using buffered
286 @see wxFFileInputStream, wxFFileOutputStream, wxFileStream
288 class wxFFileStream
: public wxFFileInputStream
,
289 public wxFFileOutputStream
293 Initializes a new file stream in the given @a mode using the specified
297 You should use wxStreamBase::IsOk() to verify if the constructor succeeded.
299 wxFFileStream(const wxString
& iofileName
, const wxString
& mode
= "w+b");
302 Returns @true if the stream is initialized and ready.
304 This method returns @true if the stream can be both read from and
315 This class represents data that can be both read from and written to a file.
316 There are actually two such groups of classes: this one is based on wxFile
317 whereas wxFFileStream is based in the wxFFile class.
322 @see wxFileInputStream, wxFileOutputStream, wxFFileStream
324 class wxFileStream
: public wxFileOutputStream
,
325 public wxFileInputStream
329 Initializes a new file stream in read-write mode using the specified
333 You should use IsOk() to verify if the constructor succeeded.
335 wxFileStream(const wxString
& iofileName
);
338 Returns @true if the stream is initialized and ready.
340 This method returns @true if the stream can be both read from and