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