From 0cd9bfe8dacee998429236912c831fd2472163a8 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Tue, 14 Jul 1998 16:35:50 +0000 Subject: [PATCH] * wxMemory*Stream link problem fix. * wxData*Stream update. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/stream.h | 12 ++++++------ src/common/datstrm.cpp | 36 ------------------------------------ src/common/mstream.cpp | 8 ++++++++ 3 files changed, 14 insertions(+), 42 deletions(-) diff --git a/include/wx/stream.h b/include/wx/stream.h index 3fef67ff56..b2a889a9bf 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -43,6 +43,8 @@ class wxInputStream: virtual public wxObject { virtual bool Eof() const = 0; virtual size_t LastRead() const = 0; + + wxInputStream& operator>>(wxOutputStream& out) { return Read(out); } }; class wxOutputStream: virtual public wxObject { @@ -63,12 +65,6 @@ class wxOutputStream: virtual public wxObject { virtual void Sync() {} }; -class wxStream: virtual public wxInputStream, virtual public wxOutputStream { - public: - wxStream() {} - virtual ~wxStream() { } -}; - /* * "Filter" streams */ @@ -83,6 +79,8 @@ class wxFilterInputStream: public wxInputStream { { return m_parent_i_stream->Read(buffer, size); } 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(); } @@ -101,6 +99,8 @@ class wxFilterOutputStream: public wxOutputStream { { return m_parent_o_stream->Write(buffer, size); } 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 Bad() const { return m_parent_o_stream->Bad(); } virtual size_t LastWrite() const { return m_parent_o_stream->LastWrite(); } diff --git a/src/common/datstrm.cpp b/src/common/datstrm.cpp index 3f456cca7c..f5fdaa1bd4 100644 --- a/src/common/datstrm.cpp +++ b/src/common/datstrm.cpp @@ -44,9 +44,6 @@ unsigned long wxDataInputStream::Read32() { char buf[4]; - if (!m_parent_i_stream) - return 0; - Read(buf, 4); return (unsigned long)buf[0] | @@ -59,9 +56,6 @@ unsigned short wxDataInputStream::Read16() { char buf[2]; - if (!m_parent_i_stream) - return 0; - Read(buf, 2); return (unsigned short)buf[0] | @@ -72,9 +66,6 @@ unsigned char wxDataInputStream::Read8() { char buf; - if (!m_parent_i_stream) - return 0; - Read(&buf, 1); return (unsigned char)buf; } @@ -87,9 +78,6 @@ double wxDataInputStream::ReadDouble() #if USE_APPLE_IEEE char buf[10]; - if (!m_parent_i_stream) - return 0.0; - Read(buf, 10); return ConvertFromIeeeExtended((unsigned char *)buf); #else @@ -101,9 +89,6 @@ wxString wxDataInputStream::ReadLine() { char i_strg[255]; - if (!m_parent_i_stream) - return ""; - // TODO: Implement ReadLine return i_strg; } @@ -114,9 +99,6 @@ wxString wxDataInputStream::ReadString() char *string; unsigned long len; - if (!m_parent_i_stream) - return ""; - len = Read32(); string = new char[len+1]; @@ -142,9 +124,6 @@ void wxDataOutputStream::Write32(unsigned long i) { char buf[4]; - if (!m_parent_o_stream) - return; - buf[0] = i & 0xff; buf[1] = (i >> 8) & 0xff; buf[2] = (i >> 16) & 0xff; @@ -156,9 +135,6 @@ void wxDataOutputStream::Write16(unsigned short i) { char buf[2]; - if (!m_parent_o_stream) - return; - buf[0] = i & 0xff; buf[1] = (i >> 8) & 0xff; Write(buf, 2); @@ -166,9 +142,6 @@ void wxDataOutputStream::Write16(unsigned short i) void wxDataOutputStream::Write8(unsigned char i) { - if (!m_parent_o_stream) - return; - Write(&i, 1); } @@ -180,17 +153,11 @@ void wxDataOutputStream::WriteLine(const wxString& line) wxString tmp_string = line + '\n'; #endif - if (!m_parent_o_stream) - return; - Write((const char *) tmp_string, tmp_string.Length()); } void wxDataOutputStream::WriteString(const wxString& string) { - if (!m_parent_o_stream) - return; - Write32(string.Length()); Write((const char *) string, string.Length()); } @@ -202,9 +169,6 @@ void wxDataOutputStream::WriteDouble(double d) { char buf[10]; - if (!m_parent_o_stream) - return; - #if USE_APPLE_IEEE ConvertToIeeeExtended(d, (unsigned char *)buf); #else diff --git a/src/common/mstream.cpp b/src/common/mstream.cpp index d37a9ddaa3..d19b9755df 100644 --- a/src/common/mstream.cpp +++ b/src/common/mstream.cpp @@ -75,6 +75,10 @@ wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len) m_iolimit = 1; } +wxMemoryInputStream::~wxMemoryInputStream() +{ +} + wxInputStream& wxMemoryInputStream::Read(void *buffer, size_t size) { if (m_iolimit == 2) { @@ -133,6 +137,10 @@ wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len) m_iolimit = 2; } +wxMemoryOutputStream::~wxMemoryOutputStream() +{ +} + wxOutputStream& wxMemoryOutputStream::Write(const void *buffer, size_t size) { if (m_iolimit == 1) { -- 2.45.2