|
Core Library
1.7.0.0
Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.
|
Class defining a row of the grid. More...
#include <CsvGridRow.h>
Public Types | |
| using | container_type = C< T, std::allocator< T > > |
| typedef for container type | |
| using | cell_type = T |
| typedef for container type | |
Public Member Functions | |
| TRow ()=default | |
| Default constructor. | |
| TRow (const TRow &)=default | |
| Copy constructor. | |
| TRow (TRow &&)=default | |
| Move constructor. | |
| TRow (size_t numCols) | |
| Initializing constructor. More... | |
| TRow (const std::string &line, eCellFormatOptions options) | |
| Initializing constructor. More... | |
| TRow (std::initializer_list< T > cells) | |
| Initializer list constructor. More... | |
| ~TRow ()=default | |
| Destructor. | |
| TRow & | operator= (const TRow &)=default |
| Copy assignment operator. | |
| TRow & | operator= (TRow &&)=default |
| Move assignment operator. | |
| cell_type & | operator[] (size_t col) |
| Subscript operator. More... | |
| const cell_type & | operator[] (size_t col) const |
| Const subscript operator. More... | |
| bool | Empty () const |
| Get empty state of row. More... | |
| size_t | GetSize () const |
| Get the number of columns. More... | |
| void | SetSize (size_t cols) |
| Set the number of columns in the row. More... | |
| template<typename V > | |
| void | AddColumn (V value) |
| Add a column with the given value. More... | |
| void | AddColumn () |
| Add a column with default value. More... | |
| template<typename V > | |
| void | InsertColumn (size_t col, V value) |
| Insert a new cell. More... | |
| void | InsertColumn (size_t col) |
| Insert a new cell. More... | |
| void | ClearCells () |
| Clear the cells' contents. More... | |
| void | ResetRow () |
| Clear the entire row. More... | |
Private Member Functions | |
| void | LoadRowFromCsvFileLine (const std::string &line, eCellFormatOptions options) |
| Load a row from a line in a CSV file. More... | |
| void | OutputRowToStream (std::ostream &os) const |
| Write the row's contents to a stream object. More... | |
| void | TokenizeLineQuoted (const std::string &line) |
| Tokenize a row with double quoted cells. More... | |
| void | TokenizeLine (const std::string &line) |
| Tokenize a row with simple cells. More... | |
Private Attributes | |
| reserver::ContainerReserver< C, T > | m_reserve {} |
| The reservation function to use when initialising the container. | |
| container_type | m_cells {} |
| The row's cells. | |
Friends | |
| class | TCsvGrid< C, T > |
| Friend declaration of CsvGrid so it can have private access to its rows. | |
Class defining a row of the grid.
This class provides the definition of the interface for a row within the grid. A row contains cells and each cell's position represents a column within the grid.
|
inlineexplicit |
Initializing constructor.
| [in] | numCols | - The initial number of columns. |
Create the row with an initial number of columns.
|
inline |
Initializing constructor.
| [in] | line | - The initial value string - a comma separated line from a CSV file. |
| [in] | options | - The line format. |
Create the row with an initial value and specify whether cells are wrapped in double quotes in the CSV file.
|
inline |
Initializer list constructor.
| [in] | cells | - The initial list of cells. |
Create the row from the given list of cells.
|
inline |
Add a column with the given value.
| [in] | value | - The cell's value for the new column. |
The column count is increased by one and the new cell is initialised with the given string.
|
inline |
Add a column with default value.
The column count is increased by one and the new cell is initialised default value from default cell constructor.
|
inline |
Clear the cells' contents.
The contents of each column's cell is cleared but the column count remains unchanged.
|
inline |
Get empty state of row.
|
inline |
Get the number of columns.
|
inline |
Insert a new cell.
| [in] | col | - The column index at which the new cell is to be inserted. |
| [in] | value | - The value to assign to the newly inserted cell. |
The column count is increased by one and the new cell is initialised with the given string.
|
inline |
Insert a new cell.
| [in] | col | - The column index at which the new cell is to be inserted. |
The column count is increased by one and the new cell is initialised with the default cell constructor.
|
inlineprivate |
Load a row from a line in a CSV file.
| [in] | line | - The line from the CSV file. |
| [in] | options | - The cell format options. |
Create a row by loading it from a line read in from a CSV file. The options parameter is used to decide how to tokenize the line.
|
inline |
Subscript operator.
| [in] | col | - A 0-based column index. |
Retrieve the cell at a given column index within a row.
|
inline |
Const subscript operator.
| [in] | col | - A 0-based column index. |
Retrieve the cell at a given column index within a row.
|
inlineprivate |
Write the row's contents to a stream object.
| [in,out] | os | - The stream object to write to. |
The row's contents are formatted using CSV formating and output to the stream object.
|
inline |
Clear the entire row.
The cells are completely removed from the row leaving the column count as 0 afterwards.
|
inline |
Set the number of columns in the row.
| [in] | cols | - The number of columns to set. |
If the number of columns are being increased then existing content is preserved and new cells are added at the end of the row forming the extra columns.
|
inlineprivate |
Tokenize a row with simple cells.
| [in] | line | - A CSV file's line of text. |
The comma separated row's tokens are extracted using a simple getline based algorithm. This versio ncannot handle double quoted cells.
|
inlineprivate |
Tokenize a row with double quoted cells.
| [in] | line | - A CSV file's line of text. |
The comma separated row's tokens are extracted using a boost tokenizer object. This does impact the performance slightly.