49 using std::string_view;
75 char m_border_top =
'-';
76 char m_border_top_mid =
'+';
77 char m_border_top_left =
'+';
78 char m_border_top_right =
'+';
80 char m_border_bottom =
'-';
81 char m_border_bottom_mid =
'+';
82 char m_border_bottom_left =
'+';
83 char m_border_bottom_right =
'+';
85 char m_border_left =
'|';
86 char m_border_left_mid =
'+';
88 char m_border_mid =
'-';
89 char m_border_mid_mid =
'+';
91 char m_border_right =
'|';
92 char m_border_right_mid =
'+';
94 char m_border_middle =
'|';
111 void border_top(
char borderStyle ) { m_border_top = borderStyle; }
135 void border_left(
char borderStyle ) { m_border_left = borderStyle; }
141 void border_mid(
char borderStyle ) { m_border_mid = borderStyle; }
147 void border_right(
char borderStyle ) { m_border_right = borderStyle; }
176 Table * m_Table =
nullptr;
199 string_view val =
"",
203 string_view
value()
const {
return m_Value; }
204 void value( string_view val ) { m_Value = val; }
265 void cell( string_view value );
341 string_view
title()
const {
return m_Title; }
380 return stream << row.
render();
389 return stream << table.
render();
Utils::ostream_type & operator<<(Utils::ostream_type &stream, Utils::Table::Row const &row)
Stream insertion operator for rendering a table row to an output stream.
Definition Table.hxx:379
Represents a cell in a table with alignment, content, and optional column span.
Definition Table.hxx:174
string line(integer idx) const
Alignment alignment() const
Definition Table.hxx:206
string render(integer line, integer col) const
integer maximum_line_width() const
Cell()=default
Default constructor for an empty cell.
string_view value() const
Definition Table.hxx:203
integer width(integer col) const
void col_span(integer col_span)
Definition Table.hxx:210
void alignment(Alignment const &align)
Definition Table.hxx:207
static void trim_line(std::string &line)
Cell(Table *table, string_view val="", integer col_span=1)
Constructs a cell with a value and optional column span.
void value(string_view val)
Definition Table.hxx:204
integer col_span() const
Definition Table.hxx:209
Represents a row in a table consisting of multiple cells.
Definition Table.hxx:229
Row()=default
Default constructor for an empty row.
void cells(vecstr const &cells)
void cell_col_span(integer idx, integer span)
Row(Table *table, vecstr const &cells=vecstr())
Constructs a row with a set of initial cell values.
Table const * table() const
Definition Table.hxx:256
vector< Cell > vecCell
Definition Table.hxx:231
Cell const & operator[](integer idx) const
Definition Table.hxx:268
integer num_cells() const
Definition Table.hxx:261
Table * m_Table
Definition Table.hxx:234
vecCell m_Cells
Definition Table.hxx:235
integer cell_width(integer idx) const
void cell(string_view value)
vector< string > vecstr
Definition Table.hxx:232
Defines the style and structure of table borders, padding, and alignment.
Definition Table.hxx:72
char border_top() const
Definition Table.hxx:110
void border_bottom_right(char borderStyle)
Definition Table.hxx:132
char border_left() const
Definition Table.hxx:134
void border_top_left(char borderStyle)
Definition Table.hxx:117
char border_left_mid() const
Definition Table.hxx:137
void border_mid(char borderStyle)
Definition Table.hxx:141
Style()=default
Default constructor initializing the table style with default borders.
char border_right() const
Definition Table.hxx:146
char border_bottom() const
Definition Table.hxx:122
integer padding_right() const
Definition Table.hxx:158
char border_mid_mid() const
Definition Table.hxx:143
char border_middle() const
Definition Table.hxx:152
char border_top_left() const
Definition Table.hxx:116
void border_right_mid(char borderStyle)
Definition Table.hxx:150
void border_left_mid(char borderStyle)
Definition Table.hxx:138
Alignment alignment() const
Definition Table.hxx:161
void border_mid_mid(char borderStyle)
Definition Table.hxx:144
char border_top_mid() const
Definition Table.hxx:113
void border_middle(char borderStyle)
Definition Table.hxx:153
void alignment(Alignment align)
Definition Table.hxx:162
char border_mid() const
Definition Table.hxx:140
void border_top_right(char borderStyle)
Definition Table.hxx:120
void border_bottom_mid(char borderStyle)
Definition Table.hxx:126
integer width() const
Definition Table.hxx:164
void padding_left(integer padding)
Definition Table.hxx:156
char border_bottom_mid() const
Definition Table.hxx:125
void border_right(char borderStyle)
Definition Table.hxx:147
void padding_right(integer padding)
Definition Table.hxx:159
integer padding_left() const
Definition Table.hxx:155
void width(integer width)
Definition Table.hxx:165
void border_bottom_left(char borderStyle)
Definition Table.hxx:129
char border_bottom_left() const
Definition Table.hxx:128
void border_bottom(char borderStyle)
Definition Table.hxx:123
void border_top_mid(char borderStyle)
Definition Table.hxx:114
char border_right_mid() const
Definition Table.hxx:149
char border_top_right() const
Definition Table.hxx:119
void border_top(char borderStyle)
Definition Table.hxx:111
void border_left(char borderStyle)
Definition Table.hxx:135
char border_bottom_right() const
Definition Table.hxx:131
The main class for creating and managing a table.
Definition Table.hxx:283
void rows(vecvecstr const &rows)
Row const & row(integer n) const
std::vector< vecstr > vecvecstr
Definition Table.hxx:288
integer cell_padding() const
vecRow const & rows() const
Definition Table.hxx:358
void add_row(vecstr const &row)
int integer
Definition Table.hxx:289
std::string render_separator(char left, char mid, char right, char sep) const
Cell & operator()(integer i, integer j)
Definition Table.hxx:355
string_view title() const
Definition Table.hxx:341
integer column_width(integer n) const
void style(Style const &style)
Definition Table.hxx:339
Row & operator[](integer n)
Definition Table.hxx:352
void headings(vecstr const &headings)
Row const & headings() const
Definition Table.hxx:345
Table(Style const &style, vecvecstr const &rows=vecvecstr())
Constructs a table with a given style and initial rows.
Definition Table.hxx:310
void align_column(integer n, Alignment align)
Table()=default
Default constructor for an empty table.
std::vector< Row > vecRow
Definition Table.hxx:285
integer num_columns() const
vecCell column(integer n) const
std::string render() const
void setup(Style const &style, vecvecstr const &rows=vecvecstr())
Definition Table.hxx:319
void title(string_view title)
Definition Table.hxx:343
integer cell_spacing() const
std::vector< Cell > vecCell
Definition Table.hxx:286
Style const & style() const
Definition Table.hxx:337
std::vector< string > vecstr
Definition Table.hxx:287
int integer
Definition Table.hxx:56
enum class Table_align :integer { LEFT, RIGHT, CENTER } Alignment
Enum class defining alignment types for table cells.
Definition Table.hxx:64
Definition SystemUtils.cc:39
std::basic_ostream< char > ostream_type
Type for output stream.
Definition Console.hxx:28