![]() |
UtilsLite
Utilities for C++ programming
|
The main class for creating and managing a table. More...
#include <Table.hxx>
Public Types | |
using | vecRow = std::vector<Row> |
using | vecCell = std::vector<Cell> |
using | vecstr = std::vector<string> |
using | vecvecstr = std::vector<vecstr> |
using | integer = int |
Public Member Functions | |
Table ()=default | |
Default constructor for an empty table. | |
Table (Style const &style, vecvecstr const &rows=vecvecstr()) | |
Constructs a table with a given style and initial rows. | |
void | setup (Style const &style, vecvecstr const &rows=vecvecstr()) |
void | align_column (integer n, Alignment align) |
void | add_row (vecstr const &row) |
integer | cell_spacing () const |
integer | cell_padding () const |
vecCell | column (integer n) const |
integer | column_width (integer n) const |
integer | num_columns () const |
Style const & | style () const |
void | style (Style const &style) |
string_view | title () const |
void | title (string_view title) |
Row const & | headings () const |
void | headings (vecstr const &headings) |
Row & | row (integer n) |
Row const & | row (integer n) const |
Row & | operator[] (integer n) |
Row const & | operator[] (integer n) const |
Cell & | operator() (integer i, integer j) |
Cell const & | operator() (integer i, integer j) const |
vecRow const & | rows () const |
void | rows (vecvecstr const &rows) |
std::string | render_separator (char left, char mid, char right, char sep) const |
std::string | render () const |
The main class for creating and managing a table.
The Table
class represents a 2D table structure that supports rows, cells, and table styles. It provides methods for rendering, alignment, and other table-related operations.
using Utils::Table::Table::integer = int |
using Utils::Table::Table::vecCell = std::vector<Cell> |
using Utils::Table::Table::vecRow = std::vector<Row> |
using Utils::Table::Table::vecstr = std::vector<string> |
using Utils::Table::Table::vecvecstr = std::vector<vecstr> |
|
default |
Default constructor for an empty table.
|
inlineexplicit |
Constructs a table with a given style and initial rows.
style | The style object to customize the table's borders and alignment. |
rows | A 2D vector of strings representing the table's content. |
void Utils::Table::Table::add_row | ( | vecstr const & | row | ) |
integer Utils::Table::Table::cell_padding | ( | ) | const |
integer Utils::Table::Table::cell_spacing | ( | ) | const |
|
inline |
void Utils::Table::Table::headings | ( | vecstr const & | headings | ) |
integer Utils::Table::Table::num_columns | ( | ) | const |
std::string Utils::Table::Table::render | ( | ) | const |
std::string Utils::Table::Table::render_separator | ( | char | left, |
char | mid, | ||
char | right, | ||
char | sep ) const |
|
inline |
void Utils::Table::Table::rows | ( | vecvecstr const & | rows | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |