|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Column-driven table formatting with ANSI-safe alignment. More...
Classes | |
| struct | Column |
| Column definition for table formatting. More... | |
Typedefs | |
| using | Row = std::vector<std::string> |
| A row of pre-formatted cell strings. | |
Enumerations | |
| enum class | Align { left , right } |
Functions | |
| std::string | format_md_row (Row const &cells) |
| Format a row as a markdown table row. | |
| std::string | format_md_separator (std::vector< Column > const &columns) |
| Generate a markdown alignment row. | |
| std::string | format_row (std::vector< Column > const &columns, Row const &cells, std::string const &sep=" ") |
| Format a row of cells according to column definitions. | |
| std::string | format_separator (std::vector< Column > const &columns, std::string const &sep=" ") |
| Generate a separator line spanning the full table width. | |
| Row | header_labels (std::vector< Column > const &columns) |
| Extract header labels from column definitions as a Row. | |
| std::string | pad (std::string const &s, int width, Align align=Align::right) |
| Pad a string to a target visual width, handling ANSI codes. | |
| int | visual_width (std::string const &s) |
| Compute the visual width of a string, ignoring ANSI escape codes. | |
Column-driven table formatting with ANSI-safe alignment.
Provides primitives for building aligned text tables that correctly handle ANSI escape codes when computing column widths. Used for terminal output of confusion matrices, benchmark results, and evaluation summaries.
| using ppforest2::io::layout::Row = std::vector<std::string> |
A row of pre-formatted cell strings.
|
strong |
|
inline |
Format a row as a markdown table row.
|
inline |
Generate a markdown alignment row.
|
inline |
Format a row of cells according to column definitions.
Each cell is padded to its column's width using ANSI-safe padding.
|
inline |
Generate a separator line spanning the full table width.
Extract header labels from column definitions as a Row.
|
inline |
Pad a string to a target visual width, handling ANSI codes.
Unlike fmt::format width specifiers, this correctly handles strings containing ANSI escape codes by computing visual width separately.
|
inline |
Compute the visual width of a string, ignoring ANSI escape codes.
Skips any ESC [ ... m (SGR) sequences when counting characters.