|
csv-parser 1.1.0
Csv::Parser (csv-parser)
|
Data inside a single cell, stored as a copy. More...
#include <csv_cell.h>
Public Member Functions | |
| CellValue ()=default | |
| Constructor, creates an Empty value. | |
| template<typename BehaviorPolicy > | |
| CellValue (std::string_view cell, CellTypeHint hint, BehaviorPolicy policy) | |
| Constructor, which stores a copy of the cell data. | |
| CellType | getType () const |
| Get cell type. | |
| bool | isEmpty () const |
| Check whether the cell is of CellType::Empty type. | |
| std::optional< double > | getDouble () const |
| Get the cell value if cell type is Double. | |
| std::optional< std::string > | getString () const |
Get stored cell value as std::string. | |
Data inside a single cell, stored as a copy.
This object always owns its data and does not reference the original CSV text.
| Csv::CellValue::CellValue | ( | std::string_view | cell, |
| CellTypeHint | hint, | ||
| BehaviorPolicy | policy | ||
| ) |
Constructor, which stores a copy of the cell data.
| cell | Cell data to store. |
| hint | Type hint associated with the cell during parsing. |
| policy | Argument used for type inference. |
| BehaviorPolicy | Policy to use for parsing, same as BehaviorPolicy in Parser. |
|
inline |
Get the cell value if cell type is Double.
This succeeds only if cell type is CellType::Double.
std::nullopt on type mismatch.
|
inline |
Get stored cell value as std::string.
This succeeds only if cell type is CellType::String. The string has collapsed consecutive double-quotes inside.
std::nullopt on type mismatch.