This class provides output redirection to a TGTextView in guaranteed exception safe way.
Use like this:
when guard goes out of scope, Update() is called to flush what left on the screed and the output is automatically redirected again to the standard units. The exception mechanism takes care of calling the dtors of local objects so it is exception safe. Optionally the output can also be saved into a file:
Definition at line 20 of file TGRedirectOutputGuard.h.
Public Member Functions | |
TGRedirectOutputGuard (TGTextView *tv, const char *flog=nullptr, const char *mode="a") | |
Create output redirection guard. | |
virtual | ~TGRedirectOutputGuard () |
Destructor. | |
virtual TClass * | IsA () const |
virtual void | Streamer (TBuffer &) |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
void | Update () |
Send to text frame the undisplayed content of the file. | |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Private Member Functions | |
TGRedirectOutputGuard (const TGRedirectOutputGuard &)=delete | |
TGRedirectOutputGuard & | operator= (const TGRedirectOutputGuard &)=delete |
Private Attributes | |
TString | fLogFile |
FILE * | fLogFileRead |
TGTextView * | fTextView |
Bool_t | fTmpFile |
#include <TGRedirectOutputGuard.h>
|
privatedelete |
TGRedirectOutputGuard::TGRedirectOutputGuard | ( | TGTextView * | tv, |
const char * | flog = nullptr , |
||
const char * | mode = "a" |
||
) |
Create output redirection guard.
The TGTextView instance should be initialized outside. Text is added to the existing text in the frame. If defined, 'flog' is interpreted as the path of a file where to save the output; in such a case 'mode' if the opening mode of the file (either "w" or "a"). By default a temporary file is used.
Definition at line 67 of file TGRedirectOutputGuard.cxx.
|
virtual |
Destructor.
Definition at line 121 of file TGRedirectOutputGuard.cxx.
|
static |
|
inlinestaticconstexpr |
Definition at line 39 of file TGRedirectOutputGuard.h.
|
inlinestatic |
Definition at line 39 of file TGRedirectOutputGuard.h.
|
inlinevirtual |
Definition at line 39 of file TGRedirectOutputGuard.h.
|
privatedelete |
|
virtual |
|
inline |
Definition at line 39 of file TGRedirectOutputGuard.h.
void TGRedirectOutputGuard::Update | ( | ) |
Send to text frame the undisplayed content of the file.
Definition at line 141 of file TGRedirectOutputGuard.cxx.
|
private |
Definition at line 23 of file TGRedirectOutputGuard.h.
|
private |
Definition at line 26 of file TGRedirectOutputGuard.h.
|
private |
Definition at line 25 of file TGRedirectOutputGuard.h.
|
private |
Definition at line 24 of file TGRedirectOutputGuard.h.