Elaboradar  0.1
term.h
1 #ifndef RADARELAB_UTILS_TERM_H
2 #define RADARELAB_UTILS_TERM_H
3 
11 #include <cstdio>
12 #include <string>
13 
14 namespace radarelab {
15 namespace utils {
16 namespace term {
17 
18 struct Terminal
19 {
20  static const unsigned black;
21  static const unsigned red;
22  static const unsigned green;
23  static const unsigned yellow;
24  static const unsigned blue;
25  static const unsigned magenta;
26  static const unsigned cyan;
27  static const unsigned white;
28  static const unsigned bright;
29 
30  FILE* out;
31  bool isatty;
32 
33  struct Restore
34  {
35  Terminal& term;
36 
37  Restore(Terminal& term);
38  ~Restore();
39  };
40 
41  Terminal(FILE* out);
42 
43  Restore set_color(int fg, int bg);
44  Restore set_color_fg(int col);
45  Restore set_color_bg(int col);
46 
47  std::string color(int fg, int bg, const std::string& s);
48  std::string color_fg(int col, const std::string& s);
49  std::string color_bg(int col, const std::string& s);
50 
51  operator FILE*() { return out; }
52 };
53 
54 }
55 }
56 }
57 
58 #endif
String functions.
Definition: cart.cpp:4