PrettyBox¶
-
class PrettyBox¶
Fixed-layout text table redrawn in place on the terminal.
Used for the live progress display during event generation (
Verbosity::pretty). print_first draws the initial box; print_update moves the cursor back up and repaints the same lines, so the box appears to update rather than scroll.Public Functions
-
PrettyBox() = default¶
Empty box; must not be printed.
-
PrettyBox(const std::string &title, std::size_t rows, const std::vector<std::size_t> &column_sizes, std::size_t offset = 0, std::size_t box_width = 91)¶
- Parameters:
title – Text shown in the top border.
rows – Number of content rows.
column_sizes – Width of each column, in characters.
offset – Extra blank lines printed above the box.
box_width – Total box width, in characters.
-
void print_first() const¶
Draw the box for the first time.
-
void print_update() const¶
Redraw the box in place with the current cell contents.
-
inline std::size_t line_count() const¶
Number of terminal lines the box occupies, including its borders.
-
inline void set_row(std::size_t row, const std::vector<std::string> &values)¶
Set every cell of
row.
-
inline void set_column(std::size_t column, const std::vector<std::string> &values)¶
Set every cell of
column.
-
inline void set_cell(std::size_t row, std::size_t column, std::string value)¶
Set a single cell.
-
PrettyBox() = default¶