X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/23a54e14a71e9184c3c33c2ba39b10ee1dd029b6..de6019fb157459e7e7610e3ff813ad8c4a3225cf:/include/wx/stream.h diff --git a/include/wx/stream.h b/include/wx/stream.h index 5a95880ffb..efef1ec113 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -93,7 +93,7 @@ class WXDLLEXPORT wxInputStream: public wxStreamBase { virtual size_t LastRead() { return wxStreamBase::m_lastcount; } // Ungetch - size_t Ungetch(void *buffer, size_t size); + size_t Ungetch(const void *buffer, size_t size); bool Ungetch(char c); // Operators @@ -136,6 +136,28 @@ class WXDLLEXPORT wxOutputStream: public wxStreamBase { wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); } }; +// --------------------------------------------------------------------------- +// A stream for measuring streamed output +// --------------------------------------------------------------------------- + +class wxCountingOutputStream: public wxOutputStream { + public: + wxCountingOutputStream(); + + size_t GetSize() const; + bool Ok() const { return TRUE; } + + protected: + + size_t OnSysWrite(const void *buffer, size_t size); + off_t OnSysSeek(off_t pos, wxSeekMode mode); + off_t OnSysTell() const; + + protected: + size_t m_currentPos; +}; + + // --------------------------------------------------------------------------- // "Filter" streams // --------------------------------------------------------------------------- @@ -148,7 +170,6 @@ class WXDLLEXPORT wxFilterInputStream: public wxInputStream { char Peek() { return m_parent_i_stream->Peek(); } - wxStreamError LastError() const { return m_parent_i_stream->LastError(); } size_t GetSize() const { return m_parent_i_stream->GetSize(); } protected: @@ -161,7 +182,6 @@ class WXDLLEXPORT wxFilterOutputStream: public wxOutputStream { wxFilterOutputStream(wxOutputStream& stream); ~wxFilterOutputStream(); - wxStreamError LastError() const { return m_parent_o_stream->LastError(); } size_t GetSize() const { return m_parent_o_stream->GetSize(); } protected: @@ -194,6 +214,7 @@ class WXDLLEXPORT wxStreamBuffer { size_t Write(const void *buffer, size_t size); size_t Write(wxStreamBuffer *buf); + char Peek(); char GetChar(); void PutChar(char c); off_t Tell() const; @@ -251,6 +272,7 @@ class wxBufferedInputStream: public wxFilterInputStream { wxBufferedInputStream(wxInputStream& stream); ~wxBufferedInputStream(); + char Peek(); wxInputStream& Read(void *buffer, size_t size); // Position functions