C++ Utilities  4.10.0
Common C++ classes and routines used by my applications such as argument parser, IO and conversion utilities
ansiescapecodes.cpp
Go to the documentation of this file.
1 #include "./ansiescapecodes.h"
2 
3 namespace EscapeCodes {
4 
8 std::ostream &operator<<(std::ostream &stream, Phrases phrase)
9 {
10  switch (phrase) {
11  case Phrases::Error:
13  stream << "Error: ";
16  break;
17  case Phrases::Warning:
19  stream << "Warning: ";
22  break;
23  case Phrases::End:
25  stream << '\n';
26  break;
28  stream << " ";
31  break;
34  stream << "==> ";
37  break;
40  stream << " -> ";
43  break;
46  stream << "==> ERROR: ";
49  break;
52  stream << "==> WARNING: ";
55  break;
56  }
57  return stream;
58 }
59 
60 } // namespace EscapeCodes
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)
std::ostream & operator<<(std::ostream &stream, TextAttribute displayAttribute)