1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxStreamToTextRedirector documentation
4 %% Author: Vadim Zeitlin
8 %% Copyright: (c) 2001 Vadim Zeitlin <vadim@wxwindows.org>
9 %% License: wxWidgets license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxStreamToTextRedirector
}}\label{wxstreamtotextredirector
}
14 This class can be used to (temporarily) redirect all output sent to a C++
15 ostream object to a
\helpref{wxTextCtrl
}{wxtextctrl
} instead.
17 {\bf NB:
} Some compilers and/or build configurations don't support multiply
18 inheriting
\helpref{wxTextCtrl
}{wxtextctrl
} from
{\tt std::streambuf
} in which
19 case this class is not compiled in. You also must have
{\tt wxUSE
\_STD\_IOSTREAM}
20 option on (i.e. set to $
1$) in your setup.h to be able to use it. Under Unix,
21 specify
{\tt --enable-std
\_iostreams} switch when running configure for this.
28 wxTextCtrl *text = new wxTextCtrl(...);
31 wxStreamToTextRedirector redirect(text);
33 // this goes to the text control
34 cout << "Hello, text!" << endl;
37 // this goes somewhere else, presumably to stdout
38 cout << "Hello, console!" << endl;
42 \wxheading{Derived from
}
46 \wxheading{Include files
}
52 \helpref{wxTextCtrl
}{wxtextctrl
}
54 \latexignore{\rtfignore{\wxheading{Members
}}}
56 \membersection{wxStreamToTextRedirector::wxStreamToTextRedirector
}\label{wxstreamtotextredirectorctor
}
58 \func{}{wxStreamToTextRedirector
}{\param{wxTextCtrl
}{*text
},
\param{ostream *
}{ostr = NULL
}}
60 The constructor starts redirecting output sent to
{\it ostr
} or
{\it cout
} for
61 the default parameter value to the text control
{\it text
}.
63 \wxheading{Parameters
}
65 \docparam{text
}{The text control to append output too, must be non NULL
}
67 \docparam{ostr
}{The C++ stream to redirect,
{\it cout
} is used if it is NULL
}
69 \membersection{wxStreamToTextRedirector::
\destruct{wxStreamToTextRedirector
}}\label{wxstreamtotextredirectordtor
}
71 \func{}{\destruct{wxStreamToTextRedirector
}}{\void}
73 When a wxStreamToTextRedirector object is destroyed, the redirection is ended
74 and any output sent to the C++ ostream which had been specified at the time of
75 the object construction will go to its original destination.