![]() |
Computer Assited Medical Intervention Tool Kit
|
Directly inspired by this place. More...
#include <ConsoleStream.h>
Public Member Functions | |
ConsoleStream (std::ostream *stream, QTextEdit *textEdit) | |
constructor to use when you are sure about both paramaters | |
ConsoleStream () | |
default constructor, init(..) have to be called later, before first use | |
void | free () |
reset the state as it was before (stream use the old buffer again) | |
void | init (std::ostream *stream, QTextEdit *textEdit) |
initialize ConsoleStream using both input stream and output text edit | |
void | setStream (std::ostream *stream) |
set the value for the buffer to be replaced by the ConsoleStream | |
void | setTextEdit (QTextEdit *text_edit) |
set the log QTextEdit | |
~ConsoleStream () | |
destructor: use free() to restore previous stream output buffer |
Protected Member Functions | |
virtual int_type | overflow (int_type v) |
rewriting of the inherited method overflow | |
virtual std::streamsize | xsputn (const char *p, std::streamsize n) |
rewriting of the inherited method xsputn |
Private Attributes | |
QTextEdit * | logTextEdit |
std::ostream * | myStream |
std::string | myString |
std::streambuf * | previousBuffer |
Directly inspired by this place.
(see also this follow-up)
Usage:
Potential problem on windows (see thread)
|
inline |
constructor to use when you are sure about both paramaters
References init().
|
inline |
default constructor, init(..) have to be called later, before first use
References logTextEdit, myStream, and previousBuffer.
|
inline |
destructor: use free() to restore previous stream output buffer
References free(), logTextEdit, and myString.
|
inline |
reset the state as it was before (stream use the old buffer again)
References myStream, and previousBuffer.
Referenced by camitk::MainWindow::redirectToConsole(), setStream(), and ~ConsoleStream().
|
inline |
initialize ConsoleStream using both input stream and output text edit
References setStream(), and setTextEdit().
Referenced by ConsoleStream(), and camitk::MainWindow::redirectToConsole().
|
inlineprotectedvirtual |
rewriting of the inherited method overflow
References logTextEdit, and myString.
|
inline |
set the value for the buffer to be replaced by the ConsoleStream
References free(), myStream, and previousBuffer.
Referenced by init().
|
inline |
|
inlineprotectedvirtual |
rewriting of the inherited method xsputn
References logTextEdit, and myString.
|
private |
Referenced by ConsoleStream(), overflow(), setTextEdit(), xsputn(), and ~ConsoleStream().
|
private |
Referenced by ConsoleStream(), free(), and setStream().
|
private |
Referenced by overflow(), xsputn(), and ~ConsoleStream().
|
private |
Referenced by ConsoleStream(), free(), and setStream().