ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
Table.hpp File Reference

ANSI-safe column-driven table formatting. More...

#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  ppforest2::io::layout::Column
 Column definition for table formatting. More...
 

Namespaces

namespace  ppforest2
 
namespace  ppforest2::io
 
namespace  ppforest2::io::layout
 Column-driven table formatting with ANSI-safe alignment.
 

Typedefs

using ppforest2::io::layout::Row = std::vector<std::string>
 A row of pre-formatted cell strings.
 

Enumerations

enum class  ppforest2::io::layout::Align { ppforest2::io::layout::left , ppforest2::io::layout::right }
 

Functions

std::string ppforest2::io::layout::format_md_row (Row const &cells)
 Format a row as a markdown table row.
 
std::string ppforest2::io::layout::format_md_separator (std::vector< Column > const &columns)
 Generate a markdown alignment row.
 
std::string ppforest2::io::layout::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 ppforest2::io::layout::format_separator (std::vector< Column > const &columns, std::string const &sep=" ")
 Generate a separator line spanning the full table width.
 
Row ppforest2::io::layout::header_labels (std::vector< Column > const &columns)
 Extract header labels from column definitions as a Row.
 
std::string ppforest2::io::layout::pad (std::string const &s, int width, Align align=Align::right)
 Pad a string to a target visual width, handling ANSI codes.
 
int ppforest2::io::layout::visual_width (std::string const &s)
 Compute the visual width of a string, ignoring ANSI escape codes.
 

Detailed Description

ANSI-safe column-driven table formatting.

Provides primitives for building aligned tables that correctly handle strings containing ANSI escape codes. Column widths are defined once and applied consistently across header, separator, and data rows.