![]() |
TSDuck v3.46-4965
MPEG Transport Stream Toolkit
|
#include <tsTextTable.h>
Public Types | |
| enum class | Align { RIGHT , LEFT } |
| enum class | Headers { NONE , TEXT , UNDERLINED } |
Public Member Functions | |
| TextTable ()=default | |
| template<typename ID> requires std::integral<ID> || std::is_enum_v<ID> | |
| bool | addColumn (ID id, const UString &header, Align align=Align::LEFT) |
| void | clear () |
| size_t | columnCount () const |
| size_t | currentLine () const |
| size_t | lineCount () const |
| size_t | newLine () |
| void | output (std::ostream &out, Headers headers, bool skip_empty=false, const UString &margin=UString(), const UString &separator=u" ") const |
| template<typename ID> requires std::integral<ID> || std::is_enum_v<ID> | |
| bool | setCell (ID column, const StringifyInterface &value) |
| template<typename ID> requires std::integral<ID> || std::is_enum_v<ID> | |
| bool | setCell (ID column, const UString &value) |
| template<typename ID> requires std::integral<ID> || std::is_enum_v<ID> | |
| bool | setCell (size_t line, ID column, const StringifyInterface &value) |
| template<typename ID> requires std::integral<ID> || std::is_enum_v<ID> | |
| bool | setCell (size_t line, ID column, const UString &value) |
| void | setCurrentLine (size_t line) |
This class produces a formatted table of text lines and columns.
Comparison with class Grid:
|
strong |
|
strong |
|
default |
Default constructor.
| void ts::TextTable::clear | ( | ) |
Clear the content of the table.
|
inline |
Define a column.
A new column is added. Columns must be added in order, from left to right. Each column is identified by an identifier, an integer of enumeration value. Content lines will be filled in any order using the id of the column.
| ID | An integral of enumeration type which is used to identify the columns. |
| [in] | id | Identifier of the column. |
| [in] | header | Top-column header text. |
| [in] | align | Column alignment. |
|
inline |
Fill a table cell of the current line with text. If the table is empty, the first line is implicitly created and becomes the current line.
| ID | An integral of enumeration type which is used to identify the columns. |
| [in] | column | Identifier of the column. |
| [in] | value | Text value to set. |
|
inline |
Fill a table cell of the current line with text. If the table is empty, the first line is implicitly created and becomes the current line.
| ID | An integral of enumeration type which is used to identify the columns. |
| [in] | column | Identifier of the column. |
| [in] | value | Text value to set. |
|
inline |
Fill a table cell of the given line with text. The current line remains unchanged.
| ID | An integral of enumeration type which is used to identify the columns. |
| [in] | line | Number of the line to fill. If the line does not exist, the table is extended up to that line. |
| [in] | column | Identifier of the column. |
| [in] | value | Text value to set. |
|
inline |
Fill a table cell of the given line with text. The current line remains unchanged.
| ID | An integral of enumeration type which is used to identify the columns. |
| [in] | line | Number of the line to fill. If the line does not exist, the table is extended up to that line. |
| [in] | column | Identifier of the column. |
| [in] | value | Text value to set. |
|
inline |
Get the number of columns in the table.
|
inline |
Get the number of lines in the table.
|
inline |
Creates a new line at the end of the table and make it the current line.
|
inline |
Get the current line.
|
inline |
Set the current line.
| [in] | line | Number of the line. If the line does not exist, the table is extended up to that line. |
| void ts::TextTable::output | ( | std::ostream & | out, |
| Headers | headers, | ||
| bool | skip_empty = false, | ||
| const UString & | margin = UString(), | ||
| const UString & | separator = u" " ) const |
Display the table.
| [in,out] | out | Reference to the output text device. |
| [in] | headers | Style of column headers. |
| [in] | skip_empty | If true, empty lines and empty columns are removed. |
| [in] | margin | Left margin to print. |
| [in] | separator | Separator string between columns. |