#include <genesis/utils/text/table.hpp>
Definition at line 140 of file utils/text/table.hpp.
Public Member Functions | |
Column ()=default | |
Column (Column &&)=default | |
Column (Column const &)=default | |
Column (std::string const &label, Justification justify=Justification::kLeft) | |
~Column ()=default | |
void | append (std::string value) |
void | append (Style const &style, std::string value) |
void | clear_content () |
Justification | justify () const |
void | justify (Justification value) |
std::string | label () const |
void | label (std::string value) |
size_t | length () const |
Column & | operator= (Column &&)=default |
Column & | operator= (Column const &)=default |
std::string | row (size_t i) const |
void | shrink_width () |
Shrinks the column width to the minmal width that suffices to fit in all values of the column (i.e., both data and label). More... | |
size_t | width () const |
void | width (size_t value) |
Set the width of this column. More... | |
void | write_label (std::ostream &stream) const |
void | write_row (std::ostream &stream, size_t row) const |
Public Types | |
enum | Justification { kLeft, kRight, kCentered } |
|
default |
|
inlineexplicit |
Definition at line 163 of file utils/text/table.hpp.
|
default |
void append | ( | std::string | value | ) |
Definition at line 351 of file utils/text/table.cpp.
void append | ( | Style const & | style, |
std::string | value | ||
) |
Definition at line 357 of file utils/text/table.cpp.
void clear_content | ( | ) |
Definition at line 345 of file utils/text/table.cpp.
Table::Column::Justification justify | ( | ) | const |
Definition at line 285 of file utils/text/table.cpp.
void justify | ( | Justification | value | ) |
Definition at line 280 of file utils/text/table.cpp.
std::string label | ( | ) | const |
Definition at line 275 of file utils/text/table.cpp.
void label | ( | std::string | value | ) |
Definition at line 269 of file utils/text/table.cpp.
size_t length | ( | ) | const |
Definition at line 330 of file utils/text/table.cpp.
std::string row | ( | size_t | i | ) | const |
Definition at line 335 of file utils/text/table.cpp.
void shrink_width | ( | ) |
Shrinks the column width to the minmal width that suffices to fit in all values of the column (i.e., both data and label).
The column keeps track of its needed minimal width when just adding data. Thus, this function is only neccessary to call once the width was changed manually or if the label or a data value have been changed after being added.
Definition at line 317 of file utils/text/table.cpp.
size_t width | ( | ) | const |
Definition at line 304 of file utils/text/table.cpp.
void width | ( | size_t | value | ) |
Set the width of this column.
If the new value is smaller than the current one, nothing happens. The width can only grow, or be set to the minimal possible value using shrink_width(). This ensures that all text fits within the column.
Definition at line 297 of file utils/text/table.cpp.
void write_label | ( | std::ostream & | stream | ) | const |
Definition at line 374 of file utils/text/table.cpp.
void write_row | ( | std::ostream & | stream, |
size_t | row | ||
) | const |
Definition at line 367 of file utils/text/table.cpp.
|
strong |
Enumerator | |
---|---|
kLeft | |
kRight | |
kCentered |
Definition at line 148 of file utils/text/table.hpp.