Class representing a CSV document. More...
#include <rapidcsv.hpp>
Public Member Functions | |
| Document (const std::string &pPath=std::string(), const LabelParams &pLabelParams=LabelParams(), const SeparatorParams &pSeparatorParams=SeparatorParams(), const ConverterParams &pConverterParams=ConverterParams(), const LineReaderParams &pLineReaderParams=LineReaderParams()) | |
| Constructor. More... | |
| Document (std::istream &pStream, const LabelParams &pLabelParams=LabelParams(), const SeparatorParams &pSeparatorParams=SeparatorParams(), const ConverterParams &pConverterParams=ConverterParams(), const LineReaderParams &pLineReaderParams=LineReaderParams()) | |
| Constructor. More... | |
| void | Load (const std::string &pPath, const LabelParams &pLabelParams=LabelParams(), const SeparatorParams &pSeparatorParams=SeparatorParams(), const ConverterParams &pConverterParams=ConverterParams(), const LineReaderParams &pLineReaderParams=LineReaderParams()) |
| Read Document data from file. More... | |
| void | Load (std::istream &pStream, const LabelParams &pLabelParams=LabelParams(), const SeparatorParams &pSeparatorParams=SeparatorParams(), const ConverterParams &pConverterParams=ConverterParams(), const LineReaderParams &pLineReaderParams=LineReaderParams()) |
| Read Document data from stream. More... | |
| void | Save (const std::string &pPath=std::string()) |
| Write Document data to file. More... | |
| void | Save (std::ostream &pStream) |
| Write Document data to stream. More... | |
| void | Clear () |
| Clears loaded Document data. More... | |
| ssize_t | GetColumnIdx (const std::string &pColumnName) const |
| Get column index by name. More... | |
| template<typename T > | |
| std::vector< T > | GetColumn (const size_t pColumnIdx) const |
| Get column by index. More... | |
| template<typename T > | |
| std::vector< T > | GetColumn (const size_t pColumnIdx, ConvFunc< T > pToVal) const |
| Get column by index. More... | |
| template<typename T > | |
| std::vector< T > | GetColumn (const std::string &pColumnName) const |
| Get column by name. More... | |
| template<typename T > | |
| std::vector< T > | GetColumn (const std::string &pColumnName, ConvFunc< T > pToVal) const |
| Get column by name. More... | |
| template<typename T > | |
| void | SetColumn (const size_t pColumnIdx, const std::vector< T > &pColumn) |
| Set column by index. More... | |
| template<typename T > | |
| void | SetColumn (const std::string &pColumnName, const std::vector< T > &pColumn) |
| Set column by name. More... | |
| void | RemoveColumn (const size_t pColumnIdx) |
| Remove column by index. More... | |
| void | RemoveColumn (const std::string &pColumnName) |
| Remove column by name. More... | |
| template<typename T > | |
| void | InsertColumn (const size_t pColumnIdx, const std::vector< T > &pColumn=std::vector< T >(), const std::string &pColumnName=std::string()) |
| Insert column at specified index. More... | |
| size_t | GetColumnCount () const |
| Get number of data columns (excluding label columns). More... | |
| ssize_t | GetRowIdx (const std::string &pRowName) const |
| Get row index by name. More... | |
| template<typename T > | |
| std::vector< T > | GetRow (const size_t pRowIdx) const |
| Get row by index. More... | |
| template<typename T > | |
| std::vector< T > | GetRow (const size_t pRowIdx, ConvFunc< T > pToVal) const |
| Get row by index. More... | |
| template<typename T > | |
| std::vector< T > | GetRow (const std::string &pRowName) const |
| Get row by name. More... | |
| template<typename T > | |
| std::vector< T > | GetRow (const std::string &pRowName, ConvFunc< T > pToVal) const |
| Get row by name. More... | |
| template<typename T > | |
| void | SetRow (const size_t pRowIdx, const std::vector< T > &pRow) |
| Set row by index. More... | |
| template<typename T > | |
| void | SetRow (const std::string &pRowName, const std::vector< T > &pRow) |
| Set row by name. More... | |
| void | RemoveRow (const size_t pRowIdx) |
| Remove row by index. More... | |
| void | RemoveRow (const std::string &pRowName) |
| Remove row by name. More... | |
| template<typename T > | |
| void | InsertRow (const size_t pRowIdx, const std::vector< T > &pRow=std::vector< T >(), const std::string &pRowName=std::string()) |
| Insert row at specified index. More... | |
| size_t | GetRowCount () const |
| Get number of data rows (excluding label rows). More... | |
| template<typename T > | |
| T | GetCell (const size_t pColumnIdx, const size_t pRowIdx) const |
| Get cell by index. More... | |
| template<typename T > | |
| T | GetCell (const size_t pColumnIdx, const size_t pRowIdx, ConvFunc< T > pToVal) const |
| Get cell by index. More... | |
| template<typename T > | |
| T | GetCell (const std::string &pColumnName, const std::string &pRowName) const |
| Get cell by name. More... | |
| template<typename T > | |
| T | GetCell (const std::string &pColumnName, const std::string &pRowName, ConvFunc< T > pToVal) const |
| Get cell by name. More... | |
| template<typename T > | |
| T | GetCell (const std::string &pColumnName, const size_t pRowIdx) const |
| Get cell by column name and row index. More... | |
| template<typename T > | |
| T | GetCell (const std::string &pColumnName, const size_t pRowIdx, ConvFunc< T > pToVal) const |
| Get cell by column name and row index. More... | |
| template<typename T > | |
| T | GetCell (const size_t pColumnIdx, const std::string &pRowName) const |
| Get cell by column index and row name. More... | |
| template<typename T > | |
| T | GetCell (const size_t pColumnIdx, const std::string &pRowName, ConvFunc< T > pToVal) const |
| Get cell by column index and row name. More... | |
| template<typename T > | |
| void | SetCell (const size_t pColumnIdx, const size_t pRowIdx, const T &pCell) |
| Set cell by index. More... | |
| template<typename T > | |
| void | SetCell (const std::string &pColumnName, const std::string &pRowName, const T &pCell) |
| Set cell by name. More... | |
| std::string | GetColumnName (const ssize_t pColumnIdx) |
| Get column name. More... | |
| void | SetColumnName (size_t pColumnIdx, const std::string &pColumnName) |
| Set column name. More... | |
| std::vector< std::string > | GetColumnNames () |
| Get column names. More... | |
| std::string | GetRowName (const ssize_t pRowIdx) |
| Get row name. More... | |
| void | SetRowName (size_t pRowIdx, const std::string &pRowName) |
| Set row name. More... | |
| std::vector< std::string > | GetRowNames () |
| Get row names. More... | |
Class representing a CSV document.
Definition at line 400 of file rapidcsv.hpp.
|
inlineexplicit |
Constructor.
| pPath | specifies the path of an existing CSV-file to populate the Document data with. |
| pLabelParams | specifies which row and column should be treated as labels. |
| pSeparatorParams | specifies which field and row separators should be used. |
| pConverterParams | specifies how invalid numbers (including empty strings) should be handled. |
| pLineReaderParams | specifies how special line formats should be treated. |
Definition at line 413 of file rapidcsv.hpp.
|
inlineexplicit |
Constructor.
| pStream | specifies an input stream to read CSV data from. |
| pLabelParams | specifies which row and column should be treated as labels. |
| pSeparatorParams | specifies which field and row separators should be used. |
| pConverterParams | specifies how invalid numbers (including empty strings) should be handled. |
| pLineReaderParams | specifies how special line formats should be treated. |
Definition at line 439 of file rapidcsv.hpp.
|
inline |
Clears loaded Document data.
Definition at line 528 of file rapidcsv.hpp.
|
inline |
Get cell by index.
| pColumnIdx | zero-based column index. |
| pRowIdx | zero-based row index. |
Definition at line 1021 of file rapidcsv.hpp.
|
inline |
Get cell by index.
| pColumnIdx | zero-based column index. |
| pRowIdx | zero-based row index. |
| pToVal | conversion function. |
Definition at line 1040 of file rapidcsv.hpp.
|
inline |
Get cell by column index and row name.
| pColumnIdx | zero-based column index. |
| pRowName | row label name. |
Definition at line 1143 of file rapidcsv.hpp.
|
inline |
Get cell by column index and row name.
| pColumnIdx | zero-based column index. |
| pRowName | row label name. |
| pToVal | conversion function. |
Definition at line 1162 of file rapidcsv.hpp.
|
inline |
Get cell by column name and row index.
| pColumnName | column label name. |
| pRowIdx | zero-based row index. |
Definition at line 1106 of file rapidcsv.hpp.
|
inline |
Get cell by column name and row index.
| pColumnName | column label name. |
| pRowIdx | zero-based row index. |
| pToVal | conversion function. |
Definition at line 1125 of file rapidcsv.hpp.
|
inline |
Get cell by name.
| pColumnName | column label name. |
| pRowName | row label name. |
Definition at line 1057 of file rapidcsv.hpp.
|
inline |
Get cell by name.
| pColumnName | column label name. |
| pRowName | row label name. |
| pToVal | conversion function. |
Definition at line 1082 of file rapidcsv.hpp.
|
inline |
Get column by index.
| pColumnIdx | zero-based column index. |
Definition at line 562 of file rapidcsv.hpp.
|
inline |
Get column by index.
| pColumnIdx | zero-based column index. |
| pToVal | conversion function. |
Definition at line 599 of file rapidcsv.hpp.
|
inline |
Get column by name.
| pColumnName | column label name. |
Definition at line 621 of file rapidcsv.hpp.
|
inline |
Get column by name.
| pColumnName | column label name. |
| pToVal | conversion function. |
Definition at line 638 of file rapidcsv.hpp.
|
inline |
Get number of data columns (excluding label columns).
Definition at line 781 of file rapidcsv.hpp.
|
inline |
Get column index by name.
| pColumnName | column label name. |
Definition at line 544 of file rapidcsv.hpp.
|
inline |
Get column name.
| pColumnIdx | zero-based column index. |
Definition at line 1235 of file rapidcsv.hpp.
|
inline |
|
inline |
Get row by index.
| pRowIdx | zero-based row index. |
Definition at line 811 of file rapidcsv.hpp.
|
inline |
Get row by index.
| pRowIdx | zero-based row index. |
| pToVal | conversion function. |
Definition at line 835 of file rapidcsv.hpp.
|
inline |
Get row by name.
| pRowName | row label name. |
Definition at line 858 of file rapidcsv.hpp.
|
inline |
Get row by name.
| pRowName | row label name. |
| pToVal | conversion function. |
Definition at line 875 of file rapidcsv.hpp.
|
inline |
Get number of data rows (excluding label rows).
Definition at line 1008 of file rapidcsv.hpp.
|
inline |
Get row index by name.
| pRowName | row label name. |
Definition at line 793 of file rapidcsv.hpp.
|
inline |
Get row name.
| pRowIdx | zero-based column index. |
Definition at line 1296 of file rapidcsv.hpp.
|
inline |
|
inline |
Insert column at specified index.
| pColumnIdx | zero-based column index. |
| pColumn | vector of column data (optional argument). |
| pColumnName | column label name (optional argument). |
Definition at line 733 of file rapidcsv.hpp.
|
inline |
Insert row at specified index.
| pRowIdx | zero-based row index. |
| pRow | vector of row data (optional argument). |
| pRowName | row label name (optional argument). |
Definition at line 967 of file rapidcsv.hpp.
|
inline |
Read Document data from file.
| pPath | specifies the path of an existing CSV-file to populate the Document data with. |
| pLabelParams | specifies which row and column should be treated as labels. |
| pSeparatorParams | specifies which field and row separators should be used. |
| pConverterParams | specifies how invalid numbers (including empty strings) should be handled. |
| pLineReaderParams | specifies how special line formats should be treated. |
Definition at line 463 of file rapidcsv.hpp.
|
inline |
Read Document data from stream.
| pStream | specifies an input stream to read CSV data from. |
| pLabelParams | specifies which row and column should be treated as labels. |
| pSeparatorParams | specifies which field and row separators should be used. |
| pConverterParams | specifies how invalid numbers (including empty strings) should be handled. |
| pLineReaderParams | specifies how special line formats should be treated. |
Definition at line 486 of file rapidcsv.hpp.
|
inline |
Remove column by index.
| pColumnIdx | zero-based column index. |
Definition at line 702 of file rapidcsv.hpp.
|
inline |
Remove column by name.
| pColumnName | column label name. |
Definition at line 715 of file rapidcsv.hpp.
|
inline |
Remove row by index.
| pRowIdx | zero-based row index. |
Definition at line 939 of file rapidcsv.hpp.
|
inline |
|
inline |
Write Document data to file.
| pPath | optionally specifies the path where the CSV-file will be created (if not specified, the original path provided when creating or loading the Document data will be used). |
Definition at line 506 of file rapidcsv.hpp.
|
inline |
Write Document data to stream.
| pStream | specifies an output stream to write the data to. |
Definition at line 519 of file rapidcsv.hpp.
|
inline |
Set cell by index.
| pRowIdx | zero-based row index. |
| pColumnIdx | zero-based column index. |
| pCell | cell data. |
Definition at line 1180 of file rapidcsv.hpp.
|
inline |
Set cell by name.
| pColumnName | column label name. |
| pRowName | row label name. |
| pCell | cell data. |
Definition at line 1213 of file rapidcsv.hpp.
|
inline |
Set column by index.
| pColumnIdx | zero-based column index. |
| pColumn | vector of column data. |
Definition at line 654 of file rapidcsv.hpp.
|
inline |
Set column by name.
| pColumnName | column label name. |
| pColumn | vector of column data. |
Definition at line 688 of file rapidcsv.hpp.
|
inline |
Set column name.
| pColumnIdx | zero-based column index. |
| pColumnName | column name. |
Definition at line 1251 of file rapidcsv.hpp.
|
inline |
Set row by index.
| pRowIdx | zero-based row index. |
| pRow | vector of row data. |
Definition at line 891 of file rapidcsv.hpp.
|
inline |
Set row by name.
| pRowName | row label name. |
| pRow | vector of row data. |
Definition at line 925 of file rapidcsv.hpp.
|
inline |
Set row name.
| pRowIdx | zero-based row index. |
| pRowName | row name. |
Definition at line 1312 of file rapidcsv.hpp.