Generate a grid-like output from a given input.
More...
#include <Utils.h>
Generate a grid-like output from a given input.
*
* unsigned int idx = 0;
*
while (table.
GetLine(idx++, tmp)) {
*
* }
*
The above code would generate the following output:
+-------+-------+
| a | b |
+-------+-------+
| hello | world |
+-------+-------+
virtual CTable::~CTable |
( |
| ) |
|
|
inlinevirtual |
bool CTable::AddColumn |
( |
const CString & |
sName | ) |
|
Adds a new column to the table.
Please note that you should add all columns before starting to fill the table!
- Parameters
-
sName | The name of the column. |
- Returns
- false if a column by that name already existed.
size_type CTable::AddRow |
( |
| ) |
|
Adds a new row to the table.
After calling this you can fill the row with content.
- Returns
- The index of this row
Completely clear the table.
CString::size_type CTable::GetColumnWidth |
( |
unsigned int |
uIdx | ) |
const |
Return the width of the given column.
Please note that adding and filling new rows might change the result of this function!
- Parameters
-
uIdx | The index of the column you are interested in. |
- Returns
- The width of the column.
bool CTable::GetLine |
( |
unsigned int |
uIdx, |
|
|
CString & |
sLine |
|
) |
| const |
Get a line of the table's output.
- Parameters
-
uIdx | The index of the line you want. |
sLine | This string will receive the output. |
- Returns
- True unless uIdx is past the end of the table.
bool CTable::SetCell |
( |
const CString & |
sColumn, |
|
|
const CString & |
sValue, |
|
|
size_type |
uRowIdx = ~0 |
|
) |
| |
Sets a given cell in the table to a value.
- Parameters
-
sColumn | The name of the column you want to fill. |
sValue | The value to write into that column. |
uRowIdx | The index of the row to use as returned by AddRow(). If this is not given, the last row will be used. |
- Returns
- True if setting the cell was successful.
T std::vector< T >::elements |
|
inherited |
std::map<CString, CString::size_type> CTable::m_msuWidths |
|
protected |
std::vector<CString> CTable::m_vsHeaders |
|
protected |
The documentation for this class was generated from the following file: