Belle II Software light-2406-ragdoll
|
Class to intercept stdout and stderr and either capture, discard or keep them unmodified depending on the template arguments. More...
#include <IOIntercept.h>
Public Member Functions | |
bool | start () |
Start intercepting the output. | |
bool | finish () |
Finish intercepting the output. | |
const std::string & | getStdOut () const |
Return the captured stdout output if any. | |
const std::string & | getStdErr () const |
Return the captured stderr output if any. | |
Private Attributes | |
STDOUT | m_stdout {std::cout, stdout} |
StreamInterceptor for stdout. | |
STDERR | m_stderr {std::cerr, stderr} |
StreamInterceptor for stderr. | |
Class to intercept stdout and stderr and either capture, discard or keep them unmodified depending on the template arguments.
For example
Shorthand classes are defined for all use cases, so in the above example we could have just used IOIntercept::CaptureStdOutDiscardStdErr;
Definition at line 151 of file IOIntercept.h.
|
inline |
Finish intercepting the output.
This function can be called multiple times.
Definition at line 158 of file IOIntercept.h.
|
inline |
Return the captured stderr output if any.
Only filled after finish() is called
Definition at line 166 of file IOIntercept.h.
|
inline |
Return the captured stdout output if any.
Only filled after finish() is called
Definition at line 160 of file IOIntercept.h.
|
inline |
Start intercepting the output.
This function can be called multiple times.
Definition at line 155 of file IOIntercept.h.
|
private |
StreamInterceptor for stderr.
Definition at line 176 of file IOIntercept.h.
|
private |
StreamInterceptor for stdout.
Definition at line 174 of file IOIntercept.h.