#include </home/zeitlin/src/wx/github/interface/wx/wfstream.h>
wxTempFileOutputStream is an output stream based on wxTempFile.
It provides a relatively safe way to replace the contents of the existing file.
Public Member Functions | |
wxTempFileOutputStream (const wxString &fileName) | |
Associates wxTempFileOutputStream with the file to be replaced and opens it. | |
virtual bool | Commit () |
Validate changes: deletes the old file of the given name and renames the new file to the old name. | |
virtual void | Discard () |
Discard changes: the old file contents are not changed, the temporary file is deleted. |
wxTempFileOutputStream::wxTempFileOutputStream | ( | const wxString & | fileName | ) |
Associates wxTempFileOutputStream with the file to be replaced and opens it.
Call Commit() or wxOutputStream::Close() to replace the old file and close this one. Calling Discard() (or allowing the destructor to do it) will discard the changes.
virtual bool wxTempFileOutputStream::Commit | ( | ) | [virtual] |
Validate changes: deletes the old file of the given name and renames the new file to the old name.
Returns true if both actions succeeded.
If false is returned it may unfortunately mean two quite different things: either that either the old file couldn't be deleted or that the new file couldn't be renamed to the old name.
virtual void wxTempFileOutputStream::Discard | ( | ) | [virtual] |
Discard changes: the old file contents are not changed, the temporary file is deleted.