rapidcsv::Document
#include <rapidcsv.h>
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()) | |
Document (std::istream &pStream, const LabelParams &pLabelParams=LabelParams(), const SeparatorParams &pSeparatorParams=SeparatorParams(), const ConverterParams &pConverterParams=ConverterParams(), const LineReaderParams &pLineReaderParams=LineReaderParams()) | |
void | Clear () |
template<typename T > | |
T | GetCell (const size_t pColumnIdx, const size_t pRowIdx) const |
template<typename T > | |
T | GetCell (const size_t pColumnIdx, const size_t pRowIdx, ConvFunc< T > pToVal) const |
template<typename T > | |
T | GetCell (const size_t pColumnIdx, const std::string &pRowName) const |
template<typename T > | |
T | GetCell (const size_t pColumnIdx, const std::string &pRowName, ConvFunc< T > pToVal) const |
template<typename T > | |
T | GetCell (const std::string &pColumnName, const size_t pRowIdx) const |
template<typename T > | |
T | GetCell (const std::string &pColumnName, const size_t pRowIdx, ConvFunc< T > pToVal) const |
template<typename T > | |
T | GetCell (const std::string &pColumnName, const std::string &pRowName) const |
template<typename T > | |
T | GetCell (const std::string &pColumnName, const std::string &pRowName, ConvFunc< T > pToVal) const |
template<typename T > | |
std::vector< T > | GetColumn (const size_t pColumnIdx) const |
template<typename T > | |
std::vector< T > | GetColumn (const size_t pColumnIdx, ConvFunc< T > pToVal) const |
template<typename T > | |
std::vector< T > | GetColumn (const std::string &pColumnName) const |
template<typename T > | |
std::vector< T > | GetColumn (const std::string &pColumnName, ConvFunc< T > pToVal) const |
size_t | GetColumnCount () const |
ssize_t | GetColumnIdx (const std::string &pColumnName) const |
std::string | GetColumnName (const ssize_t pColumnIdx) |
std::vector< std::string > | GetColumnNames () |
template<typename T > | |
std::vector< T > | GetRow (const size_t pRowIdx) const |
template<typename T > | |
std::vector< T > | GetRow (const size_t pRowIdx, ConvFunc< T > pToVal) const |
template<typename T > | |
std::vector< T > | GetRow (const std::string &pRowName) const |
template<typename T > | |
std::vector< T > | GetRow (const std::string &pRowName, ConvFunc< T > pToVal) const |
size_t | GetRowCount () const |
ssize_t | GetRowIdx (const std::string &pRowName) const |
std::string | GetRowName (const ssize_t pRowIdx) |
std::vector< std::string > | GetRowNames () |
template<typename T > | |
void | InsertColumn (const size_t pColumnIdx, const std::vector< T > &pColumn=std::vector< T >(), const std::string &pColumnName=std::string()) |
template<typename T > | |
void | InsertRow (const size_t pRowIdx, const std::vector< T > &pRow=std::vector< T >(), const std::string &pRowName=std::string()) |
void | Load (const std::string &pPath, const LabelParams &pLabelParams=LabelParams(), const SeparatorParams &pSeparatorParams=SeparatorParams(), const ConverterParams &pConverterParams=ConverterParams(), const LineReaderParams &pLineReaderParams=LineReaderParams()) |
void | Load (std::istream &pStream, const LabelParams &pLabelParams=LabelParams(), const SeparatorParams &pSeparatorParams=SeparatorParams(), const ConverterParams &pConverterParams=ConverterParams(), const LineReaderParams &pLineReaderParams=LineReaderParams()) |
void | RemoveColumn (const size_t pColumnIdx) |
void | RemoveColumn (const std::string &pColumnName) |
void | RemoveRow (const size_t pRowIdx) |
void | RemoveRow (const std::string &pRowName) |
void | Save (const std::string &pPath=std::string()) |
void | Save (std::ostream &pStream) |
template<typename T > | |
void | SetCell (const size_t pColumnIdx, const size_t pRowIdx, const T &pCell) |
template<typename T > | |
void | SetCell (const std::string &pColumnName, const std::string &pRowName, const T &pCell) |
template<typename T > | |
void | SetColumn (const size_t pColumnIdx, const std::vector< T > &pColumn) |
template<typename T > | |
void | SetColumn (const std::string &pColumnName, const std::vector< T > &pColumn) |
void | SetColumnName (size_t pColumnIdx, const std::string &pColumnName) |
template<typename T > | |
void | SetRow (const size_t pRowIdx, const std::vector< T > &pRow) |
template<typename T > | |
void | SetRow (const std::string &pRowName, const std::vector< T > &pRow) |
void | SetRowName (size_t pRowIdx, const std::string &pRowName) |
Detailed Description
Class representing a CSV document.
Definition at line 382 of file rapidcsv.h.
Constructor & Destructor Documentation
◆ Document() [1/2]
|
inlineexplicit |
Constructor.
- Parameters
-
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 395 of file rapidcsv.h.
◆ Document() [2/2]
|
inlineexplicit |
Constructor.
- Parameters
-
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 418 of file rapidcsv.h.
Member Function Documentation
◆ Clear()
|
inline |
Clears loaded Document data.
Definition at line 499 of file rapidcsv.h.
◆ GetCell() [1/8]
|
inline |
Get cell by index.
- Parameters
-
pColumnIdx zero-based column index. pRowIdx zero-based row index.
- Returns
- cell data.
Definition at line 991 of file rapidcsv.h.
◆ GetCell() [2/8]
|
inline |
Get cell by index.
- Parameters
-
pColumnIdx zero-based column index. pRowIdx zero-based row index. pToVal conversion function.
- Returns
- cell data.
Definition at line 1010 of file rapidcsv.h.
◆ GetCell() [3/8]
|
inline |
Get cell by column index and row name.
- Parameters
-
pColumnIdx zero-based column index. pRowName row label name.
- Returns
- cell data.
Definition at line 1115 of file rapidcsv.h.
◆ GetCell() [4/8]
|
inline |
Get cell by column index and row name.
- Parameters
-
pColumnIdx zero-based column index. pRowName row label name. pToVal conversion function.
- Returns
- cell data.
Definition at line 1134 of file rapidcsv.h.
◆ GetCell() [5/8]
|
inline |
Get cell by column name and row index.
- Parameters
-
pColumnName column label name. pRowIdx zero-based row index.
- Returns
- cell data.
Definition at line 1077 of file rapidcsv.h.
◆ GetCell() [6/8]
|
inline |
Get cell by column name and row index.
- Parameters
-
pColumnName column label name. pRowIdx zero-based row index. pToVal conversion function.
- Returns
- cell data.
Definition at line 1096 of file rapidcsv.h.
◆ GetCell() [7/8]
|
inline |
Get cell by name.
- Parameters
-
pColumnName column label name. pRowName row label name.
- Returns
- cell data.
Definition at line 1027 of file rapidcsv.h.
◆ GetCell() [8/8]
|
inline |
Get cell by name.
- Parameters
-
pColumnName column label name. pRowName row label name. pToVal conversion function.
- Returns
- cell data.
Definition at line 1052 of file rapidcsv.h.
◆ GetColumn() [1/4]
|
inline |
Get column by index.
- Parameters
-
pColumnIdx zero-based column index.
- Returns
- vector of column data.
Definition at line 533 of file rapidcsv.h.
◆ GetColumn() [2/4]
|
inline |
Get column by index.
- Parameters
-
pColumnIdx zero-based column index. pToVal conversion function.
- Returns
- vector of column data.
Definition at line 557 of file rapidcsv.h.
◆ GetColumn() [3/4]
|
inline |
Get column by name.
- Parameters
-
pColumnName column label name.
- Returns
- vector of column data.
Definition at line 579 of file rapidcsv.h.
◆ GetColumn() [4/4]
|
inline |
Get column by name.
- Parameters
-
pColumnName column label name. pToVal conversion function.
- Returns
- vector of column data.
Definition at line 596 of file rapidcsv.h.
◆ GetColumnCount()
|
inline |
Get number of data columns (excluding label columns).
- Returns
- column count.
Definition at line 745 of file rapidcsv.h.
◆ GetColumnIdx()
|
inline |
Get column index by name.
- Parameters
-
pColumnName column label name.
- Returns
- zero-based column index.
Definition at line 515 of file rapidcsv.h.
◆ GetColumnName()
|
inline |
Get column name.
- Parameters
-
pColumnIdx zero-based column index.
- Returns
- column name.
Definition at line 1209 of file rapidcsv.h.
◆ GetColumnNames()
|
inline |
◆ GetRow() [1/4]
|
inline |
Get row by index.
- Parameters
-
pRowIdx zero-based row index.
- Returns
- vector of row data.
Definition at line 776 of file rapidcsv.h.
◆ GetRow() [2/4]
|
inline |
Get row by index.
- Parameters
-
pRowIdx zero-based row index. pToVal conversion function.
- Returns
- vector of row data.
Definition at line 801 of file rapidcsv.h.
◆ GetRow() [3/4]
|
inline |
Get row by name.
- Parameters
-
pRowName row label name.
- Returns
- vector of row data.
Definition at line 825 of file rapidcsv.h.
◆ GetRow() [4/4]
|
inline |
Get row by name.
- Parameters
-
pRowName row label name. pToVal conversion function.
- Returns
- vector of row data.
Definition at line 842 of file rapidcsv.h.
◆ GetRowCount()
|
inline |
Get number of data rows (excluding label rows).
- Returns
- row count.
Definition at line 977 of file rapidcsv.h.
◆ GetRowIdx()
|
inline |
Get row index by name.
- Parameters
-
pRowName row label name.
- Returns
- zero-based row index.
Definition at line 758 of file rapidcsv.h.
◆ GetRowName()
|
inline |
Get row name.
- Parameters
-
pRowIdx zero-based column index.
- Returns
- row name.
Definition at line 1273 of file rapidcsv.h.
◆ GetRowNames()
|
inline |
◆ InsertColumn()
|
inline |
Insert column at specified index.
- Parameters
-
pColumnIdx zero-based column index. pColumn vector of column data (optional argument). pColumnName column label name (optional argument).
Definition at line 694 of file rapidcsv.h.
◆ InsertRow()
|
inline |
Insert row at specified index.
- Parameters
-
pRowIdx zero-based row index. pRow vector of row data (optional argument). pRowName row label name (optional argument).
Definition at line 935 of file rapidcsv.h.
◆ Load() [1/2]
|
inline |
Read Document data from file.
- Parameters
-
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 439 of file rapidcsv.h.
◆ Load() [2/2]
|
inline |
Read Document data from stream.
- Parameters
-
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 461 of file rapidcsv.h.
◆ RemoveColumn() [1/2]
|
inline |
Remove column by index.
- Parameters
-
pColumnIdx zero-based column index.
Definition at line 663 of file rapidcsv.h.
◆ RemoveColumn() [2/2]
|
inline |
Remove column by name.
- Parameters
-
pColumnName column label name.
Definition at line 676 of file rapidcsv.h.
◆ RemoveRow() [1/2]
|
inline |
Remove row by index.
- Parameters
-
pRowIdx zero-based row index.
Definition at line 907 of file rapidcsv.h.
◆ RemoveRow() [2/2]
|
inline |
◆ Save() [1/2]
|
inline |
Write Document data to file.
- Parameters
-
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 480 of file rapidcsv.h.
◆ Save() [2/2]
|
inline |
Write Document data to stream.
- Parameters
-
pStream specifies an output stream to write the data to.
Definition at line 493 of file rapidcsv.h.
◆ SetCell() [1/2]
|
inline |
Set cell by index.
- Parameters
-
pRowIdx zero-based row index. pColumnIdx zero-based column index. pCell cell data.
Definition at line 1153 of file rapidcsv.h.
◆ SetCell() [2/2]
|
inline |
Set cell by name.
- Parameters
-
pColumnName column label name. pRowName row label name. pCell cell data.
Definition at line 1186 of file rapidcsv.h.
◆ SetColumn() [1/2]
|
inline |
Set column by index.
- Parameters
-
pColumnIdx zero-based column index. pColumn vector of column data.
Definition at line 612 of file rapidcsv.h.
◆ SetColumn() [2/2]
|
inline |
Set column by name.
- Parameters
-
pColumnName column label name. pColumn vector of column data.
Definition at line 649 of file rapidcsv.h.
◆ SetColumnName()
|
inline |
Set column name.
- Parameters
-
pColumnIdx zero-based column index. pColumnName column name.
Definition at line 1226 of file rapidcsv.h.
◆ SetRow() [1/2]
|
inline |
Set row by index.
- Parameters
-
pRowIdx zero-based row index. pRow vector of row data.
Definition at line 858 of file rapidcsv.h.
◆ SetRow() [2/2]
|
inline |
Set row by name.
- Parameters
-
pRowName row label name. pRow vector of row data.
Definition at line 893 of file rapidcsv.h.
◆ SetRowName()
|
inline |
Set row name.
- Parameters
-
pRowIdx zero-based row index. pRowName row name.
Definition at line 1290 of file rapidcsv.h.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:15:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.