12 #include <wx/string.h>    13 #include <wx/textctrl.h>    14 #include <wx/thread.h>    53         wxTextCtrl* obj, 
bool yieldApplication = 
false, 
int bufferSize = 3000,
    54         bool also_cerr = 
false, 
bool threadSafe = 
false,
    55         bool also_to_cout_cerr = 
false)
    64             m_buf.resize(bufferSize);
    68             setp(
nullptr, 
nullptr);
    71         sbOld = std::cout.rdbuf();
    72         std::cout.rdbuf(
this);
    77             std::cerr.rdbuf(
this);
    85         std::cout.rdbuf(
sbOld);
    95             const auto s = wxString(str);
    97 #if wxCHECK_VERSION(3, 0, 0) && !defined(__APPLE__)  // OSX build error?    98             m_txt->GetEventHandler()->CallAfter(&wxTextCtrl::WriteText, s);
   111             wxTheApp->Yield(
true);  
   120         wxCriticalSectionLocker lock(
m_cs);
   141             wxCriticalSectionLocker lock(
m_cs);
   142             if (pbase() == epptr())
   157         wxCriticalSectionLocker lock(
m_cs);
   159         if (pbase() != pptr())
   161             int len = int(pptr() - pbase());
   162             std::string temp(pbase(), len);
   164             setp(pbase(), epptr());
 
const bool m_also_to_cout_cerr
 
This auxiliary class redirects the output sent to a streambuf to a wxTextCtrl object. 
 
const bool m_yieldApplication
 
std::streambuf * sbOldErr
 
int overflow(int c) override
 
~CMyRedirector() override
 
virtual void writeString(const std::string &str)
 
std::vector< char > m_buf
 
CMyRedirector(wxTextCtrl *obj, bool yieldApplication=false, int bufferSize=3000, bool also_cerr=false, bool threadSafe=false, bool also_to_cout_cerr=false)
 
void dumpNow()
Writes all the stored strings to the text control (only for threadSafe mode).