1 #ifndef GENESIS_UTILS_TEXT_TABLE_H_ 2 #define GENESIS_UTILS_TEXT_TABLE_H_ 51 std::ostream&
operator << (std::ostream& out, Table
const& table);
117 void write( std::ostream& out )
const;
131 size_t current_col_ = 0;
132 std::vector<Column> columns_;
166 , width_( label.size() )
186 void label( std::string value );
187 std::string label()
const;
192 void width(
size_t value );
193 size_t width()
const;
203 std::string row(
size_t i )
const;
211 void append( std::string value );
212 void append(
Style const& style, std::string value );
220 void write_row( std::ostream& stream,
size_t row )
const;
221 void write_label( std::ostream& stream )
const;
225 void write( std::ostream& stream,
Style style, std::string text )
const;
233 std::string label_ =
"";
237 std::vector< std::pair< Style, std::string >> data_;
267 bool enabled =
false;
269 std::string left_border =
"";
270 std::string filler =
"";
271 std::string separator =
" ";
272 std::string right_border =
"";
332 #endif // include guard TableLayout minimal_layout()
Column(std::string const &label, Justification justify=Justification::kLeft)
TableLayout double_grid(bool condensed)
TableLayout simple_layout(bool condensed)
void clear()
Clears all columns and their data from the table.
Table & operator=(Table const &)=default
One line of the TableLayout.
Simple text style class for colorized and bold output to a terminal.
void clear_content()
Clears the data contents of all columns. Their labels etc stay unchanged.
Column & add_column(std::string label="")
Add a column to the table.
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
std::ostream & operator<<(std::ostream &os, const Matrix< signed char > &matrix)
Template specialization for signed char, in order to print nicely.
void write(std::ostream &out) const
Binder(TableLayout const &l, Table const &t)
Helper struct to bind a layout to a table.
std::string to_string() const
Table & line_break()
Finish the currently line and move to the next one.
TableLayout const & layout
TableLayout extended_frame(bool condensed)
TableLayout extended_grid(bool condensed)
TableLayout simple_grid(bool condensed)
Table & operator<<(std::string value)
Table & append(std::string value)
TableLayout simple_frame(bool condensed)
TableLayout double_frame(bool condensed)