HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
Loading...
Searching...
No Matches
style.h
Go to the documentation of this file.
1#ifndef INCLUDE_ASCII_STYLE_H_
2#define INCLUDE_ASCII_STYLE_H_
3#include "color.h"
4
5namespace ascii {
6class Style {
7public:
9 : fg_(Foreground::From(Color::RESET)),
10 bg_(Background::From(Color::RESET)), decorations_({}) {}
11
13 fg_ = fg;
14 return *this;
15 }
16
18 bg_ = bg;
19 return *this;
20 }
21
23 decorations_.push_back(decoration);
24 return *this;
25 }
26
27 friend std::ostream &operator<<(std::ostream &os, const Style &val) {
28 for (auto &item : val.decorations_) {
29 os << item;
30 }
31 os << Foreground(val.fg_) << Background(val.bg_);
32 return os;
33 }
34
35private:
36 Foreground fg_;
37 Background bg_;
38 std::vector<Decoration> decorations_;
39};
40
41} // namespace ascii
42#endif // !INCLUDE_ASCII_STYLE_H_
Definition color.h:132
Definition color.h:59
Definition color.h:94
Definition style.h:6
Style & fg(Foreground fg)
Definition style.h:12
friend std::ostream & operator<<(std::ostream &os, const Style &val)
Definition style.h:27
Style()
Definition style.h:8
Style & AddDecoration(Decoration decoration)
Definition style.h:22
Style & bg(Background bg)
Definition style.h:17
for detailed info, refered to https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797.
Definition ascii.h:17
Color
Definition color.h:15