]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/fstream.h
FreeBSD patch to sckaddr.cpp; include more files in manual; misc
[wxWidgets.git] / include / wx / fstream.h
index 384a614bc4c9402715d73f26d67d060e1c36872a..2c1f320f855f8a23a2ba67b98467d59a146671ab 100644 (file)
@@ -8,68 +8,81 @@
 // Copyright:   (c) Guilhem Lavaux
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) Guilhem Lavaux
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
-#ifndef __WXFSTREAM_H__
-#define __WXFSTREAM_H__
+
+#ifndef _WX_WXFSTREAM_H__
+#define _WX_WXFSTREAM_H__
+
+#ifdef __GNUG__
+#pragma interface "fstream.h"
+#endif
 
 #include <wx/object.h>
 #include <wx/string.h>
 #include <wx/stream.h>
 #include <wx/file.h>
 
 
 #include <wx/object.h>
 #include <wx/string.h>
 #include <wx/stream.h>
 #include <wx/file.h>
 
-class wxFileInputStream: virtual public wxFile, public wxInputStream {
-  DECLARE_CLASS(wxFileInputStream)
+// Disable warnings such as
+// 'wxFileStream' : inherits 'wxFileInputStream::Peek' via dominance
+
+#ifdef _MSC_VER
+#pragma warning(disable:4250)
+#endif
+
+class wxFileStreamBase {
+protected:
+  wxFile *m_file;
+  bool m_file_destroy;
+};
+
+class wxFileInputStream: public virtual wxInputStream,
+                         public virtual wxFileStreamBase {
  public:
   wxFileInputStream(const wxString& fileName);
   virtual ~wxFileInputStream();
 
  public:
   wxFileInputStream(const wxString& fileName);
   virtual ~wxFileInputStream();
 
-  wxInputStream& Read(void *buffer, size_t size);
-  off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
-  off_t TellI() const;
-
-  bool Eof() const { return m_eof; }
-  size_t LastRead() const { return m_lastread; }
+  virtual char Peek();
 
 
-  bool Ok() const { return wxFile::IsOpened(); }
+  bool Ok() const { return m_file->IsOpened(); }
 
  protected:
 
  protected:
-  wxFileInputStream() {}
+  wxFileInputStream();
 
 
- protected:
-  bool m_eof;
-  bool m_ok_i;
-  size_t m_lastread;
+  size_t DoRead(void *buffer, size_t size);
+  off_t DoSeekInput(off_t pos, wxSeekMode mode);
+  off_t DoTellInput() const;
 };
 
 };
 
-class wxFileOutputStream: virtual wxFile, public wxOutputStream {
-  DECLARE_CLASS(wxFileOutputStream)
+class wxFileOutputStream: public virtual wxOutputStream,
+                          public virtual wxFileStreamBase {
  public:
   wxFileOutputStream(const wxString& fileName);
   virtual ~wxFileOutputStream();
 
  public:
   wxFileOutputStream(const wxString& fileName);
   virtual ~wxFileOutputStream();
 
-  wxOutputStream& Write(const void *buffer, size_t size);
-  off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
-  off_t TellO() const;
-
-  bool Bad() const { return m_bad; }
-  size_t LastWrite() const { return m_lastwrite; }
+  // To solve an ambiguity on GCC
+  inline wxOutputStream& Write(const void *buffer, size_t size)
+     { return wxOutputStream::Write(buffer, size); }
 
   void Sync();
 
 
   void Sync();
 
-  bool IsOpened() const { return wxFile::IsOpened(); }
+  bool Ok() const { return m_file->IsOpened(); }
 
  protected:
 
  protected:
-  wxFileOutputStream() {}
+  wxFileOutputStream();
 
 
- protected:
-  bool m_bad;
-  size_t m_lastwrite;
+  size_t DoWrite(const void *buffer, size_t size);
+  off_t DoSeekOutput(off_t pos, wxSeekMode mode);
+  off_t DoTellOutput() const;
 };
 
 };
 
-class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
-  DECLARE_CLASS(wxFileStream)
+class wxFileStream: public wxStream,
+                    public wxFileInputStream, public wxFileOutputStream {
  public:
   wxFileStream(const wxString& fileName);
   virtual ~wxFileStream();
 };
 
  public:
   wxFileStream(const wxString& fileName);
   virtual ~wxFileStream();
 };
 
+#ifdef _MSC_VER
+#pragma warning(default:4250)
+#endif
+
 #endif
 #endif