From: Vadim Zeitlin Date: Fri, 19 Sep 2003 22:17:38 +0000 (+0000) Subject: attemps to make wxStreamToTextRedirector work with more (broken) compilers X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9806a823b04b05f1f07121526e5a9fafb74689cd attemps to make wxStreamToTextRedirector work with more (broken) compilers git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h index 60107fca4f..eb69adfdc4 100644 --- a/include/wx/textctrl.h +++ b/include/wx/textctrl.h @@ -435,14 +435,26 @@ typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); class WXDLLEXPORT wxStreamToTextRedirector { -public: - wxStreamToTextRedirector(wxTextCtrl *text, wxSTD ostream *ostr = NULL) - : m_ostr(ostr ? *ostr : wxSTD cout) +private: + void Init() { m_sbufOld = m_ostr.rdbuf(); m_ostr.rdbuf(text); } +public: + wxStreamToTextRedirector(wxTextCtrl *text) + : m_ostr(wxSTD cout) + { + Init(); + } + + wxStreamToTextRedirector(wxTextCtrl *text, wxSTD ostream *ostr) + : m_ostr(*ostr) + { + Init(); + } + ~wxStreamToTextRedirector() { m_ostr.rdbuf(m_sbufOld);