/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/cpp/getopt/small/formatted_output.h
32 строки
888 B
qkrorlqr
Initial NBS OpenSource export
28 апр 2023, 21:54
28 апр 2023, 21:54
783a858
Код
Авторство
О чём код?
#pragma once #include <util/generic/algorithm.h> #include <util/generic/vector.h> #include <util/string/builder.h> #include <util/memory/tempbuf.h> namespace NLastGetopt { /// Utility for printing indented lines. Used by completion generators. class TFormattedOutput { public: struct IndentGuard { explicit IndentGuard(TFormattedOutput* output); virtual ~IndentGuard(); TFormattedOutput* Output; }; public: /// Increase indentation and return a RAII object that'll decrease it back automatically. IndentGuard Indent(); /// Append a new indented line to the stream. TStringBuilder& Line(); /// Collect all lines into a stream. void Print(IOutputStream& out); private: int IndentLevel_ = 0; TVector<std::pair<int, TStringBuilder>> Lines_; }; }