22 indent_t() : indent(0) {}
23 explicit indent_t(
int i) : indent(i) {}
24 indent_t &operator++() {
28 indent_t &operator--() {
32 indent_t operator++(
int) {
37 indent_t operator--(
int) {
42 friend std::ostream &operator<<(std::ostream &os, indent_t i);
43 indent_t operator+(
int v) {
48 indent_t operator-(
int v) {
53 indent_t &operator+=(
int v) {
57 indent_t &operator-=(
int v) {
61 static indent_t &getindent(std::ostream &);
64inline std::ostream &operator<<(std::ostream &os,
indent_t i) {
65 os << std::setw(i.indent * i.tabsz) <<
"";
70inline std::ostream &endl(std::ostream &out) {
71 return out << std::endl << indent_t::getindent(out);
73inline std::ostream &indent(std::ostream &out) {
74 ++indent_t::getindent(out);
77inline std::ostream &unindent(std::ostream &out) {
78 --indent_t::getindent(out);
84 std::vector<std::ostream *> streams;
87 TempIndent(
const TempIndent &) =
delete;
88 TempIndent() =
default;
89 friend std::ostream &operator<<(std::ostream &out, TempIndent &ti) {
90 ti.streams.push_back(&out);
93 friend std::ostream &operator<<(std::ostream &out, TempIndent &&ti) {
94 ti.streams.push_back(&out);
97 const char *pop_back() {
98 if (!streams.empty()) {
99 *streams.back() << unindent;
104 const char *reset() {
105 for (
auto *out : streams) *out << unindent;
110 for (
auto *out : streams) *out << unindent;
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13