1 #ifndef IOUTILITIES_ANSIESCAPECODES 2 #define IOUTILITIES_ANSIESCAPECODES 33 stream << '\e' << '[' << static_cast<char>(displayAttribute) <<
'm';
41 stream << '\e' << '[' << static_cast<char>(displayAttribute) <<
';' << static_cast<char>(context) <<
static_cast<char>(
color) <<
'm';
49 <<
static_cast<char>(foregroundColor) <<
';' << static_cast<char>(
ColorContext::Foreground) <<
static_cast<char>(backgroundColor)
61 inline void setCursor(std::ostream &stream,
unsigned int row = 0,
unsigned int col = 0)
64 stream <<
'\e' <<
'[' << row <<
';' << col <<
'H';
71 stream << '\e' << '[' << cells << static_cast<char>(direction);
111 return std::make_tuple(foreground, background, displayAttribute);
114 inline std::ostream &operator<<(std::ostream &stream, std::tuple<Color, Color, TextAttribute> displayAttribute)
116 setStyle(stream, std::get<0>(displayAttribute), std::get<1>(displayAttribute), std::get<2>(displayAttribute));
141 #endif // IOUTILITIES_ANSIESCAPECODES auto color(Color foreground, Color background, TextAttribute displayAttribute=TextAttribute::Reset)
Encapsulates functions for formatted terminal output using ANSI escape codes.
Phrases
The Phrases enum contains standard phrases which can be printed to any std::ostream.
void setStyle(std::ostream &stream, TextAttribute displayAttribute=TextAttribute::Reset)
void moveCursor(std::ostream &stream, unsigned int cells, Direction direction)
void restoreCursor(std::ostream &stream)
void eraseDisplay(std::ostream &stream)
CPP_UTILITIES_EXPORT bool enabled
Controls whether the functions inside the EscapeCodes namespace actually make use of escape codes...
void resetStyle(std::ostream &stream)
void eraseLine(std::ostream &stream)
void saveCursor(std::ostream &stream)
void setCursor(std::ostream &stream, unsigned int row=0, unsigned int col=0)
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
std::ostream & operator<<(std::ostream &stream, TextAttribute displayAttribute)