TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
TablePrinter Class Reference

#include <TablePrinter.h>

Public Member Functions

 TablePrinter (std::ostream *output, const std::string &separator="│")
 ~TablePrinter ()
int get_num_columns () const
int get_table_width () const
void set_separator (const std::string &separator)
void set_flush_left ()
void set_flush_right ()
void AddColumn (const std::string &header_name, int column_width)
 Add a column to our table.
void PrintHeader ()
void PrintFooter ()
TablePrinteroperator<< (endl input)
TablePrinteroperator<< (float input)
TablePrinteroperator<< (double input)
template<typename T>
TablePrinteroperator<< (T input)

Detailed Description

Print a pretty table into your output of choice.

Usage: TablePrinter tp(&std::cout); tp.AddColumn("Name", 25); tp.AddColumn("Age", 3); tp.AddColumn("Position", 30);

tp.PrintHeader(); tp << "Dat Chu" << 25 << "Research Assistant"; tp << "John Doe" << 26 << "Professional Anonymity"; tp << "Jane Doe" << tp.SkipToNextLine(); tp << "Tom Doe" << 7 << "Student"; tp.PrintFooter();

Definition at line 47 of file TablePrinter.h.

Constructor & Destructor Documentation

◆ TablePrinter()

bprinter::TablePrinter::TablePrinter ( std::ostream * output,
const std::string & separator = "│" )

Definition at line 22 of file TablePrinter.cpp.

◆ ~TablePrinter()

Member Function Documentation

◆ AddColumn()

void bprinter::TablePrinter::AddColumn ( const std::string & header_name,
int column_width )

Add a column to our table.

Parameters
header_nameName to be print for the header
column_widththe width of the column (has to be >=5)

Definition at line 60 of file TablePrinter.cpp.

◆ get_num_columns()

Definition at line 35 of file TablePrinter.cpp.

◆ get_table_width()

◆ operator<<() [1/4]

TablePrinter & bprinter::TablePrinter::operator<< ( double input)

Definition at line 118 of file TablePrinter.cpp.

◆ operator<<() [2/4]

TablePrinter & bprinter::TablePrinter::operator<< ( endl input)
inline

Definition at line 63 of file TablePrinter.h.

◆ operator<<() [3/4]

TablePrinter & bprinter::TablePrinter::operator<< ( float input)

Definition at line 112 of file TablePrinter.cpp.

◆ operator<<() [4/4]

template<typename T>
TablePrinter & bprinter::TablePrinter::operator<< ( T input)
inline

Definition at line 76 of file TablePrinter.h.

◆ PrintFooter()

Definition at line 107 of file TablePrinter.cpp.

◆ PrintHeader()

Definition at line 83 of file TablePrinter.cpp.

◆ set_flush_left()

Definition at line 45 of file TablePrinter.cpp.

◆ set_flush_right()

Definition at line 50 of file TablePrinter.cpp.

◆ set_separator()

void bprinter::TablePrinter::set_separator ( const std::string & separator)

Definition at line 40 of file TablePrinter.cpp.


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