A utility struct to capture and store what is written to std::cout
.
More...
#include <global.h>
Public Member Functions | |
std::string | get_captured_output () const |
Get the captured cout output as a string. | |
bool | has_output () const |
Check if any output has been captured. | |
void | clear () |
Clear the captured output. | |
size_t | size () const |
Get the number of characters captured. | |
Data Fields | |
std::streambuf * | old_buf |
std::ostringstream | captured_stream |
A utility struct to capture and store what is written to std::cout
.
This struct redirects the std::cout
stream to an internal string stream while an instance of the struct exists. When the struct is destroyed, it restores the original std::cout
output stream. The captured output can be queried and cleared as needed.
|
inline |
|
inline |
|
inline |
|
inline |