25 #ifndef WTERMINALCOLOR_H
26 #define WTERMINALCOLOR_H
112 std::ostream&
operator<<( std::ostream& ostr )
const;
128 std::string
operator()(
const std::string s )
const;
137 std::string
operator+(
const std::string& istr )
const;
Helper class to provide a convenient way to colorize output on the console.
TerminalColorForeground
Foreground colors.
WTerminalColor()
Constructor to create a color code which actually does not do any coloring.
TerminalColorAttribute
Define possible attributes.
std::ostream & operator<<(std::ostream &ostr) const
Gives the control string which actually enables the color.
void setEnabled(bool enabled)
With this you can easily trigger whether the color control string is used or if "" is returned.
std::string m_colorString
The string actually containing the control sequence to enable colors on the console.
void generateControlStrings()
Actually generates the control sequences.
TerminalColorAttribute m_attrib
Color attributes.
std::string operator+(const std::string &istr) const
Combines strings.
std::string operator!() const
Resets the color and returns control string.
std::string m_colorResetString
Control sequence to reset color.
TerminalColorBackground
Background colors.
virtual ~WTerminalColor()
Destructor.
bool isEnabled() const
Is coloring enabled?
std::string operator()() const
Gives the control string which actually enables the color.
TerminalColorForeground m_foreground
The foreground color.
TerminalColorBackground m_background
The background color.
bool m_enabled
True when colors should are used.