8 #ifndef LAR_FORMATTING_HELPER_H
9 #define LAR_FORMATTING_HELPER_H 1
11 #include "Pandora/PandoraInternal.h"
12 #include "Pandora/StatusCodes.h"
28 enum Color :
unsigned int;
29 enum Style :
unsigned int;
80 static void PrintHeader(
const std::string &title =
"",
const unsigned int width = 140);
87 static void PrintRule(
const unsigned int width = 140);
137 Table(
const pandora::StringVector &columnTitles,
const unsigned int precision = 3);
151 template <
typename T>
193 void PrintTableCell(
const std::string &value,
const std::string &
format,
const unsigned int index)
const;
216 template <
typename T>
222 throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
234 #endif // #ifndef LAR_FORMATTING_HELPER_H
void PrintTableCell(const std::string &value, const std::string &format, const unsigned int index) const
Print a table cell.
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)
bool IsSeparatorColumn(const unsigned int column) const
If the supplied column is a separator (vertical rule)
pandora::StringVector m_format
The formatting of each table element.
LArFormattingHelper class.
void PrintTableElements() const
Print the table elements.
static void SetColor(const Color color, std::ostream &stream=std::cout)
Set the text color (of standard output stream)
static void PrintFormatCharacter(const unsigned int code, std::ostream &stream=std::cout)
Print a formatting character to the standard output stream.
Math::BigFloat precision(-16)
Color
Style code enumeration.
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
void PrintHorizontalLine() const
Print a horizontal line.
std::stringstream m_stringstream
The stringstream to print objects to.
const unsigned int m_precision
The number of significant figures to use when displaying number types.
static void PrintHeader(const std::string &title="", const unsigned int width=140)
Print a header line of a given width.
pandora::StringVector m_elements
The vector of flattened table elements.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
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.
void CheckAndSetSeparatorColumn()
Check if the next table cell is in a separator column, if so add a blank element. ...
Table(const pandora::StringVector &columnTitles, const unsigned int precision=3)
Table constructor.
static void ResetColor(std::ostream &stream=std::cout)
Reset the text color of the standard output stream.
Style
Style code enumeration.
std::vector< unsigned int > m_widths
The widths of each column (in units of number of characters)
void Print() const
Print the table.
static void Reset(std::ostream &stream=std::cout)
Reset the formatting and text color of the standard output stream.
static void ResetStyle(std::ostream &stream=std::cout)
Reset the style of the standard output stream.
void UpdateColumnWidth()
Update the width of the last column in which an element was added.
void PrintColumnTitles() const
Print the column titles.
BEGIN_PROLOG could also be cout
enum Color unsigned int enum static Style unsigned int void SetStyle(const Style style, std::ostream &stream=std::cout)
Set the format style (to standard output stream)
static void PrintRule(const unsigned int width=140)
Print a horizontal rule.