X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/32fc4afbb253f55d4b35b7ee7a2ca9a7eea49fd9..3848ffef9f9555f6c63daebd0f4e6a1fe2d183cc:/include/wx/stream.h diff --git a/include/wx/stream.h b/include/wx/stream.h index 8f6643cde8..c56b8c6171 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -17,20 +17,15 @@ #endif #include -#include -#include +#include "wx/object.h" +#include "wx/string.h" +#include "wx/filefn.h" // for off_t and wxSeekMode /* * wxStream: base classes */ - -typedef enum { - wxBeginPosition = 0, wxCurrentPosition = 1, wxEndPosition = 2 -} wxWhenceType; - class wxOutputStream; -class wxInputStream: public wxObject { - DECLARE_ABSTRACT_CLASS(wxInputStream); +class wxInputStream { public: wxInputStream(); virtual ~wxInputStream(); @@ -38,15 +33,16 @@ class wxInputStream: public wxObject { virtual wxInputStream& Read(void *buffer, size_t size) = 0; wxInputStream& Read(wxOutputStream& stream_out); - virtual size_t SeekI(int pos, wxWhenceType whence = wxBeginPosition) = 0; - virtual size_t TellI() const = 0; + virtual off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart) = 0; + virtual off_t TellI() const = 0; virtual bool Eof() const = 0; virtual size_t LastRead() const = 0; + + wxInputStream& operator>>(wxOutputStream& out) { return Read(out); } }; -class wxOutputStream: public wxObject { - DECLARE_ABSTRACT_CLASS(wxOutputStream); +class wxOutputStream { public: wxOutputStream(); virtual ~wxOutputStream(); @@ -54,8 +50,8 @@ class wxOutputStream: public wxObject { virtual wxOutputStream& Write(const void *buffer, size_t size) = 0; wxOutputStream& Write(wxInputStream& stream_in); - virtual size_t SeekO(int pos, wxWhenceType whence = wxBeginPosition) = 0; - virtual size_t TellO() const = 0; + virtual off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart) = 0; + virtual off_t TellO() const = 0; virtual bool Bad() const = 0; virtual size_t LastWrite() const = 0; @@ -63,47 +59,43 @@ class wxOutputStream: public wxObject { virtual void Sync() {} }; -class wxStream: public wxInputStream, public wxOutputStream { - DECLARE_ABSTRACT_CLASS(wxStream) - public: - wxStream() : wxInputStream(), wxOutputStream() {} - virtual ~wxStream() {} -}; - /* * "Filter" streams */ class wxFilterInputStream: public wxInputStream { - DECLARE_CLASS(wxFilterInputStream) public: wxFilterInputStream(wxInputStream& stream); virtual ~wxFilterInputStream(); virtual wxInputStream& Read(void *buffer, size_t size) { return m_parent_i_stream->Read(buffer, size); } - virtual size_t SeekI(int pos, wxWhenceType whence = wxBeginPosition) - { return m_parent_i_stream->SeekI(pos, whence); } + virtual off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart) + { return m_parent_i_stream->SeekI(pos, mode); } + virtual off_t TellI() const + { return m_parent_i_stream->TellI(); } virtual bool Eof() const { return m_parent_i_stream->Eof(); } virtual size_t LastRead() const { return m_parent_i_stream->LastRead(); } + protected: wxInputStream *m_parent_i_stream; }; -class wxFilterOuputStream: pubilc wxOutputStream { - DECLARE_CLASS(wxFilterOutputStream) +class wxFilterOutputStream: public wxOutputStream { public: wxFilterOutputStream(wxOutputStream& stream); virtual ~wxFilterOutputStream(); virtual wxOutputStream& Write(const void *buffer, size_t size) { return m_parent_o_stream->Write(buffer, size); } - virtual size_t SeekO(int pos, wxWhenceType whence = wxBeginPosition) - { return m_parent_o_stream->SeekO(pos, whence); } + virtual off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart) + { return m_parent_o_stream->SeekO(pos, mode); } + virtual off_t TellO() const + { return m_parent_o_stream->TellO(); } - virtual bool Eof() const { return m_parent_o_sream->Eof(); } - virtual size_t LastRead() const { return m_parent_o_stream->LastRead(); } + virtual bool Bad() const { return m_parent_o_stream->Bad(); } + virtual size_t LastWrite() const { return m_parent_o_stream->LastWrite(); } protected: wxOutputStream *m_parent_o_stream;