Table class.
More...
#include <LArFormattingHelper.h>
Table class.
Definition at line 128 of file LArFormattingHelper.h.
lar_content::LArFormattingHelper::Table::Table |
( |
const pandora::StringVector & |
columnTitles, |
|
|
const unsigned int |
precision = 3 |
|
) |
| |
Table constructor.
- Parameters
-
columnTitles | the string columns titles use empty string for a separator column |
precision | the number of significant figures to display for number type table elements |
Definition at line 88 of file LArFormattingHelper.cc.
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.
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)
template<typename T >
void lar_content::LArFormattingHelper::Table::AddElement |
( |
const T & |
value, |
|
|
const Style |
style = REGULAR , |
|
|
const Color |
color = DEFAULT |
|
) |
| |
|
inline |
Add an element to the table into the next (non-separator) column.
- Parameters
-
value | the element to add to the table |
style | the style of the element |
color | the color of the element |
Definition at line 217 of file LArFormattingHelper.h.
222 throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
pandora::StringVector m_format
The formatting of each table element.
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
std::stringstream m_stringstream
The stringstream to print objects to.
pandora::StringVector m_elements
The vector of flattened table elements.
void CheckAndSetSeparatorColumn()
Check if the next table cell is in a separator column, if so add a blank element. ...
void UpdateColumnWidth()
Update the width of the last column in which an element was added.
void lar_content::LArFormattingHelper::Table::CheckAndSetSeparatorColumn |
( |
| ) |
|
|
private |
Check if the next table cell is in a separator column, if so add a blank element.
Definition at line 100 of file LArFormattingHelper.cc.
pandora::StringVector m_format
The formatting of each table element.
pandora::StringVector m_elements
The vector of flattened table elements.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
bool lar_content::LArFormattingHelper::Table::IsSeparatorColumn |
( |
const unsigned int |
column | ) |
const |
|
private |
If the supplied column is a separator (vertical rule)
- Parameters
-
column | the column index to check |
- Returns
- true/false
Definition at line 111 of file LArFormattingHelper.cc.
114 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
std::vector< std::string > column
void lar_content::LArFormattingHelper::Table::Print |
( |
void |
| ) |
const |
Print the table.
Definition at line 133 of file LArFormattingHelper.cc.
void PrintTableElements() const
Print the table elements.
void PrintHorizontalLine() const
Print a horizontal line.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
void PrintColumnTitles() const
Print the column titles.
void lar_content::LArFormattingHelper::Table::PrintColumnTitles |
( |
| ) |
const |
|
private |
Print the column titles.
- Parameters
-
widths | a vector of the number of characters to include in each column |
Definition at line 145 of file LArFormattingHelper.cc.
147 for (
unsigned int i = 0, nColumns =
m_columnTitles.size(); i < nColumns; ++i)
void PrintTableCell(const std::string &value, const std::string &format, const unsigned int index) const
Print a table cell.
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
void lar_content::LArFormattingHelper::Table::PrintHorizontalLine |
( |
| ) |
const |
|
private |
Print a horizontal line.
- Parameters
-
widths | a vector of the number of characters to include in each column |
Definition at line 153 of file LArFormattingHelper.cc.
155 for (
unsigned int i = 0, nColumns =
m_columnTitles.size(); i < nColumns; ++i)
void PrintTableCell(const std::string &value, const std::string &format, const unsigned int index) const
Print a table cell.
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
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 lar_content::LArFormattingHelper::Table::PrintTableCell |
( |
const std::string & |
value, |
|
|
const std::string & |
format, |
|
|
const unsigned int |
index |
|
) |
| const |
|
private |
Print a table cell.
- Parameters
-
value | the string to print in the cell |
format | a formatting string (see GetFormatCharacter(...)) |
index | the index of the table cell (0 –> number of elements) used to find the column |
widths | a vector of the number of characters to include in each column |
Definition at line 180 of file LArFormattingHelper.cc.
189 << std::resetiosflags(std::ios::adjustfield);
bool IsSeparatorColumn(const unsigned int column) const
If the supplied column is a separator (vertical rule)
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
Q_EXPORT QTSManip setw(int w)
std::vector< unsigned int > m_widths
The widths of each column (in units of number of characters)
std::vector< std::string > column
static void ResetStyle(std::ostream &stream=std::cout)
Reset the style of the standard output stream.
QTextStream & endl(QTextStream &s)
void lar_content::LArFormattingHelper::Table::PrintTableElements |
( |
| ) |
const |
|
private |
Print the table elements.
- Parameters
-
widths | a vector of the number of characters to include in each column |
Definition at line 161 of file LArFormattingHelper.cc.
170 std::cout <<
"LArFormattingHelper::Table::PrintTableElements - Error: Number of table elements added doesn't fill a whole row" <<
std::endl;
171 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
174 for (
unsigned int i = 0; i < nRows * nColumns; i++)
void PrintTableCell(const std::string &value, const std::string &format, const unsigned int index) const
Print a table cell.
pandora::StringVector m_format
The formatting of each table element.
pandora::StringVector m_elements
The vector of flattened table elements.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
QTextStream & endl(QTextStream &s)
void lar_content::LArFormattingHelper::Table::UpdateColumnWidth |
( |
| ) |
|
|
private |
Update the width of the last column in which an element was added.
Definition at line 121 of file LArFormattingHelper.cc.
124 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
126 const unsigned int currentElementIndex(
m_elements.size() - 1);
pandora::StringVector m_elements
The vector of flattened table elements.
static int max(int a, int b)
std::vector< unsigned int > m_widths
The widths of each column (in units of number of characters)
std::vector< std::string > column
const unsigned int lar_content::LArFormattingHelper::Table::m_precision |
|
private |
The number of significant figures to use when displaying number types.
Definition at line 206 of file LArFormattingHelper.h.
std::stringstream lar_content::LArFormattingHelper::Table::m_stringstream |
|
private |
std::vector<unsigned int> lar_content::LArFormattingHelper::Table::m_widths |
|
private |
The documentation for this class was generated from the following files: