Add wxTempFileOutputStream
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -183,6 +183,33 @@ wxFileOffset wxFileOutputStream::GetLength() const
|
||||
return m_file->Length();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTempFileOutputStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxTempFileOutputStream::wxTempFileOutputStream(const wxString& fileName)
|
||||
{
|
||||
m_file = new wxTempFile(fileName);
|
||||
|
||||
if (!m_file->IsOpened())
|
||||
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||
}
|
||||
|
||||
wxTempFileOutputStream::~wxTempFileOutputStream()
|
||||
{
|
||||
if (m_file->IsOpened())
|
||||
Discard();
|
||||
delete m_file;
|
||||
}
|
||||
|
||||
size_t wxTempFileOutputStream::OnSysWrite(const void *buffer, size_t size)
|
||||
{
|
||||
if (IsOk() && m_file->Write(buffer, size))
|
||||
return size;
|
||||
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user