Class used to decorate an output stream. Each setting is set permanently on the chosen output stream until the destructor is met or one of the reset functions is called.
More...
#include <printer.hpp>
|
| OS_Decorator () |
| Default constructor of OS_Decorator class. More...
|
|
| ~OS_Decorator () |
| Destructor of OS_Decorator class. More...
|
|
void | setColor (const std::string &color, std::ostream &os=std::cout) |
| Method used to set the color of a stream. More...
|
|
void | setStyle (const std::string &style, std::ostream &os=std::cout) |
| Method used to set the style of a stream. More...
|
|
void | resetColor (std::ostream &os=std::cout) |
| Method used to reset the color of a stream. More...
|
|
void | resetStyle (std::ostream &os=std::cout) |
| Method used to reset the style or of a stream. More...
|
|
void | removeStyle (const std::string &style, std::ostream &os=std::cout) |
| Method used to remove one of the set styles (useful in case they are more than one). More...
|
|
void | resetFeatures (std::ostream &os=std::cout) |
| Method used to reset all the features of a stream. More...
|
|
std::string | getColor (std::ostream &os=std::cout) |
| Method used to return the selected color of a stream. More...
|
|
std::string | getStyle (std::ostream &os=std::cout) |
| Method used to return the selected style of a stream. More...
|
|
std::unordered_map< std::ostream *, std::string > | getColorList () |
| Method used to return the map of streams with the respective color. More...
|
|
std::unordered_map< std::ostream *, std::string > | getStyleList () |
| Method used to return the map of streams with the respective style. More...
|
|
std::ostream & | getCurrentStream () |
| Method used to return the stream that is used to output stuff. More...
|
|
const OS_Decorator & | operator() (std::ostream &os=std::cout) |
| Operator overload to assign the value into parentheses to the "current_stream" variable. More...
|
|
Class used to decorate an output stream. Each setting is set permanently on the chosen output stream until the destructor is met or one of the reset functions is called.
◆ OS_Decorator()
osm::OS_Decorator::OS_Decorator |
( |
| ) |
|
◆ ~OS_Decorator()
osm::OS_Decorator::~OS_Decorator |
( |
| ) |
|
◆ getColor()
std::string osm::OS_Decorator::getColor |
( |
std::ostream & |
os = std::cout | ) |
|
Method used to return the selected color of a stream.
- Parameters
-
os | The stream which color is returned. Default is std::cout. |
- Returns
- std::string The current color of the stream.
◆ getColorList()
std::unordered_map< std::ostream *, std::string > osm::OS_Decorator::getColorList |
( |
| ) |
|
Method used to return the map of streams with the respective color.
- Returns
- std::map <std::ostream*, std::string> The stream-color map.
◆ getCurrentStream()
std::ostream & osm::OS_Decorator::getCurrentStream |
( |
| ) |
|
Method used to return the stream that is used to output stuff.
- Returns
- std::ostream& The used stream to output stuff.
◆ getStyle()
std::string osm::OS_Decorator::getStyle |
( |
std::ostream & |
os = std::cout | ) |
|
Method used to return the selected style of a stream.
- Parameters
-
os | The stream which style is returned. Default is std::cout. |
- Returns
- std::string The current style of the stream.
◆ getStyleList()
std::unordered_map< std::ostream *, std::string > osm::OS_Decorator::getStyleList |
( |
| ) |
|
Method used to return the map of streams with the respective style.
- Returns
- std::map <std::ostream*, std::string> The stream-color map.
◆ operator()()
const OS_Decorator & osm::OS_Decorator::operator() |
( |
std::ostream & |
os = std::cout | ) |
|
Operator overload to assign the value into parentheses to the "current_stream" variable.
- Parameters
-
os | Input value, i.e. the stream put into parentheses. |
- Returns
- const OS_Decorator& The class pointer.
◆ removeStyle()
void osm::OS_Decorator::removeStyle |
( |
const std::string & |
style, |
|
|
std::ostream & |
os = std::cout |
|
) |
| |
Method used to remove one of the set styles (useful in case they are more than one).
- Parameters
-
color | The style to be reset for the stream. |
os | The stream to be modified. Default is std::cout. |
◆ resetColor()
void osm::OS_Decorator::resetColor |
( |
std::ostream & |
os = std::cout | ) |
|
Method used to reset the color of a stream.
- Parameters
-
color | The color to be reset for the stream. |
os | The stream to be modified. Default is std::cout. |
◆ resetFeatures()
void osm::OS_Decorator::resetFeatures |
( |
std::ostream & |
os = std::cout | ) |
|
Method used to reset all the features of a stream.
- Parameters
-
os | The stream to be modified. Default is std::cout. |
◆ resetStyle()
void osm::OS_Decorator::resetStyle |
( |
std::ostream & |
os = std::cout | ) |
|
Method used to reset the style or of a stream.
- Parameters
-
color | The style to be reset for the stream. |
os | The stream to be modified. Default is std::cout. |
◆ setColor()
void osm::OS_Decorator::setColor |
( |
const std::string & |
color, |
|
|
std::ostream & |
os = std::cout |
|
) |
| |
Method used to set the color of a stream.
- Parameters
-
color | The color to be set for the stream. |
os | The stream to be modified. Default is std::cout. |
◆ setStyle()
void osm::OS_Decorator::setStyle |
( |
const std::string & |
style, |
|
|
std::ostream & |
os = std::cout |
|
) |
| |
Method used to set the style of a stream.
- Parameters
-
color | The style to be set for the stream. |
os | The stream to be modified. Default is std::cout. |
The documentation for this class was generated from the following files: