TSDuck v3.46-4964
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches

#include <tsGrid.h>

Classes

class  ColumnLayout
class  ColumnText

Public Member Functions

 Grid (std::ostream &output)
 ~Grid ()
ColumnLayout border () const
ColumnLayout both (size_t width=0, UChar pad=SPACE) const
ColumnLayout bothTruncateLeft (size_t width=0, UChar pad=SPACE) const
ColumnLayout bothTruncateRight (size_t width=0, UChar pad=SPACE) const
void closeTable ()
ColumnLayout left (size_t width=0, UChar pad=SPACE) const
size_t lineCount () const
size_t lineWidth () const
size_t marginWidth () const
void openTable ()
void putLayout (const std::initializer_list< ColumnText > text)
void putLine (const UString &left, const UString &right, bool one_line=true)
void putLine (const UString &line=UString())
void putMultiLine (const UString &text=UString())
ColumnLayout right (size_t width=0, UChar pad=SPACE) const
void section ()
void setLayout (const std::initializer_list< ColumnLayout > layout)
void setLineWidth (size_t lineWidth=DEFAULT_LINE_WIDTH, size_t marginWidth=DEFAULT_MARGIN_WIDTH)
std::ostream & stream () const
void subSection ()
bool tableIsOpen () const

Static Public Attributes

static constexpr size_t DEFAULT_LINE_WIDTH = 80
static constexpr size_t DEFAULT_MARGIN_WIDTH = 2

Detailed Description

This class produces a report in a grid format with tables and sections.

See also
TextTable

Constructor & Destructor Documentation

◆ Grid()

ts::Grid::Grid ( std::ostream & output)

Constructor.

Parameters
[in,out]outputReference to the output text device.

◆ ~Grid()

ts::Grid::~Grid ( )

Destructor.

Member Function Documentation

◆ stream()

std::ostream & ts::Grid::stream ( ) const
inline

Get a reference to the output stream.

Returns
A reference to the output stream.

◆ setLineWidth()

void ts::Grid::setLineWidth ( size_t lineWidth = DEFAULT_LINE_WIDTH,
size_t marginWidth = DEFAULT_MARGIN_WIDTH )

Set the report display line width.

Parameters
[in]lineWidthNew line width.
[in]marginWidthNew margin width.

◆ lineWidth()

size_t ts::Grid::lineWidth ( ) const
inline

Get the report display line width.

Returns
The line width.

◆ marginWidth()

size_t ts::Grid::marginWidth ( ) const
inline

Get the report display margin width.

Returns
The margin width.

◆ lineCount()

size_t ts::Grid::lineCount ( ) const
inline

Get the number of displayed lines.

Returns
The number of displayed lines.

◆ openTable()

void ts::Grid::openTable ( )

Open a table, if not already done.

◆ tableIsOpen()

bool ts::Grid::tableIsOpen ( ) const
inline

Check if a table is open.

Returns
True if a table is open.

◆ closeTable()

void ts::Grid::closeTable ( )

Close a table, if not already done.

◆ section()

void ts::Grid::section ( )

Draw section delimiter.

◆ subSection()

void ts::Grid::subSection ( )

Draw sub-section delimiter.

◆ putLine() [1/2]

void ts::Grid::putLine ( const UString & line = UString())

Write a line with one field, truncated.

Parameters
[in]lineLine content.

◆ putMultiLine()

void ts::Grid::putMultiLine ( const UString & text = UString())

Write a text, wrap on multiple lines when necessary.

Parameters
[in]textText to display.

◆ putLine() [2/2]

void ts::Grid::putLine ( const UString & left,
const UString & right,
bool one_line = true )

Write a line with two fields, possibly on two lines.

Parameters
[in]leftLeft-side content.
[in]rightRight-side content.
[in]one_lineIf true, force the packing on one line. If false, allow two lines, one for each text, in case of overflow.

◆ left()

ColumnLayout ts::Grid::left ( size_t width = 0,
UChar pad = SPACE ) const
inline

Build a ColumnLayout with one text field, left-justified.

Parameters
[in]widthRequested width in characters.
[in]padPadding character.
Returns
The corresponding ColumnLayout.

◆ right()

ColumnLayout ts::Grid::right ( size_t width = 0,
UChar pad = SPACE ) const
inline

Build a ColumnLayout with one text field, right-justified.

Parameters
[in]widthRequested width in characters.
[in]padPadding character.
Returns
The corresponding ColumnLayout.

◆ both()

ColumnLayout ts::Grid::both ( size_t width = 0,
UChar pad = SPACE ) const
inline

Build a ColumnLayout with two text field, left-justified and right-justified. In case of overflow, both are truncated.

Parameters
[in]widthRequested width in characters.
[in]padPadding character.
Returns
The corresponding ColumnLayout.

◆ bothTruncateLeft()

ColumnLayout ts::Grid::bothTruncateLeft ( size_t width = 0,
UChar pad = SPACE ) const
inline

Build a ColumnLayout with two text field, left-justified and right-justified, truncate left one on overflow.

Parameters
[in]widthRequested width in characters.
[in]padPadding character.
Returns
The corresponding ColumnLayout.

◆ bothTruncateRight()

ColumnLayout ts::Grid::bothTruncateRight ( size_t width = 0,
UChar pad = SPACE ) const
inline

Build a ColumnLayout with two text field, left-justified and right-justified, truncate right one on overflow.

Parameters
[in]widthRequested width in characters.
[in]padPadding character.
Returns
The corresponding ColumnLayout.

◆ border()

ColumnLayout ts::Grid::border ( ) const
inline

Build a ColumnLayout creating a vertical border between the two adjacent columns.

Returns
The corresponding ColumnLayout.

◆ setLayout()

void ts::Grid::setLayout ( const std::initializer_list< ColumnLayout > layout)

Define the current column layout.

Parameters
[in]layoutList of columns layouts. Depending on the width of the grid, the layout may be rearranged.

◆ putLayout()

void ts::Grid::putLayout ( const std::initializer_list< ColumnText > text)

Write one line of text in the columns layout.

Parameters
[in]textContent of the columns. There should be no element for Border() columns. For Left() and Right() column, only one text shall be set. For Both() layout, the two texts shall be set.

Member Data Documentation

◆ DEFAULT_LINE_WIDTH

size_t ts::Grid::DEFAULT_LINE_WIDTH = 80
staticconstexpr

Default report line width.

◆ DEFAULT_MARGIN_WIDTH

size_t ts::Grid::DEFAULT_MARGIN_WIDTH = 2
staticconstexpr

Default margin width.


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