1.3.49
 
Loading...
Searching...
No Matches
helios::capture_cerr Struct Reference

A utility struct to capture and store what is written to std::cerr. More...

#include <global.h>

Public Member Functions

std::string get_captured_output () const
 Get the captured cerr 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
 

Detailed Description

A utility struct to capture and store what is written to std::cerr.

This struct redirects the std::cerr stream to an internal string stream while an instance of the struct exists. When the struct is destroyed, it restores the original std::cerr output stream. The captured output can be queried and cleared as needed.

Definition at line 1330 of file global.h.

Constructor & Destructor Documentation

◆ capture_cerr()

helios::capture_cerr::capture_cerr ( )
inline

Definition at line 1334 of file global.h.

◆ ~capture_cerr()

helios::capture_cerr::~capture_cerr ( )
inline

Definition at line 1338 of file global.h.

Member Function Documentation

◆ clear()

void helios::capture_cerr::clear ( )
inline

Clear the captured output.

Definition at line 1353 of file global.h.

◆ get_captured_output()

std::string helios::capture_cerr::get_captured_output ( ) const
inline

Get the captured cerr output as a string.

Definition at line 1343 of file global.h.

◆ has_output()

bool helios::capture_cerr::has_output ( ) const
inline

Check if any output has been captured.

Definition at line 1348 of file global.h.

◆ size()

size_t helios::capture_cerr::size ( ) const
inline

Get the number of characters captured.

Definition at line 1359 of file global.h.

Field Documentation

◆ captured_stream

std::ostringstream helios::capture_cerr::captured_stream

Definition at line 1332 of file global.h.

◆ old_buf

std::streambuf* helios::capture_cerr::old_buf

Definition at line 1331 of file global.h.


The documentation for this struct was generated from the following file: