|
Alexandria 2.32.0
SDC-CH common library for the Euclid project
|
Represents one row of a Table. More...
#include <Row.h>

Public Types | |
| using | cell_type |
| The possible cell types. | |
| using | const_iterator = std::vector<cell_type>::const_iterator |
Public Member Functions | |
| Row (std::vector< cell_type > values, std::shared_ptr< ColumnInfo > column_info) | |
| Constructs a Row with the given cell values and column info descriptor. | |
| virtual | ~Row ()=default |
| Default destructor. | |
| std::shared_ptr< ColumnInfo > | getColumnInfo () const |
| Returns a ColumnInfo object describing the columns of the Row. | |
| size_t | size () const |
| Returns the number of cells in the row. | |
| const cell_type & | operator[] (const size_t index) const |
| Returns the value of the column with the given index (zero based). | |
| const cell_type & | operator[] (const std::string &column) const |
| Returns the value of the row for the given column. | |
| const_iterator | begin () const |
| Returns a const iterator to the first cell of the row. | |
| const_iterator | end () const |
| Returns a const iterator to the past-the-end cell of the row. | |
Private Attributes | |
| std::vector< cell_type > | m_values |
| std::shared_ptr< ColumnInfo > | m_column_info |
Represents one row of a Table.
The Row is an immutable class which represents a single row of a Table. It contains one cell for each column, which has a value of one of the types defined in the cell_type boost::variant specialization. The information about the columns can be retrieved via a ColumnInfo object provided by the getColumnInfo() method. The values of the cells, in the case they are of std::string type, they cannot be the empty string, neither a string containing whitespace characters, because these values break the representation of the columns in the ASCII file.
The possible cell types.
| using Euclid::Table::Row::const_iterator = std::vector<cell_type>::const_iterator |
| Euclid::Table::Row::Row | ( | std::vector< cell_type > | values, |
| std::shared_ptr< ColumnInfo > | column_info ) |
Constructs a Row with the given cell values and column info descriptor.
The number and type of the cells must match the ones of the columns, otherwise a Elements::Exception is thrown. The column_info cannot be the nullptr and the values of the cells cannot be the empty string or contain any whitespace characters (if they are of type std::string).
| values | The values of the row cells |
| column_info | The information of the columns |
| Elements::Exception | if column_info is null |
| Elements::Exception | if the values vector have different size than the number of columns |
| Elements::Exception | if the values have different types than the columns |
| Elements::Exception | if any of the cell values is the empty string |
| Elements::Exception | if any of the cell values contains whitespace characters |
Definition at line 73 of file Row.cpp.
References std::string::empty(), m_column_info, and m_values.

|
virtualdefault |
Default destructor.
References begin(), end(), getColumnInfo(), operator[](), and size().

| Row::const_iterator Euclid::Table::Row::begin | ( | ) | const |
| Row::const_iterator Euclid::Table::Row::end | ( | ) | const |
| std::shared_ptr< ColumnInfo > Euclid::Table::Row::getColumnInfo | ( | ) | const |
Returns a ColumnInfo object describing the columns of the Row.
Definition at line 107 of file Row.cpp.
References m_column_info.
Referenced by ~Row().
| const Row::cell_type & Euclid::Table::Row::operator[] | ( | const size_t | index | ) | const |
Returns the value of the column with the given index (zero based).
| index | The index of the column (zero based) |
| Elements::Exception | if the index is out of range |
Definition at line 115 of file Row.cpp.
References m_values.
Referenced by ~Row().
| const Row::cell_type & Euclid::Table::Row::operator[] | ( | const std::string & | column | ) | const |
Returns the value of the row for the given column.
| column | The name of the column |
| Elements::Exception | if there is no column with such name |
Definition at line 122 of file Row.cpp.
References m_column_info, and m_values.
| size_t Euclid::Table::Row::size | ( | ) | const |
|
private |
Definition at line 151 of file Row.h.
Referenced by getColumnInfo(), operator[](), and Row().
|
private |
Definition at line 150 of file Row.h.
Referenced by begin(), end(), operator[](), operator[](), Row(), and size().