|
| | CTable () |
| |
| virtual | ~CTable () |
| |
| bool | AddColumn (const CString &sName) |
| | Adds a new column to the table.
|
| |
| bool | SetStyle (EStyle eNewStyle) |
| | Selects the output style of the table.
|
| |
| size_type | AddRow () |
| | Adds a new row to the table.
|
| |
| bool | SetCell (const CString &sColumn, const CString &sValue, size_type uRowIdx=~0) |
| | Sets a given cell in the table to a value.
|
| |
| bool | GetLine (unsigned int uIdx, CString &sLine) const |
| | Get a line of the table's output.
|
| |
| CString::size_type | GetColumnWidth (unsigned int uIdx) const |
| | Return the width of the given column.
|
| |
| void | Clear () |
| | Completely clear the table.
|
| |
Generate a grid-like or list-like output from a given input.
unsigned int idx = 0;
while (table.
GetLine(idx++, tmp)) {
}
String class that is used inside ZNC.
Definition ZNCString.h:50
Generate a grid-like or list-like output from a given input.
Definition Utils.h:173
bool AddColumn(const CString &sName)
Adds a new column to the table.
bool SetCell(const CString &sColumn, const CString &sValue, size_type uRowIdx=~0)
Sets a given cell in the table to a value.
bool GetLine(unsigned int uIdx, CString &sLine) const
Get a line of the table's output.
size_type AddRow()
Adds a new row to the table.
The above code would generate the following output:
+-------+-------+
| a | b |
+-------+-------+
| hello | world |
+-------+-------+
If the table has at most two columns, one can switch to ListStyle output
like so:
@code
CTable table;
table.AddColumn("a");
table.AddColumn("b");
table.SetStyle(CTable::ListStyle);
// ...
@endcode
This will yield the following (Note that the header is omitted; asterisks
denote bold text):
@verbatim
hello: world