]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wfstream.cpp
don't try to subclass tab control using the same window proc for our class, this...
[wxWidgets.git] / src / common / wfstream.cpp
index f0b0178083e54f7f68967fe2287558a1333e956b..9d15b4f9b65d501e7dd71a5bce998b04666b42fa 100644 (file)
   #pragma hdrstop
 #endif
 
-#if wxUSE_STREAMS && wxUSE_FILE
+#if wxUSE_STREAMS
 
 #include <stdio.h>
 #include "wx/stream.h"
 #include "wx/wfstream.h"
 
+#if wxUSE_FILE
+
 // ----------------------------------------------------------------------------
 // wxFileInputStream
 // ----------------------------------------------------------------------------
@@ -181,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
 // ----------------------------------------------------------------------------
@@ -191,6 +220,10 @@ wxFileStream::wxFileStream(const wxString& fileName)
     wxFileOutputStream::m_file = wxFileInputStream::m_file;
 }
 
+#endif //wxUSE_FILE
+
+#if wxUSE_FFILE
+
 // ----------------------------------------------------------------------------
 // wxFFileInputStream
 // ----------------------------------------------------------------------------
@@ -350,5 +383,7 @@ wxFFileStream::wxFFileStream(const wxString& fileName)
     wxFFileOutputStream::m_file = wxFFileInputStream::m_file;
 }
 
-#endif // wxUSE_STREAMS && wxUSE_FILE
+#endif //wxUSE_FFILE
+
+#endif // wxUSE_STREAMS