HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
Loading...
Searching...
No Matches
text.h
Go to the documentation of this file.
1#ifndef INCLUDE_ASCII_TEXT_H_
2#define INCLUDE_ASCII_TEXT_H_
3#include "style.h"
4
5namespace ascii {
6class Text {
7public:
8 Text() {}
9 Text(std::string text) : text_(text) {}
10 Text(std::string text, Style style) : text_(text), style_(style) {}
11
13 style_ = style;
14 return *this;
15 }
16
17 Text &text(std::string text) {
18 text_ = text;
19 return *this;
20 }
21
22 std::string text() { return text_; }
23
24 friend std::ostream &operator<<(std::ostream &os, const Text &val) {
25 os << val.style_ << val.text_ << Decoration::From(Decoration::RESET);
26 return os;
27 }
28
29private:
30 std::string text_;
31 Style style_;
32};
33} // namespace ascii
34#endif // !INCLUDE_ASCII_TEXT_H_
static Decoration From(Attribute attr)
Definition color.h:83
@ RESET
Definition color.h:62
Definition style.h:6
Definition text.h:6
friend std::ostream & operator<<(std::ostream &os, const Text &val)
Definition text.h:24
Text(std::string text)
Definition text.h:9
Text()
Definition text.h:8
Text & style(Style style)
Definition text.h:12
std::string text()
Definition text.h:22
Text(std::string text, Style style)
Definition text.h:10
Text & text(std::string text)
Definition text.h:17
for detailed info, refered to https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797.
Definition ascii.h:17