osmanip
Library with useful output stream tools like: color and style manipulators, progress bars and terminal graphics.
Public Member Functions | List of all members
osm::Ostreambuf Class Reference

This class inherits Stringbuf and adds the ability to send output to a specific std::ostream buffer as well as redirect output to osm::redirout. More...

#include <sstream.hpp>

Inheritance diagram for osm::Ostreambuf:
Inheritance graph
[legend]
Collaboration diagram for osm::Ostreambuf:
Collaboration graph
[legend]

Public Member Functions

 Ostreambuf ()
 Construct a new Ostreambuf object. Default constructor will set the main attributes to default values. More...
 
 Ostreambuf (std::ostream *ostream)
 Construct a new Ostreambuf object. More...
 
 ~Ostreambuf () override
 Destructs OutputRedirector object. Calls this->pubsync() before being destroyed. More...
 
void setOstream (std::ostream *ostream)
 Sets the std::ostream* object to route output. If there is already an std::ostream* present, it will be flushed before it is replaced. More...
 
std::ostream * getOstream ()
 Returns the current std::ostream* object. More...
 
int32_t sync () override
 Synchronizes the buffer with the specified object. More...
 
- Public Member Functions inherited from osm::Stringbuf
 Stringbuf ()
 Construct a new Stringbuf object. Default constructor will set the main attributes to default values. More...
 
 ~Stringbuf () override
 Destructs OutputRedirector object. Calls this->pubsync() before being destroyed. More...
 
std::mutex & getMutex ()
 Get the mutex for the object. More...
 
int32_t sync () override
 Calls the base class sync() function. More...
 

Detailed Description

This class inherits Stringbuf and adds the ability to send output to a specific std::ostream buffer as well as redirect output to osm::redirout.

Constructor & Destructor Documentation

◆ Ostreambuf() [1/2]

osm::Ostreambuf::Ostreambuf ( )

Construct a new Ostreambuf object. Default constructor will set the main attributes to default values.

◆ Ostreambuf() [2/2]

osm::Ostreambuf::Ostreambuf ( std::ostream *  out)
explicit

Construct a new Ostreambuf object.

Parameters
outthe std::ostream object to use to output the buffer data.

◆ ~Ostreambuf()

osm::Ostreambuf::~Ostreambuf ( )
override

Destructs OutputRedirector object. Calls this->pubsync() before being destroyed.

Member Function Documentation

◆ getOstream()

std::ostream * osm::Ostreambuf::getOstream ( )

Returns the current std::ostream* object.

Returns
if present, the std::ostream* object. Otherwise, nullptr.

◆ setOstream()

void osm::Ostreambuf::setOstream ( std::ostream *  ostream)

Sets the std::ostream* object to route output. If there is already an std::ostream* present, it will be flushed before it is replaced.

◆ sync()

int32_t osm::Ostreambuf::sync ( )
override

Synchronizes the buffer with the specified object.

Returns
the error state of the stream buffer.

The documentation for this class was generated from the following files: