Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Namespaces | Classes | Concepts | Typedefs | Enumerations | Functions
uni20::presentation Namespace Reference

Namespaces

namespace  data_table_detail
 

Classes

struct  data_attachment
 Attachment identity and any optional begin/replay/finalization failure. More...
 
class  data_column
 Typed column schema with owned metadata and deferred display formatting. More...
 
struct  data_column_display
 Column display settings. These never change stored values or default export precision. More...
 
class  data_delivery_error
 Required output failed after all eligible sinks were attempted; retained rows are not rolled back. More...
 
struct  data_delivery_report
 Newly encountered failures. Callers using optional sinks must inspect this result. More...
 
struct  data_json_options
 Ordered JSON column selection. Empty selects every column; display precision is never applied. More...
 
struct  data_sink_failure
 Original exception and attachment identity for one disabled sink. More...
 
struct  data_sink_id
 A table-local attachment identifier, stable when its table is moved. More...
 
struct  data_sink_options
 
struct  data_sink_start
 The index of the first row this attachment can emit (zero for full replay). More...
 
class  data_table
 Typed result table with synchronous sinks and optional retained history. More...
 
struct  data_table_options
 Construction-time table policy and initial application metadata. More...
 
struct  data_terminal_options
 Independent terminal projection, widths, and destination using the existing display router. More...
 
struct  delimited_options
 Delimited output policy, independent of terminal styles and width. More...
 
struct  help_group
 An ordered group of options in a help document. More...
 
struct  help_option
 One option's semantic help content, projected from the parser's declarations. More...
 
struct  mdspan_format_options
 Formatting controls for mdspan and tensor display art. More...
 
struct  mdspan_matrix_axes
 Matrix axes used when rendering rank-2-or-higher tensors. More...
 
struct  mdspan_preview_options
 Bounded preview controls for mdspan and tensor display. More...
 
struct  mdspan_preview_result
 Result of bounded mdspan preview rendering. More...
 
struct  numeric_format_options
 Numeric scalar formatting controls shared by tensor-style renderers. More...
 
struct  output_policy
 Output policy shared by presentation renderers and layout helpers. More...
 
struct  program_example
 One invocation and its purpose, supplied by the application. More...
 
struct  program_info
 Application identity and explanatory content, independent of any option parser. More...
 
struct  program_reference
 A literature entry supplied by the application's authoritative citation registry. More...
 
class  report_builder
 Builder for simple terminal reports with headings, status lines, fields, and tables. More...
 
class  report_table
 A small report table builder for command-line examples and diagnostics. More...
 
struct  semantic_glyph_span
 A semantic glyph token carrying style metadata but no rendered spelling. More...
 
class  styled_text
 A sequence of styled text spans and semantic glyph tokens. More...
 
struct  styled_text_span
 A text span carrying style metadata but no terminal escape sequences. More...
 
struct  table_border_options
 Rule and border controls for report tables. More...
 
struct  table_cell
 Cell specification for table rows, including optional style, column span, and alignment. More...
 
struct  table_column
 Column specification for report tables. More...
 
struct  table_projection
 Ordered output columns and independent display overrides. Empty columns selects the full schema. More...
 
struct  table_separator
 Explicit separator row inserted between table data rows. More...
 
class  text_style
 Callable style wrapper that builds styled presentation text. More...
 

Concepts

concept  DataTableValue
 Types retained directly by data tables, without numerical narrowing or text conversion.
 
concept  mdspan_like
 Detect mdspan-like objects without depending on trace or tensor.
 

Typedefs

using presentation_span = std::variant< styled_text_span, semantic_glyph_span >
 
using table_entry = std::variant< std::vector< table_cell >, table_separator >
 
using table_metadata = std::map< std::string, std::string >
 Application metadata is owned text, independent of numerical rows.
 

Enumerations

enum class  ambiguous_width { narrow , wide }
 Selects how East Asian ambiguous-width code points are measured. More...
 
enum class  color_mode { never , automatic , always }
 Selects when terminal color/style control sequences may be emitted. More...
 
enum class  data_export_precision { round_trip , display }
 Precision for delimited numerical output; display mode deliberately rounds real values. More...
 
enum class  data_sink_operation { begin , row , finish }
 
enum class  data_sink_state { active , closed , failed }
 
enum class  glyph_set { unicode , emoji , ascii }
 Selects the preferred glyph family for semantic symbols and ornaments. More...
 
enum class  invalid_utf8 { escape , replace }
 Selects how invalid UTF-8 bytes are represented. More...
 
enum class  mdspan_shape_mode { none , prefix }
 Selects whether mdspan/tensor art includes shape metadata. More...
 
enum class  ornament_mode { none , minimal , rich }
 Selects the richness of decorative line and tree glyphs. More...
 
enum class  real_notation { general , fixed , scientific }
 Selects how real floating-point values are formatted. More...
 
enum class  retention { all , none }
 Whether accepted rows remain available for snapshots and replay. More...
 
enum class  semantic_glyph {
  success , failure , fatal , warning ,
  info , partial , deferred , skipped ,
  arrow_right , arrow_left , arrow_up , arrow_down ,
  arrow_left_right , ellipsis , box_horizontal , box_vertical ,
  box_top_left , box_top_right , box_bottom_left , box_bottom_right ,
  box_round_top_left , box_round_top_right , box_round_bottom_left , box_round_bottom_right ,
  box_tee_left , box_tee_right , box_tee_up , box_tee_down ,
  box_cross , box_double_horizontal , box_double_vertical , box_double_top_left ,
  box_double_top_right , box_double_bottom_left , box_double_bottom_right , box_double_tee_left ,
  box_double_tee_right , box_double_tee_up , box_double_tee_down , box_double_cross ,
  box_double_vertical_tee_right_single , box_double_vertical_tee_left_single , box_double_vertical_cross_single_horizontal , box_double_down_single_horizontal ,
  box_double_up_single_horizontal , box_single_vertical_tee_right_double , box_single_vertical_tee_left_double , box_single_vertical_cross_double_horizontal ,
  box_single_down_double_horizontal , box_single_up_double_horizontal , box_diagonal_forward , box_diagonal_back ,
  box_diagonal_cross , tree_branch , tree_last , tree_vertical ,
  tree_space , bullet , matrix_top_left , matrix_top_right ,
  matrix_middle_left , matrix_middle_right , matrix_bottom_left , matrix_bottom_right
}
 Names semantic glyphs independently of their rendered spelling. More...
 
enum class  sink_replay { all , future_only }
 Full replay is the default. Future-only attachment explicitly opts out of history. More...
 
enum class  table_alignment { left , right , center , decimal }
 Selects table cell alignment in report-style output. More...
 
enum class  table_rule_style { single , double_line }
 Selects the glyph family used for table rules and borders. More...
 
enum class  text_charset { utf8 , ascii_escape , ascii_replace }
 Selects how non-ASCII text code points are rendered. More...
 
enum class  width_mode { bytes , display_cells }
 Selects the unit used by alignment and clipping helpers. More...
 

Functions

table_cell cell (char const *text, std::size_t span=1, std::optional< table_alignment > alignment=std::nullopt)
 Build a table cell from literal text.
 
table_cell cell (std::string_view text, std::size_t span=1, std::optional< table_alignment > alignment=std::nullopt)
 Build a table cell from literal text.
 
table_cell cell (styled_text content, std::size_t span=1, std::optional< table_alignment > alignment=std::nullopt)
 Build a table cell from styled presentation text.
 
std::string clip_to_width (std::string_view text, std::size_t max_width, output_policy const &policy, std::size_t initial_column=0)
 Clip rendered text to a target width without appending a marker.
 
uni20::real_format_notation core_notation (real_notation notation)
 
auto csv_sink (std::ostream &out, delimited_options options={})
 Stream CSV rows to a borrowed stream, flushing on explicit sink/table finish.
 
std::size_t display_width (std::string_view text, output_policy const &policy, std::size_t initial_column=0)
 Measure rendered text width under the selected policy.
 
std::size_t display_width (styled_text const &text, output_policy const &policy, std::size_t initial_column=0)
 Measure rendered styled text width under the selected policy.
 
template<uni20::Complex T>
std::string format_complex (T const &value, numeric_format_options const &options)
 Format a complex value as real+imagi.
 
template<mdspan_like MDS, typename ElementFormatter >
requires (!std::same_as<std::remove_cvref_t<ElementFormatter>, mdspan_format_options>)
std::string format_mdspan (MDS const &mds, output_policy const &policy, ElementFormatter &&formatter, mdspan_format_options const &options={})
 Render every mdspan/tensor element as display-cell-aligned text art.
 
template<mdspan_like MDS>
std::string format_mdspan (MDS const &mds, output_policy const &policy, mdspan_format_options const &options={})
 Render every mdspan/tensor element using default scalar numeric formatting.
 
template<mdspan_like MDS, typename ElementFormatter >
requires (!std::same_as<std::remove_cvref_t<ElementFormatter>, mdspan_preview_options>)
mdspan_preview_result format_mdspan_preview (MDS const &mds, output_policy const &policy, ElementFormatter &&formatter, mdspan_preview_options const &options={})
 Render a bounded mdspan/tensor preview without visiting omitted elements.
 
template<mdspan_like MDS>
mdspan_preview_result format_mdspan_preview (MDS const &mds, output_policy const &policy, mdspan_preview_options const &options={})
 Render a bounded mdspan/tensor preview using default scalar numeric formatting.
 
template<uni20::Real T>
std::string format_real (T value, numeric_format_options const &options)
 Format a real scalar value according to numeric presentation options.
 
template<typename T >
std::string format_scalar (T const &value, numeric_format_options const &options)
 Format an arbitrary scalar-like value for presentation output.
 
template<typename T >
std::string format_scalar_for_output (T const &value, numeric_format_options const &options, output_policy const &policy)
 Format a scalar for policy-aware presentation output.
 
report_builder help_report (program_info const &program, std::string_view usage, std::span< help_group const > groups)
 Construct a full help document shared by plain and styled renderers.
 
std::string indent_text (std::string_view text, std::size_t spaces, output_policy const &policy, bool indent_first=true)
 Indent each rendered line by a fixed number of spaces.
 
auto json_sink (std::ostream &out, data_json_options options={})
 Stream a JSON document.
 
template<DataTableValue... Ts>
auto make_data_table (std::string title, data_column< Ts >... columns)
 Deduce column types with default retained history.
 
template<DataTableValue... Ts>
auto make_data_table (std::string title, data_table_options options, data_column< Ts >... columns)
 Deduce column types with an explicit retention policy and initial metadata.
 
std::string pad_center (std::string_view text, std::size_t target_width, output_policy const &policy)
 Center rendered text within a target width.
 
styled_text pad_center (styled_text const &text, std::size_t target_width, output_policy const &policy)
 Center styled text within a target width.
 
std::string pad_left (std::string_view text, std::size_t target_width, output_policy const &policy)
 Left-pad rendered text to a target width.
 
styled_text pad_left (styled_text const &text, std::size_t target_width, output_policy const &policy)
 Left-pad styled text to a target width.
 
std::string pad_right (std::string_view text, std::size_t target_width, output_policy const &policy)
 Right-pad rendered text to a target width.
 
styled_text pad_right (styled_text const &text, std::size_t target_width, output_policy const &policy)
 Right-pad styled text to a target width.
 
output_policy plain_policy ()
 Build a policy for plain file/log rendering with no ANSI color.
 
std::string prefix_lines (std::string_view text, std::string_view prefix, output_policy const &policy, bool prefix_first=true)
 Prefix each rendered line with fixed text.
 
std::string program_identity (program_info const &program)
 Concise application identity for version output and report headings.
 
report_builder program_report (program_info const &program)
 Construct the application's banner without evaluating its reference provider.
 
template<uni20::Real T>
int real_precision (numeric_format_options const &options)
 Select the configured precision for a Uni20 real scalar type.
 
std::string render (styled_text const &text, output_policy const &policy)
 Render styled text with color/style sequences only when policy allows.
 
std::string render_glyph (semantic_glyph glyph, output_policy const &policy)
 Render a semantic glyph according to an output policy.
 
std::string render_plain (report_builder const &report, output_policy policy=plain_policy())
 Render a high-level report builder without ANSI escape sequences.
 
std::string render_plain (styled_text const &text, output_policy policy=plain_policy())
 Render styled text without ANSI escape sequences.
 
styled_text render_report (report_builder const &report, output_policy const &policy)
 Format a high-level report builder into styled text.
 
std::string render_strict_ascii (styled_text const &text, text_charset charset=text_charset::ascii_escape, output_policy policy=strict_ascii_policy())
 Render styled text under strict ASCII fallback.
 
std::string render_terminal (report_builder const &report, output_policy policy, std::FILE *stream=stdout)
 Render a high-level report builder for a terminal stream.
 
std::string render_terminal (styled_text const &text, output_policy policy, std::FILE *stream=stdout)
 Render styled text for a terminal stream.
 
std::string render_text (std::string_view text, output_policy const &policy)
 Render raw UTF-8 text through charset and ASCII fallback policy.
 
bool should_emit_color (output_policy const &policy)
 Return whether a policy currently permits ANSI color output.
 
output_policy strict_ascii_policy (text_charset charset=text_charset::ascii_escape)
 Build a strict ASCII policy.
 
text_style style (char const *spec)
 Create a callable style wrapper from a style specification.
 
text_style style (std::string_view spec)
 Create a callable style wrapper from a style specification.
 
text_style style (terminal::TerminalStyle style)
 Create a callable style wrapper from terminal style metadata.
 
template<typename T >
std::string style_nonfinite_scalar (std::string text, T const &value, output_policy const &policy)
 Apply the default non-finite scalar style to already-formatted presentation text.
 
output_policy terminal_policy (std::FILE *stream=stdout)
 Build a policy for terminal rendering.
 
auto terminal_sink (data_terminal_options options={})
 Stream deferred display formatting through display::streaming_table.
 
template<DataTableValue... Ts>
report_table to_report_table (data_table< Ts... > const &table, table_projection const &projection={})
 Format a snapshot using column display settings and the existing rich table model.
 
std::string truncate_left_to_width (std::string_view text, std::size_t max_width, output_policy const &policy, std::string_view marker="", std::size_t initial_column=0)
 Truncate rendered text from the left to a target width and optionally prepend a marker.
 
std::string truncate_to_width (std::string_view text, std::size_t max_width, output_policy const &policy, std::string_view marker="", std::size_t initial_column=0)
 Truncate rendered text to a target width and optionally append a marker.
 
auto tsv_sink (std::ostream &out, delimited_options options={})
 Stream tab-delimited CSV rows to a borrowed stream, flushing on explicit finish.
 
std::vector< std::string > wrap_text (std::string_view text, std::size_t max_width, output_policy const &policy)
 Wrap rendered text by display cells or bytes.
 
std::vector< styled_text > wrap_text (styled_text const &text, std::size_t max_width, output_policy const &policy)
 Wrap styled text by display cells or bytes.
 
template<DataTableValue... Ts>
void write_csv (std::ostream &out, data_table< Ts... > const &table, delimited_options options={})
 Write a CSV snapshot with stable headers, quoted strings and empty missing numeric fields.
 
template<DataTableValue... Ts>
void write_json (std::ostream &stream, data_table< Ts... > const &table, data_json_options const &options={})
 Write an ordered schema and typed rows, preserving real and integer precision.
 
template<DataTableValue... Ts>
void write_tsv (std::ostream &out, data_table< Ts... > const &table, delimited_options options={})
 Write tab-delimited CSV using CSV quoting, not whitespace-token splitting.
 

Typedef Documentation

◆ presentation_span

◆ table_entry

using uni20::presentation::table_entry = typedef std::variant<std::vector<table_cell>, table_separator>

◆ table_metadata

using uni20::presentation::table_metadata = typedef std::map<std::string, std::string>

Application metadata is owned text, independent of numerical rows.

Enumeration Type Documentation

◆ ambiguous_width

Selects how East Asian ambiguous-width code points are measured.

Enumerator
narrow 
wide 

◆ color_mode

Selects when terminal color/style control sequences may be emitted.

Enumerator
never 
automatic 
always 

◆ data_export_precision

Precision for delimited numerical output; display mode deliberately rounds real values.

Enumerator
round_trip 
display 

◆ data_sink_operation

Enumerator
begin 
row 
finish 

◆ data_sink_state

Enumerator
active 
closed 
failed 

◆ glyph_set

enum class uni20::presentation::glyph_set
strong

Selects the preferred glyph family for semantic symbols and ornaments.

Enumerator
unicode 
emoji 
ascii 

◆ invalid_utf8

Selects how invalid UTF-8 bytes are represented.

Enumerator
escape 
replace 

◆ mdspan_shape_mode

Selects whether mdspan/tensor art includes shape metadata.

Enumerator
none 
prefix 

◆ ornament_mode

Selects the richness of decorative line and tree glyphs.

Enumerator
none 
minimal 
rich 

◆ real_notation

Selects how real floating-point values are formatted.

Enumerator
general 
fixed 
scientific 

◆ retention

enum class uni20::presentation::retention
strong

Whether accepted rows remain available for snapshots and replay.

Enumerator
all 
none 

◆ semantic_glyph

Names semantic glyphs independently of their rendered spelling.

Enumerator
success 
failure 
fatal 
warning 
info 
partial 
deferred 
skipped 
arrow_right 
arrow_left 
arrow_up 
arrow_down 
arrow_left_right 
ellipsis 
box_horizontal 
box_vertical 
box_top_left 
box_top_right 
box_bottom_left 
box_bottom_right 
box_round_top_left 
box_round_top_right 
box_round_bottom_left 
box_round_bottom_right 
box_tee_left 
box_tee_right 
box_tee_up 
box_tee_down 
box_cross 
box_double_horizontal 
box_double_vertical 
box_double_top_left 
box_double_top_right 
box_double_bottom_left 
box_double_bottom_right 
box_double_tee_left 
box_double_tee_right 
box_double_tee_up 
box_double_tee_down 
box_double_cross 
box_double_vertical_tee_right_single 
box_double_vertical_tee_left_single 
box_double_vertical_cross_single_horizontal 
box_double_down_single_horizontal 
box_double_up_single_horizontal 
box_single_vertical_tee_right_double 
box_single_vertical_tee_left_double 
box_single_vertical_cross_double_horizontal 
box_single_down_double_horizontal 
box_single_up_double_horizontal 
box_diagonal_forward 
box_diagonal_back 
box_diagonal_cross 
tree_branch 
tree_last 
tree_vertical 
tree_space 
bullet 
matrix_top_left 
matrix_top_right 
matrix_middle_left 
matrix_middle_right 
matrix_bottom_left 
matrix_bottom_right 

◆ sink_replay

Full replay is the default. Future-only attachment explicitly opts out of history.

Enumerator
all 
future_only 

◆ table_alignment

Selects table cell alignment in report-style output.

Enumerator
left 
right 
center 
decimal 

◆ table_rule_style

Selects the glyph family used for table rules and borders.

Enumerator
single 
double_line 

◆ text_charset

Selects how non-ASCII text code points are rendered.

Enumerator
utf8 
ascii_escape 
ascii_replace 

◆ width_mode

Selects the unit used by alignment and clipping helpers.

Enumerator
bytes 
display_cells 

Function Documentation

◆ cell() [1/3]

table_cell uni20::presentation::cell ( char const *  text,
std::size_t  span = 1,
std::optional< table_alignment >  alignment = std::nullopt 
)
inline

Build a table cell from literal text.

Parameters
textNull-terminated text payload encoded as UTF-8.
spanNumber of table columns spanned by the cell.
alignmentOptional per-cell alignment override.
Returns
Table cell specification.

◆ cell() [2/3]

table_cell uni20::presentation::cell ( std::string_view  text,
std::size_t  span = 1,
std::optional< table_alignment >  alignment = std::nullopt 
)
inline

Build a table cell from literal text.

Parameters
textText payload encoded as UTF-8.
spanNumber of table columns spanned by the cell.
alignmentOptional per-cell alignment override.
Returns
Table cell specification.

◆ cell() [3/3]

table_cell uni20::presentation::cell ( styled_text  content,
std::size_t  span = 1,
std::optional< table_alignment >  alignment = std::nullopt 
)
inline

Build a table cell from styled presentation text.

Parameters
contentStyled content for the table cell.
spanNumber of table columns spanned by the cell.
alignmentOptional per-cell alignment override.
Returns
Table cell specification.

◆ clip_to_width()

std::string uni20::presentation::clip_to_width ( std::string_view  text,
std::size_t  max_width,
output_policy const &  policy,
std::size_t  initial_column = 0 
)

Clip rendered text to a target width without appending a marker.

Parameters
textInput text.
max_widthMaximum width in the selected width mode.
policyOutput policy controlling fallback and width mode.
initial_columnStarting display column used for tab expansion.
Returns
Rendered text clipped to the requested width.

◆ core_notation()

uni20::real_format_notation uni20::presentation::core_notation ( real_notation  notation)
inline

◆ csv_sink()

auto uni20::presentation::csv_sink ( std::ostream &  out,
delimited_options  options = {} 
)
inline

Stream CSV rows to a borrowed stream, flushing on explicit sink/table finish.

Generic delimited output omits metadata and summaries to remain rectangular.

◆ display_width() [1/2]

std::size_t uni20::presentation::display_width ( std::string_view  text,
output_policy const &  policy,
std::size_t  initial_column = 0 
)

Measure rendered text width under the selected policy.

Parameters
textInput text.
policyOutput policy controlling charset and width mode.
initial_columnStarting display column used for tab expansion.
Returns
Width in bytes or display cells after fallback.

◆ display_width() [2/2]

std::size_t uni20::presentation::display_width ( styled_text const &  text,
output_policy const &  policy,
std::size_t  initial_column = 0 
)

Measure rendered styled text width under the selected policy.

Parameters
textStyled text document.
policyOutput policy controlling glyphs, charset, and width mode.
initial_columnStarting display column used for tab expansion.
Returns
Width in bytes or display cells after fallback.

◆ format_complex()

template<uni20::Complex T>
std::string uni20::presentation::format_complex ( T const &  value,
numeric_format_options const &  options 
)

Format a complex value as real+imagi.

Template Parameters
TComplex scalar type.
Parameters
valueComplex value to format.
optionsNumeric formatting controls.
Returns
Formatted complex numeric text.

◆ format_mdspan() [1/2]

template<mdspan_like MDS, typename ElementFormatter >
requires (!std::same_as<std::remove_cvref_t<ElementFormatter>, mdspan_format_options>)
std::string uni20::presentation::format_mdspan ( MDS const &  mds,
output_policy const &  policy,
ElementFormatter &&  formatter,
mdspan_format_options const &  options = {} 
)

Render every mdspan/tensor element as display-cell-aligned text art.

Template Parameters
MDSMdspan-like object type.
ElementFormatterCallable that formats each scalar element to UTF-8 text.
Parameters
mdsMdspan-like object to render.
policyOutput policy controlling glyphs, charset fallback, and width.
formatterCallable invoked as formatter(element).
optionsMatrix/tensor art controls.
Returns
Rendered matrix or higher-order tensor art containing every element.

◆ format_mdspan() [2/2]

template<mdspan_like MDS>
std::string uni20::presentation::format_mdspan ( MDS const &  mds,
output_policy const &  policy,
mdspan_format_options const &  options = {} 
)

Render every mdspan/tensor element using default scalar numeric formatting.

Template Parameters
MDSMdspan-like object type.
Parameters
mdsMdspan-like object to render.
policyOutput policy controlling glyphs, charset fallback, and width.
optionsMatrix/tensor art and numeric formatting controls.
Returns
Rendered matrix or higher-order tensor art containing every element.

◆ format_mdspan_preview() [1/2]

template<mdspan_like MDS, typename ElementFormatter >
requires (!std::same_as<std::remove_cvref_t<ElementFormatter>, mdspan_preview_options>)
mdspan_preview_result uni20::presentation::format_mdspan_preview ( MDS const &  mds,
output_policy const &  policy,
ElementFormatter &&  formatter,
mdspan_preview_options const &  options = {} 
)

Render a bounded mdspan/tensor preview without visiting omitted elements.

Template Parameters
MDSMdspan-like object type.
ElementFormatterCallable that formats each scalar element to UTF-8 text.
Parameters
mdsMdspan-like object to render.
policyOutput policy controlling glyphs, charset fallback, and width.
formatterCallable invoked only for displayed elements.
optionsPreview, matrix/tensor art, and numeric controls.
Returns
Rendered preview plus metadata describing whether values were elided.

◆ format_mdspan_preview() [2/2]

template<mdspan_like MDS>
mdspan_preview_result uni20::presentation::format_mdspan_preview ( MDS const &  mds,
output_policy const &  policy,
mdspan_preview_options const &  options = {} 
)

Render a bounded mdspan/tensor preview using default scalar numeric formatting.

Template Parameters
MDSMdspan-like object type.
Parameters
mdsMdspan-like object to render.
policyOutput policy controlling glyphs, charset fallback, and width.
optionsPreview, matrix/tensor art, and numeric controls.
Returns
Rendered preview plus metadata describing whether values were elided.

◆ format_real()

template<uni20::Real T>
std::string uni20::presentation::format_real ( T  value,
numeric_format_options const &  options 
)

Format a real scalar value according to numeric presentation options.

Template Parameters
TReal scalar type.
Parameters
valueValue to format.
optionsNumeric formatting controls.
Returns
Formatted numeric text.

◆ format_scalar()

template<typename T >
std::string uni20::presentation::format_scalar ( T const &  value,
numeric_format_options const &  options 
)

Format an arbitrary scalar-like value for presentation output.

Template Parameters
TValue type.
Parameters
valueValue to format.
optionsNumeric formatting controls used for real and complex values.
Returns
Formatted scalar text.

◆ format_scalar_for_output()

template<typename T >
std::string uni20::presentation::format_scalar_for_output ( T const &  value,
numeric_format_options const &  options,
output_policy const &  policy 
)

Format a scalar for policy-aware presentation output.

This is equivalent to format_scalar(value, options) followed by style_nonfinite_scalar(...).

Template Parameters
TValue type.
Parameters
valueValue to format.
optionsNumeric formatting controls used for real and complex values.
policyOutput policy controlling whether non-finite values are styled.
Returns
Formatted scalar text, with non-finite real or complex values highlighted when color is enabled.

◆ help_report()

report_builder uni20::presentation::help_report ( program_info const &  program,
std::string_view  usage,
std::span< help_group const >  groups 
)

Construct a full help document shared by plain and styled renderers.

◆ indent_text()

std::string uni20::presentation::indent_text ( std::string_view  text,
std::size_t  spaces,
output_policy const &  policy,
bool  indent_first = true 
)

Indent each rendered line by a fixed number of spaces.

Parameters
textInput text.
spacesNumber of spaces to insert before each selected line.
policyOutput policy controlling fallback and width mode.
indent_firstWhether to indent the first line as well as following lines.
Returns
Rendered text with fixed indentation inserted.

◆ json_sink()

auto uni20::presentation::json_sink ( std::ostream &  out,
data_json_options  options = {} 
)
inline

Stream a JSON document.

Explicit finish closes its row array, writes summary and flushes.

An interrupted or failed JSON stream can be incomplete; it is not a checkpoint format.

◆ make_data_table() [1/2]

template<DataTableValue... Ts>
auto uni20::presentation::make_data_table ( std::string  title,
data_column< Ts >...  columns 
)

Deduce column types with default retained history.

◆ make_data_table() [2/2]

template<DataTableValue... Ts>
auto uni20::presentation::make_data_table ( std::string  title,
data_table_options  options,
data_column< Ts >...  columns 
)

Deduce column types with an explicit retention policy and initial metadata.

◆ pad_center() [1/2]

std::string uni20::presentation::pad_center ( std::string_view  text,
std::size_t  target_width,
output_policy const &  policy 
)

Center rendered text within a target width.

Parameters
textInput text.
target_widthTarget width in the selected width mode.
policyOutput policy controlling fallback and width mode.
Returns
Rendered text padded on both sides when needed.

◆ pad_center() [2/2]

styled_text uni20::presentation::pad_center ( styled_text const &  text,
std::size_t  target_width,
output_policy const &  policy 
)

Center styled text within a target width.

Parameters
textStyled text document.
target_widthTarget width in the selected width mode.
policyOutput policy controlling fallback and width mode.
Returns
Styled text padded on both sides when needed.

◆ pad_left() [1/2]

std::string uni20::presentation::pad_left ( std::string_view  text,
std::size_t  target_width,
output_policy const &  policy 
)

Left-pad rendered text to a target width.

Parameters
textInput text.
target_widthTarget width in the selected width mode.
policyOutput policy controlling fallback and width mode.
Returns
Rendered text with leading spaces when needed.

◆ pad_left() [2/2]

styled_text uni20::presentation::pad_left ( styled_text const &  text,
std::size_t  target_width,
output_policy const &  policy 
)

Left-pad styled text to a target width.

Parameters
textStyled text document.
target_widthTarget width in the selected width mode.
policyOutput policy controlling fallback and width mode.
Returns
Styled text with leading spaces when needed.

◆ pad_right() [1/2]

std::string uni20::presentation::pad_right ( std::string_view  text,
std::size_t  target_width,
output_policy const &  policy 
)

Right-pad rendered text to a target width.

Parameters
textInput text.
target_widthTarget width in the selected width mode.
policyOutput policy controlling fallback and width mode.
Returns
Rendered text with trailing spaces when needed.

◆ pad_right() [2/2]

styled_text uni20::presentation::pad_right ( styled_text const &  text,
std::size_t  target_width,
output_policy const &  policy 
)

Right-pad styled text to a target width.

Parameters
textStyled text document.
target_widthTarget width in the selected width mode.
policyOutput policy controlling fallback and width mode.
Returns
Styled text with trailing spaces when needed.

◆ plain_policy()

output_policy uni20::presentation::plain_policy ( )

Build a policy for plain file/log rendering with no ANSI color.

Returns
Plain output policy.

◆ prefix_lines()

std::string uni20::presentation::prefix_lines ( std::string_view  text,
std::string_view  prefix,
output_policy const &  policy,
bool  prefix_first = true 
)

Prefix each rendered line with fixed text.

Parameters
textInput text.
prefixPrefix inserted before each selected line.
policyOutput policy controlling fallback and width mode.
prefix_firstWhether to prefix the first line as well as following lines.
Returns
Rendered text with line prefixes inserted.

◆ program_identity()

std::string uni20::presentation::program_identity ( program_info const &  program)

Concise application identity for version output and report headings.

◆ program_report()

report_builder uni20::presentation::program_report ( program_info const &  program)

Construct the application's banner without evaluating its reference provider.

◆ real_precision()

template<uni20::Real T>
int uni20::presentation::real_precision ( numeric_format_options const &  options)

Select the configured precision for a Uni20 real scalar type.

Template Parameters
TReal scalar type.
Parameters
optionsNumeric formatting controls.
Returns
Precision value associated with T.

◆ render()

std::string uni20::presentation::render ( styled_text const &  text,
output_policy const &  policy 
)

Render styled text with color/style sequences only when policy allows.

Parameters
textStyled text document.
policyOutput policy controlling glyphs, charset, and color.
Returns
Rendered string.

◆ render_glyph()

std::string uni20::presentation::render_glyph ( semantic_glyph  glyph,
output_policy const &  policy 
)

Render a semantic glyph according to an output policy.

Parameters
glyphSemantic glyph to render.
policyOutput policy controlling glyph family and ornaments.
Returns
Rendered glyph spelling.

◆ render_plain() [1/2]

std::string uni20::presentation::render_plain ( report_builder const &  report,
output_policy  policy = plain_policy() 
)

Render a high-level report builder without ANSI escape sequences.

Parameters
reportReport description to render.
policyOutput policy to apply apart from forced color suppression.
Returns
Rendered plain string.

◆ render_plain() [2/2]

std::string uni20::presentation::render_plain ( styled_text const &  text,
output_policy  policy = plain_policy() 
)

Render styled text without ANSI escape sequences.

Parameters
textStyled text document.
policyOutput policy to apply apart from forced color suppression.
Returns
Rendered string.

◆ render_report()

styled_text uni20::presentation::render_report ( report_builder const &  report,
output_policy const &  policy 
)

Format a high-level report builder into styled text.

The returned document may already be width-formatted according to policy.wrap_width, with table cell wrapping and column alignment resolved. Prefer the report-specific render_terminal and render_plain overloads for final output; if this intermediate document is rendered directly, do not apply a smaller final wrap_width, because generic whole-string wrapping can split completed table layouts.

Parameters
reportReport description to render.
policyOutput policy controlling width, glyphs, and fallback.
Returns
Styled text document preserving report styles and semantic glyphs.

◆ render_strict_ascii()

std::string uni20::presentation::render_strict_ascii ( styled_text const &  text,
text_charset  charset = text_charset::ascii_escape,
output_policy  policy = strict_ascii_policy() 
)

Render styled text under strict ASCII fallback.

Parameters
textStyled text document.
charsetASCII handling mode for non-ASCII text.
policyBase policy to apply apart from forced ASCII settings.
Returns
Rendered strict ASCII string.

◆ render_terminal() [1/2]

std::string uni20::presentation::render_terminal ( report_builder const &  report,
output_policy  policy,
std::FILE *  stream = stdout 
)

Render a high-level report builder for a terminal stream.

Parameters
reportReport description to render.
policyOutput policy to apply.
streamStream used for automatic color detection.
Returns
Rendered terminal string.

◆ render_terminal() [2/2]

std::string uni20::presentation::render_terminal ( styled_text const &  text,
output_policy  policy,
std::FILE *  stream = stdout 
)

Render styled text for a terminal stream.

Parameters
textStyled text document.
policyOutput policy to apply.
streamStream used for automatic color detection.
Returns
Rendered string.

◆ render_text()

std::string uni20::presentation::render_text ( std::string_view  text,
output_policy const &  policy 
)

Render raw UTF-8 text through charset and ASCII fallback policy.

Parameters
textInput text.
policyOutput policy controlling fallback behavior.
Returns
Rendered text with no ANSI styling.

◆ should_emit_color()

bool uni20::presentation::should_emit_color ( output_policy const &  policy)

Return whether a policy currently permits ANSI color output.

Parameters
policyOutput policy to inspect.
Returns
True when color/style sequences should be emitted.

◆ strict_ascii_policy()

output_policy uni20::presentation::strict_ascii_policy ( text_charset  charset = text_charset::ascii_escape)

Build a strict ASCII policy.

Parameters
charsetASCII handling mode for non-ASCII text.
Returns
Strict ASCII output policy.

◆ style() [1/3]

text_style uni20::presentation::style ( char const *  spec)
inline

Create a callable style wrapper from a style specification.

Parameters
specStyle specification such as "Red;Bold".
Returns
Callable style wrapper.

◆ style() [2/3]

text_style uni20::presentation::style ( std::string_view  spec)
inline

Create a callable style wrapper from a style specification.

Parameters
specStyle specification such as "Red;Bold".
Returns
Callable style wrapper.

◆ style() [3/3]

text_style uni20::presentation::style ( terminal::TerminalStyle  style)
inline

Create a callable style wrapper from terminal style metadata.

Parameters
styleTerminal style metadata to apply to generated spans.
Returns
Callable style wrapper.

◆ style_nonfinite_scalar()

template<typename T >
std::string uni20::presentation::style_nonfinite_scalar ( std::string  text,
T const &  value,
output_policy const &  policy 
)

Apply the default non-finite scalar style to already-formatted presentation text.

Real and complex nan, inf, and -inf values are highlighted when the output policy permits color. Other value types and color-disabled policies leave the text unchanged.

Template Parameters
TScalar value type.
Parameters
textAlready-formatted scalar text.
valueScalar value that produced text.
policyOutput policy controlling whether ANSI style may be emitted.
Returns
Styled text when value is non-finite and color is enabled; otherwise text.

◆ terminal_policy()

output_policy uni20::presentation::terminal_policy ( std::FILE *  stream = stdout)

Build a policy for terminal rendering.

Parameters
streamStream used for automatic terminal detection.
Returns
Terminal-oriented output policy.

◆ terminal_sink()

auto uni20::presentation::terminal_sink ( data_terminal_options  options = {})
inline

Stream deferred display formatting through display::streaming_table.

Uses incremental fit widths and the current display sink; no table history is retained by the adapter.

◆ to_report_table()

template<DataTableValue... Ts>
report_table uni20::presentation::to_report_table ( data_table< Ts... > const &  table,
table_projection const &  projection = {} 
)

Format a snapshot using column display settings and the existing rich table model.

◆ truncate_left_to_width()

std::string uni20::presentation::truncate_left_to_width ( std::string_view  text,
std::size_t  max_width,
output_policy const &  policy,
std::string_view  marker = "",
std::size_t  initial_column = 0 
)

Truncate rendered text from the left to a target width and optionally prepend a marker.

Parameters
textInput text.
max_widthMaximum width in the selected width mode.
policyOutput policy controlling fallback and width mode.
markerMarker prepended when truncation occurs and space permits.
initial_columnStarting display column used for tab expansion.
Returns
Rendered text truncated from the left to the requested width.

◆ truncate_to_width()

std::string uni20::presentation::truncate_to_width ( std::string_view  text,
std::size_t  max_width,
output_policy const &  policy,
std::string_view  marker = "",
std::size_t  initial_column = 0 
)

Truncate rendered text to a target width and optionally append a marker.

Parameters
textInput text.
max_widthMaximum width in the selected width mode.
policyOutput policy controlling fallback and width mode.
markerMarker appended when truncation occurs and space permits.
initial_columnStarting display column used for tab expansion.
Returns
Rendered text truncated to the requested width.

◆ tsv_sink()

auto uni20::presentation::tsv_sink ( std::ostream &  out,
delimited_options  options = {} 
)
inline

Stream tab-delimited CSV rows to a borrowed stream, flushing on explicit finish.

◆ wrap_text() [1/2]

std::vector< std::string > uni20::presentation::wrap_text ( std::string_view  text,
std::size_t  max_width,
output_policy const &  policy 
)

Wrap rendered text by display cells or bytes.

Parameters
textInput text.
max_widthMaximum width per line.
policyOutput policy controlling fallback and width mode.
Returns
Wrapped rendered lines.

◆ wrap_text() [2/2]

std::vector< styled_text > uni20::presentation::wrap_text ( styled_text const &  text,
std::size_t  max_width,
output_policy const &  policy 
)

Wrap styled text by display cells or bytes.

Parameters
textStyled text document.
max_widthMaximum width per line.
policyOutput policy controlling glyph, fallback, and width mode.
Returns
Wrapped styled lines.

◆ write_csv()

template<DataTableValue... Ts>
void uni20::presentation::write_csv ( std::ostream &  out,
data_table< Ts... > const &  table,
delimited_options  options = {} 
)

Write a CSV snapshot with stable headers, quoted strings and empty missing numeric fields.

Writes all rows without modifying the table or flushing/closing the caller-owned stream. Finite reals default to round-trip precision in their stored type. Output errors may leave partial data.

Exceptions
std::ios_base::failureA stream write fails, even when stream exception flags are disabled.

◆ write_json()

template<DataTableValue... Ts>
void uni20::presentation::write_json ( std::ostream &  stream,
data_table< Ts... > const &  table,
data_json_options const &  options = {} 
)

Write an ordered schema and typed rows, preserving real and integer precision.

Fixed-precision reals and wide integers are decimal strings; MPFR cells pair a value string with its bit count or "exact" tag. Half-integers are JSON numbers formatted exactly without floating-point conversion. Readers choose their own numeric precision. UTF-8 text is validated. The caller owns the stream and must check flush/close errors. In-progress snapshots omit the final summary. No-retention tables reject snapshots before writing.

◆ write_tsv()

template<DataTableValue... Ts>
void uni20::presentation::write_tsv ( std::ostream &  out,
data_table< Ts... > const &  table,
delimited_options  options = {} 
)

Write tab-delimited CSV using CSV quoting, not whitespace-token splitting.

Otherwise follows write_csv, including preservation of empty fields and numeric precision.