|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 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;
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_;
332 #endif // include guard
friend std::ostream & operator<<(std::ostream &out, Binder const &binder)
Table & append(std::string value)
TableLayout simple_frame(bool condensed)
TableLayout minimal_layout()
TableLayout extended_frame(bool condensed)
std::string row(size_t i) const
Table & operator=(Table const &)=default
std::ostream & operator<<(std::ostream &os, Color const &color)
Write a textual representation of the Color the a stream, in the format "(r, g, b,...
void append(std::string value)
TableLayout double_frame(bool condensed)
Justification justify() const
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.
void write(std::ostream &out) const
Column & operator=(Column const &)=default
std::string to_string() const
void clear()
Clears all columns and their data from the table.
Simple text style class for colorized and bold output to a terminal.
Table & line_break()
Finish the currently line and move to the next one.
Helper struct to bind a layout to a table.
TableLayout const & layout
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
void write_row(std::ostream &stream, size_t row) const
TableLayout double_grid(bool condensed)
TableLayout simple_layout(bool condensed)
Binder operator()(Table const &table)
Functional operator that allows to bind a TableLayout to a Table so that they can be used in one ostr...
void shrink_width()
Shrinks the column width to the minmal width that suffices to fit in all values of the column (i....
Column(std::string const &label, Justification justify=Justification::kLeft)
std::string label() const
TableLayout extended_grid(bool condensed)
One line of the TableLayout.
Table & operator<<(std::string value)
TableLayout simple_grid(bool condensed)
Binder(TableLayout const &l, Table const &t)
void write_label(std::ostream &stream) const