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

Builder for simple terminal reports with headings, status lines, fields, and tables. More...

#include <presentation.hpp>

Public Member Functions

report_builder & field (std::string key, std::string value)
 Add a labeled field to the report header.
 
template<typename Value >
report_builder & field (std::string key, Value const &value)
 Add a labeled field after formatting the value with fmt.
 
std::vector< std::pair< std::string, std::string > > const & fields () const noexcept
 Return the report fields.
 
 report_builder (std::string title={})
 Construct a report with an optional title.
 
report_builder & status (semantic_glyph glyph, std::string label)
 Add a semantic status line such as ✓ converged.
 
std::vector< std::pair< semantic_glyph, std::string > > const & statuses () const noexcept
 Return the status lines.
 
report_table & table (std::string title)
 Add a titled table and return it for population.
 
std::deque< report_table > const & tables () const noexcept
 Return the report tables.
 
std::string const & title () const noexcept
 Return the report title.
 

Detailed Description

Builder for simple terminal reports with headings, status lines, fields, and tables.

Constructor & Destructor Documentation

◆ report_builder()

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

Construct a report with an optional title.

Parameters
titleReport title.

Member Function Documentation

◆ field() [1/2]

report_builder & uni20::presentation::report_builder::field ( std::string  key,
std::string  value 
)

Add a labeled field to the report header.

Rendering with a wrap width breaks values at whitespace and aligns continuation lines below the value. Indivisible tokens may exceed the width.

Parameters
keyField label.
valueAlready formatted field value.
Returns
Reference to this report for chaining.

◆ field() [2/2]

template<typename Value >
report_builder & uni20::presentation::report_builder::field ( std::string  key,
Value const &  value 
)
inline

Add a labeled field after formatting the value with fmt.

Template Parameters
ValueField value type.
Parameters
keyField label.
valueField value.
Returns
Reference to this report for chaining.

◆ fields()

std::vector< std::pair< std::string, std::string > > const & uni20::presentation::report_builder::fields ( ) const
noexcept

Return the report fields.

Returns
Immutable field vector.

◆ status()

report_builder & uni20::presentation::report_builder::status ( semantic_glyph  glyph,
std::string  label 
)

Add a semantic status line such as ✓ converged.

Parameters
glyphSemantic status glyph.
labelStatus label text.
Returns
Reference to this report for chaining.

◆ statuses()

std::vector< std::pair< semantic_glyph, std::string > > const & uni20::presentation::report_builder::statuses ( ) const
noexcept

Return the status lines.

Returns
Immutable status vector.

◆ table()

report_table & uni20::presentation::report_builder::table ( std::string  title)

Add a titled table and return it for population.

Parameters
titleTable title.
Returns
Mutable table reference.

◆ tables()

std::deque< report_table > const & uni20::presentation::report_builder::tables ( ) const
noexcept

Return the report tables.

Returns
Immutable table sequence.

◆ title()

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

Return the report title.

Returns
Report title text.

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