8#ifndef LAR_FORMATTING_HELPER_H
9#define LAR_FORMATTING_HELPER_H 1
28 enum Color :
unsigned int;
29 enum Style :
unsigned int;
36 static void SetStyle(
const Style style, std::ostream &stream = std::cout);
43 static void SetColor(
const Color color, std::ostream &stream = std::cout);
48 static void ResetStyle(std::ostream &stream = std::cout);
53 static void ResetColor(std::ostream &stream = std::cout);
58 static void Reset(std::ostream &stream = std::cout);
80 static void PrintHeader(
const std::string &title =
"",
const unsigned int width = 140);
87 static void PrintRule(
const unsigned int width = 140);
151 template <
typename T>
193 void PrintTableCell(
const std::string &value,
const std::string &format,
const unsigned int index)
const;
Header file defining relevant internal typedefs, sort and string conversion functions.
Header file defining status codes and relevant preprocessor macros.
void PrintHorizontalLine() const
Print a horizontal line.
void CheckAndSetSeparatorColumn()
Check if the next table cell is in a separator column, if so add a blank element.
void AddElement(const T &value, const Style style=REGULAR, const Color color=DEFAULT)
Add an element to the table into the next (non-separator) column.
pandora::StringVector m_format
The formatting of each table element.
std::stringstream m_stringstream
The stringstream to print objects to.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
std::vector< unsigned int > m_widths
The widths of each column (in units of number of characters)
void PrintTableCell(const std::string &value, const std::string &format, const unsigned int index) const
Print a table cell.
void Print() const
Print the table.
const unsigned int m_precision
The number of significant figures to use when displaying number types.
void UpdateColumnWidth()
Update the width of the last column in which an element was added.
pandora::StringVector m_elements
The vector of flattened table elements.
bool IsSeparatorColumn(const unsigned int column) const
If the supplied column is a separator (vertical rule)
void PrintColumnTitles() const
Print the column titles.
void PrintTableElements() const
Print the table elements.
LArFormattingHelper class.
static void Reset(std::ostream &stream=std::cout)
Reset the formatting and text color of the standard output stream.
static void PrintRule(const unsigned int width=140)
Print a horizontal rule.
Style
Style code enumeration.
static void SetStyle(const Style style, std::ostream &stream=std::cout)
Set the format style (to standard output stream)
Color
Style code enumeration.
static void PrintHeader(const std::string &title="", const unsigned int width=140)
Print a header line of a given width.
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
static void ResetStyle(std::ostream &stream=std::cout)
Reset the style of the standard output stream.
static void SetColor(const Color color, std::ostream &stream=std::cout)
Set the text color (of standard output stream)
static void ResetColor(std::ostream &stream=std::cout)
Reset the text color of the standard output stream.
static void PrintFormatCharacter(const unsigned int code, std::ostream &stream=std::cout)
Print a formatting character to the standard output stream.
StatusCodeException class.
std::vector< std::string > StringVector