From 6285e36ba0e3861efbaaba2097a15fc1a536cc46 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 14 Apr 2007 23:35:13 +0000 Subject: [PATCH] added wxRTTI macros to stream classes (patch 1687073) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/mstream.h | 2 ++ include/wx/stream.h | 8 +++++++- src/common/mstream.cpp | 4 ++++ src/common/stream.cpp | 12 ++++++++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 398331b27d..167463a8ee 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -80,6 +80,7 @@ All: - Added wxMemoryInputStream(wxInputStream&) ctor (Stas Sergeev) - Implemented wxMemoryInputStream::CanRead() - Added wxEXEC_BLOCK flag (Hank Schultz) +- Add support for wxStream-derived classes to wxRTTI (Stas Sergeev) All (GUI): diff --git a/include/wx/mstream.h b/include/wx/mstream.h index 9ed77087f9..d3a1e0ab9b 100644 --- a/include/wx/mstream.h +++ b/include/wx/mstream.h @@ -63,6 +63,7 @@ private: size_t m_length; // copy ctor is implemented above: it copies the other stream in this one + DECLARE_ABSTRACT_CLASS(wxMemoryInputStream) DECLARE_NO_ASSIGN_CLASS(wxMemoryInputStream) }; @@ -92,6 +93,7 @@ protected: wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); wxFileOffset OnSysTell() const; + DECLARE_DYNAMIC_CLASS(wxMemoryOutputStream) DECLARE_NO_COPY_CLASS(wxMemoryOutputStream) }; diff --git a/include/wx/stream.h b/include/wx/stream.h index 2452244060..f0c1ce170c 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -52,7 +52,7 @@ const int wxEOF = -1; // wxStreamBase: common (but non virtual!) base for all stream classes // --------------------------------------------------------------------------- -class WXDLLIMPEXP_BASE wxStreamBase +class WXDLLIMPEXP_BASE wxStreamBase : public wxObject { public: wxStreamBase(); @@ -82,6 +82,7 @@ protected: friend class wxStreamBuffer; + DECLARE_ABSTRACT_CLASS(wxStreamBase) DECLARE_NO_COPY_CLASS(wxStreamBase) }; @@ -216,6 +217,7 @@ protected: friend class wxStreamBuffer; + DECLARE_ABSTRACT_CLASS(wxInputStream) DECLARE_NO_COPY_CLASS(wxInputStream) }; @@ -251,6 +253,7 @@ protected: friend class wxStreamBuffer; + DECLARE_ABSTRACT_CLASS(wxOutputStream) DECLARE_NO_COPY_CLASS(wxOutputStream) }; @@ -278,6 +281,7 @@ protected: size_t m_currentPos; + DECLARE_DYNAMIC_CLASS(wxCountingOutputStream) DECLARE_NO_COPY_CLASS(wxCountingOutputStream) }; @@ -303,6 +307,7 @@ protected: wxInputStream *m_parent_i_stream; bool m_owns; + DECLARE_ABSTRACT_CLASS(wxFilterInputStream) DECLARE_NO_COPY_CLASS(wxFilterInputStream) }; @@ -324,6 +329,7 @@ protected: wxOutputStream *m_parent_o_stream; bool m_owns; + DECLARE_ABSTRACT_CLASS(wxFilterOutputStream) DECLARE_NO_COPY_CLASS(wxFilterOutputStream) }; diff --git a/src/common/mstream.cpp b/src/common/mstream.cpp index cd8ec4ecb8..24252d273c 100644 --- a/src/common/mstream.cpp +++ b/src/common/mstream.cpp @@ -42,6 +42,8 @@ // wxMemoryInputStream // ---------------------------------------------------------------------------- +IMPLEMENT_ABSTRACT_CLASS(wxMemoryInputStream, wxInputStream) + wxMemoryInputStream::wxMemoryInputStream(const void *data, size_t len) { m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read); @@ -151,6 +153,8 @@ wxFileOffset wxMemoryInputStream::OnSysTell() const // wxMemoryOutputStream // ---------------------------------------------------------------------------- +IMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxOutputStream) + wxMemoryOutputStream::wxMemoryOutputStream(void *data, size_t len) { m_o_streambuf = new wxStreamBuffer(wxStreamBuffer::write); diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 4765ea03f6..1f1c94c688 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -657,6 +657,8 @@ wxFileOffset wxStreamBuffer::Tell() const // wxStreamBase // ---------------------------------------------------------------------------- +IMPLEMENT_ABSTRACT_CLASS(wxStreamBase, wxObject) + wxStreamBase::wxStreamBase() { m_lasterror = wxSTREAM_NO_ERROR; @@ -693,6 +695,8 @@ wxFileOffset wxStreamBase::OnSysTell() const // wxInputStream // ---------------------------------------------------------------------------- +IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxStreamBase) + wxInputStream::wxInputStream() { m_wback = NULL; @@ -938,6 +942,8 @@ wxFileOffset wxInputStream::TellI() const // wxOutputStream // ---------------------------------------------------------------------------- +IMPLEMENT_ABSTRACT_CLASS(wxOutputStream, wxStreamBase) + wxOutputStream::wxOutputStream() { } @@ -988,6 +994,8 @@ void wxOutputStream::Sync() // wxCountingOutputStream // ---------------------------------------------------------------------------- +IMPLEMENT_DYNAMIC_CLASS(wxCountingOutputStream, wxOutputStream) + wxCountingOutputStream::wxCountingOutputStream () { m_currentPos = 0; @@ -1050,6 +1058,8 @@ wxFileOffset wxCountingOutputStream::OnSysTell() const // wxFilterInputStream // ---------------------------------------------------------------------------- +IMPLEMENT_ABSTRACT_CLASS(wxFilterInputStream, wxInputStream) + wxFilterInputStream::wxFilterInputStream() : m_parent_i_stream(NULL), m_owns(false) @@ -1078,6 +1088,8 @@ wxFilterInputStream::~wxFilterInputStream() // wxFilterOutputStream // ---------------------------------------------------------------------------- +IMPLEMENT_ABSTRACT_CLASS(wxFilterOutputStream, wxOutputStream) + wxFilterOutputStream::wxFilterOutputStream() : m_parent_o_stream(NULL), m_owns(false) -- 2.45.2