Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
uni20::presentation::report_table Class Reference

A small report table builder for command-line examples and diagnostics. More...

#include <presentation.hpp>

Public Member Functions

table_border_options const & border_options () const noexcept
 Return table border and rule options.
 
report_table & border_style (table_rule_style style)
 Set the rule style used by automatic borders and separators.
 
report_table & borders (table_border_options options)
 Set table border and rule options.
 
report_table & column (std::string heading, table_alignment alignment=table_alignment::right)
 Add a column to the table.
 
report_table & column_separators (bool enabled=true)
 Enable or disable vertical rules between columns.
 
std::vector< table_column > const & columns () const noexcept
 Return the column specifications.
 
std::vector< table_entry > const & entries () const noexcept
 Return table entries, including row and separator entries.
 
report_table & grid (bool enabled=true)
 Enable or disable a full table grid.
 
report_table & grid (table_rule_style style)
 Enable a full table grid with a specific rule style.
 
report_table & header_separator (bool enabled=true)
 Enable or disable a horizontal rule after the heading row.
 
report_table & outer_border (bool enabled=true)
 Enable or disable an outer border around the table.
 
report_table & preserve_tokens (bool enabled=true)
 Wrap only at whitespace, allowing the table to exceed the requested width to preserve tokens.
 
bool preserves_tokens () const noexcept
 Whether column fitting must keep whitespace-delimited tokens intact.
 
 report_table (std::string title={})
 Construct a titled report table.
 
report_table & row (std::initializer_list< table_cell > cells)
 Add a row from table cell specifications.
 
report_table & row (std::vector< std::string > cells)
 Add a row from already formatted cell strings.
 
report_table & row (std::vector< table_cell > cells)
 Add a row from table cell specifications.
 
template<typename... Values>
report_table & row (Values const &... values)
 Add a row by formatting each value with fmt.
 
report_table & row_separators (bool enabled=true)
 Enable or disable horizontal rules between rows.
 
report_table & separator (table_rule_style style=table_rule_style::single)
 Insert a separator at the current body position.
 
std::string const & title () const noexcept
 Return the table title.
 
report_table & top_separator (table_rule_style style=table_rule_style::single)
 Insert a separator before the generated heading row.
 
std::vector< table_rule_style > const & top_separators () const noexcept
 Return explicit separators rendered before the heading row.
 

Detailed Description

A small report table builder for command-line examples and diagnostics.

Constructor & Destructor Documentation

◆ report_table()

uni20::presentation::report_table::report_table ( std::string  title = {})
explicit

Construct a titled report table.

Parameters
titleHuman-readable table title.

Member Function Documentation

◆ border_options()

table_border_options const & uni20::presentation::report_table::border_options ( ) const
noexcept

Return table border and rule options.

Returns
Border and rule controls.

◆ border_style()

report_table & uni20::presentation::report_table::border_style ( table_rule_style  style)

Set the rule style used by automatic borders and separators.

Parameters
styleRule glyph style to use.
Returns
Reference to this table for chaining.

◆ borders()

report_table & uni20::presentation::report_table::borders ( table_border_options  options)

Set table border and rule options.

Parameters
optionsBorder and rule controls to apply.
Returns
Reference to this table for chaining.

◆ column()

report_table & uni20::presentation::report_table::column ( std::string  heading,
table_alignment  alignment = table_alignment::right 
)

Add a column to the table.

Parameters
headingColumn heading text.
alignmentCell alignment for this column.
Returns
Reference to this table for chaining.

◆ column_separators()

report_table & uni20::presentation::report_table::column_separators ( bool  enabled = true)

Enable or disable vertical rules between columns.

Parameters
enabledWhether to draw column separators.
Returns
Reference to this table for chaining.

◆ columns()

std::vector< table_column > const & uni20::presentation::report_table::columns ( ) const
noexcept

Return the column specifications.

Returns
Immutable column vector.

◆ entries()

std::vector< table_entry > const & uni20::presentation::report_table::entries ( ) const
noexcept

Return table entries, including row and separator entries.

Returns
Immutable table entry vector.

◆ grid() [1/2]

report_table & uni20::presentation::report_table::grid ( bool  enabled = true)

Enable or disable a full table grid.

Parameters
enabledWhether to draw outer, column, row, and heading rules.
Returns
Reference to this table for chaining.

◆ grid() [2/2]

report_table & uni20::presentation::report_table::grid ( table_rule_style  style)

Enable a full table grid with a specific rule style.

Parameters
styleRule glyph style to use.
Returns
Reference to this table for chaining.

◆ header_separator()

report_table & uni20::presentation::report_table::header_separator ( bool  enabled = true)

Enable or disable a horizontal rule after the heading row.

Parameters
enabledWhether to draw the heading separator.
Returns
Reference to this table for chaining.

◆ outer_border()

report_table & uni20::presentation::report_table::outer_border ( bool  enabled = true)

Enable or disable an outer border around the table.

Parameters
enabledWhether to draw the border.
Returns
Reference to this table for chaining.

◆ preserve_tokens()

report_table & uni20::presentation::report_table::preserve_tokens ( bool  enabled = true)

Wrap only at whitespace, allowing the table to exceed the requested width to preserve tokens.

Disabled by default. Applies to headings and cells, including cells spanning multiple columns.

◆ preserves_tokens()

bool uni20::presentation::report_table::preserves_tokens ( ) const
noexcept

Whether column fitting must keep whitespace-delimited tokens intact.

◆ row() [1/4]

report_table & uni20::presentation::report_table::row ( std::initializer_list< table_cell >  cells)

Add a row from table cell specifications.

Parameters
cellsCell specifications in column order.
Returns
Reference to this table for chaining.

◆ row() [2/4]

report_table & uni20::presentation::report_table::row ( std::vector< std::string >  cells)

Add a row from already formatted cell strings.

Parameters
cellsCell text in column order.
Returns
Reference to this table for chaining.

◆ row() [3/4]

report_table & uni20::presentation::report_table::row ( std::vector< table_cell >  cells)

Add a row from table cell specifications.

Parameters
cellsCell specifications in column order.
Returns
Reference to this table for chaining.

◆ row() [4/4]

template<typename... Values>
report_table & uni20::presentation::report_table::row ( Values const &...  values)
inline

Add a row by formatting each value with fmt.

Template Parameters
ValuesCell value types.
Parameters
valuesValues to format into cell text.
Returns
Reference to this table for chaining.

◆ row_separators()

report_table & uni20::presentation::report_table::row_separators ( bool  enabled = true)

Enable or disable horizontal rules between rows.

Parameters
enabledWhether to draw row separators.
Returns
Reference to this table for chaining.

◆ separator()

report_table & uni20::presentation::report_table::separator ( table_rule_style  style = table_rule_style::single)

Insert a separator at the current body position.

Parameters
styleRule glyph style to use.
Returns
Reference to this table for chaining.

◆ title()

std::string const & uni20::presentation::report_table::title ( ) const
noexcept

Return the table title.

Returns
Table title text.

◆ top_separator()

report_table & uni20::presentation::report_table::top_separator ( table_rule_style  style = table_rule_style::single)

Insert a separator before the generated heading row.

Parameters
styleRule glyph style to use.
Returns
Reference to this table for chaining.

◆ top_separators()

std::vector< table_rule_style > const & uni20::presentation::report_table::top_separators ( ) const
noexcept

Return explicit separators rendered before the heading row.

Returns
Immutable top separator vector.

The documentation for this class was generated from the following files: