17 #ifndef OSMANIP_MANIPULATORS_DECORATOR_HPP
18 #define OSMANIP_MANIPULATORS_DECORATOR_HPP
32 #include <string_view>
33 #include <unordered_map>
67 std::unordered_map<std::ostream *, std::string>
getColorList();
68 std::unordered_map<std::ostream *, std::string>
getStyleList();
77 std::unordered_map<std::ostream *, std::string> colors, styles;
78 std::ostream *current_stream;
103 std::vector<std::string> list_of_styles{
105 for (
auto elem: list_of_styles) {
Class used to decorate an output stream. Each setting is set permanently on the chosen output stream ...
Definition: decorator.hpp:49
std::string getStyle(std::ostream &os=osm::cout)
Method used to return the selected style of a stream.
Definition: decorator.cpp:151
void setStyle(const std::string &style, std::ostream &os=osm::cout)
Method used to set the style of a stream.
Definition: decorator.cpp:73
const Decorator & operator()(std::ostream &os=osm::cout)
Operator overload to assign the value into parentheses to the "current_stream" variable.
Definition: decorator.cpp:188
~Decorator()
Destructor of Decorator class.
Definition: decorator.cpp:46
Decorator()
Default constructor of Decorator class.
Definition: decorator.cpp:37
void resetStyle(std::ostream &os=osm::cout)
Method used to reset the style or of a stream.
Definition: decorator.cpp:96
std::unordered_map< std::ostream *, std::string > getColorList()
Method used to return the map of streams with the respective color.
Definition: decorator.cpp:159
void resetColor(std::ostream &os=osm::cout)
Method used to reset the color of a stream.
Definition: decorator.cpp:87
std::unordered_map< std::ostream *, std::string > getStyleList()
Method used to return the map of streams with the respective style.
Definition: decorator.cpp:167
std::string getColor(std::ostream &os=osm::cout)
Method used to return the selected color of a stream.
Definition: decorator.cpp:141
std::ostream & getCurrentStream()
Method used to return the stream that is used to output stuff.
Definition: decorator.cpp:175
void setColor(const std::string &color, std::ostream &os=osm::cout)
Method used to set the color of a stream.
Definition: decorator.cpp:59
void resetFeatures(std::ostream &os=osm::cout)
Method used to reset all the features of a stream.
Definition: decorator.cpp:123
void removeStyle(std::string_view style, std::ostream &os=osm::cout)
Method used to remove one of the set styles (useful in case they are more than one).
Definition: decorator.cpp:105
Definition: canvas.cpp:30
std::ostream & operator<<(Decorator my_shell, const T &elem)
Operator overload to output a modified ostream object which properties are set thanks to the Decorato...
Definition: decorator.hpp:98
const std::unordered_map< std::string, std::string > rst
It is used to store the reset features commands.
Definition: colsty.cpp:114
const std::unordered_map< std::string, std::string > sty
It is used to store the styles.
Definition: colsty.cpp:95
const std::unordered_map< std::string, std::string > col
It is used to store the colors. Note: "bg" is the prefix of the background color features and "bd" is...
Definition: colsty.cpp:39
std::vector< std::string > split_string(const std::string &input, const std::string ®ex)
Function used to split a string based on a certain reges.
Definition: generic.cpp:39
const std::string & feat(const std::unordered_map< std::string, std::string > &generic_map, const std::string &feat_string)
It takes an std::map object as the first argument and an std::string object (map key) as the second a...
Definition: common.cpp:41