C++ Utilities 5.24.7
Useful C++ classes and routines such as argument parser, IO and conversion utilities
|
Encapsulates functions for formatted terminal output using ANSI escape codes. More...
Enumerations | |
enum class | Color : char { Black = '0' , Red , Green , Yellow , Blue , Purple , Cyan , White } |
enum class | ColorContext : char { Foreground = '3' , Background = '4' } |
enum class | TextAttribute : char { Reset = '0' , Bold = '1' , Dim = '2' , Italic = '3' , Underscore = '4' , Blink = '5' , ReverseVideo = '7' , Concealed = '8' , Strikethrough = '9' } |
enum class | Direction : char { Up = 'A' , Down = 'B' , Forward = 'C' , Backward = 'D' } |
enum class | Phrases { Error , Warning , End , PlainMessage , SuccessMessage , SubMessage , ErrorMessage , WarningMessage , EndFlush , Info , Override , SubError , SubWarning , InfoMessage } |
The Phrases enum contains standard phrases which can be printed to any std::ostream and obtained as strings via EscapeCodes::phraseString() and EscapeCodes::formattedPhraseString(). More... | |
Variables | |
CPP_UTILITIES_EXPORT bool | enabled |
Controls whether the functions inside the EscapeCodes namespace actually make use of escape codes. | |
Encapsulates functions for formatted terminal output using ANSI escape codes.
|
strong |
Enumerator | |
---|---|
Black | |
Red | |
Green | |
Yellow | |
Blue | |
Purple | |
Cyan | |
White |
Definition at line 16 of file ansiescapecodes.h.
Enumerator | |
---|---|
Foreground | |
Background |
Definition at line 18 of file ansiescapecodes.h.
Enumerator | |
---|---|
Up | |
Down | |
Forward | |
Backward |
Definition at line 32 of file ansiescapecodes.h.
The Phrases enum contains standard phrases which can be printed to any std::ostream and obtained as strings via EscapeCodes::phraseString() and EscapeCodes::formattedPhraseString().
Example: std::cerr << Phrases::Error << "Something bad happened." << Phrases::End
Definition at line 138 of file ansiescapecodes.h.
Enumerator | |
---|---|
Reset | |
Bold | |
Dim | |
Italic | |
Underscore | |
Blink | |
ReverseVideo | |
Concealed | |
Strikethrough |
Definition at line 20 of file ansiescapecodes.h.
|
constexpr |
Definition at line 113 of file ansiescapecodes.h.
|
constexpr |
Definition at line 118 of file ansiescapecodes.h.
|
inline |
Definition at line 93 of file ansiescapecodes.h.
|
inline |
Definition at line 100 of file ansiescapecodes.h.
std::string_view CppUtilities::EscapeCodes::formattedPhraseString | ( | Phrases | phrase | ) |
Returns a string for the specified phrase which is formatted using ANSI escape codes.
Definition at line 159 of file ansiescapecodes.cpp.
|
inline |
Definition at line 72 of file ansiescapecodes.h.
std::ostream & CppUtilities::EscapeCodes::operator<< | ( | std::ostream & | stream, |
Phrases | phrase ) |
Prints the specified phrase in a formatted manner using ANSI escape codes.
Definition at line 33 of file ansiescapecodes.cpp.
|
inline |
Definition at line 107 of file ansiescapecodes.h.
|
inline |
Definition at line 126 of file ansiescapecodes.h.
std::string_view CppUtilities::EscapeCodes::phraseString | ( | Phrases | phrase | ) |
Returns a string for the specified phrase without formatting.
Definition at line 120 of file ansiescapecodes.cpp.
|
inline |
Definition at line 58 of file ansiescapecodes.h.
|
inline |
Definition at line 86 of file ansiescapecodes.h.
|
inline |
Definition at line 79 of file ansiescapecodes.h.
|
inline |
Definition at line 65 of file ansiescapecodes.h.
|
inline |
Definition at line 41 of file ansiescapecodes.h.
|
inline |
Definition at line 49 of file ansiescapecodes.h.
|
inline |
Definition at line 34 of file ansiescapecodes.h.
bool CppUtilities::EscapeCodes::enabled |
Controls whether the functions inside the EscapeCodes namespace actually make use of escape codes.
This allows to disable use of escape codes when not appropriate.
The default value can be configured at build time by setting the CMake variable ENABLE_ESCAPE_CODES_BY_DEFAULT. The "default for the default" is true. However, the default is overridden with the value of the environment variable ENABLE_ESCAPE_CODES when instantiating a NoColorArgument (if ENABLE_ESCAPE_CODES is present).
Definition at line 22 of file ansiescapecodes.cpp.