A utility class for creating formatted markdown tables with automatic column sizing and alignment.
More...
#include <Acts/Utilities/Table.hpp>
|
| void | addColumn (const std::string &header, const std::string &format, Alignment alignment=Alignment::Left) |
| | Add a column with header, format string, and alignment.
|
| void | addColumn (const std::string &header, const std::string &format, const std::string &alignment="left") |
| | Add a column with header, format string, and alignment as string.
|
| template<typename... Args> |
| void | addRow (Args &&... args) |
| | Add a row with variable arguments matching the number of columns.
|
| void | setMarkdownMode (bool includeMarkers) |
| | Set whether to include markdown alignment markers in output.
|
| std::string | toString () const |
| | Generate the formatted table as a markdown string.
|
A utility class for creating formatted markdown tables with automatic column sizing and alignment.
Usage:
supported table.
addRow(
"Item1", 1.23, 42); table.
addRow(
"Item2", 4.56, 7);
A utility class for creating formatted markdown tables with automatic column sizing and alignment.
Definition Table.hpp:33
@ Center
Definition Table.hpp:36
void addRow(Args &&... args)
Add a row with variable arguments matching the number of columns.
Definition Table.hpp:77
std::string toString() const
Generate the formatted table as a markdown string.
Definition Table.hpp:104
void addColumn(const std::string &header, const std::string &format, Alignment alignment=Alignment::Left)
Add a column with header, format string, and alignment.
Definition Table.hpp:49
◆ Alignment
Text alignment options for table columns.
| Enumerator |
|---|
| Left | |
| Right | |
| Center | |
◆ addColumn() [1/2]
| void Acts::Table::addColumn |
( |
const std::string & | header, |
|
|
const std::string & | format, |
|
|
Alignment | alignment = Alignment::Left ) |
Add a column with header, format string, and alignment.
- Parameters
-
| header | Column header text |
| format | Format string for the column values |
| alignment | Column alignment (default: Left) |
◆ addColumn() [2/2]
| void Acts::Table::addColumn |
( |
const std::string & | header, |
|
|
const std::string & | format, |
|
|
const std::string & | alignment = "left" ) |
Add a column with header, format string, and alignment as string.
- Parameters
-
| header | Column header text |
| format | Format string for the column values |
| alignment | String alignment: "left"/"l", "right"/"r", "center"/"c" (case insensitive) |
- Exceptions
-
| std::invalid_argument | if alignment string is not recognized |
◆ addRow()
template<typename... Args>
| void Acts::Table::addRow |
( |
Args &&... | args | ) |
|
Add a row with variable arguments matching the number of columns.
- Parameters
-
| args | Arguments to add as row values |
- Exceptions
-
| std::runtime_error | if argument count doesn't match column count |
◆ setMarkdownMode()
| void Acts::Table::setMarkdownMode |
( |
bool | includeMarkers | ) |
|
Set whether to include markdown alignment markers in output.
- Parameters
-
| includeMarkers | If true (default), includes markdown alignment markers |
◆ toString()
| std::string Acts::Table::toString |
( |
| ) |
const |
Generate the formatted table as a markdown string.
- Returns
- Markdown formatted string representation of the table