Hopsan
CSVParserNG Class Reference

The CSV file parser utility. More...

#include <CSVParser.h>

Public Member Functions

 CSVParserNG (const char separator_char=',', size_t linesToSkip=0)
 
bool openText (HString text)
 
bool openFile (const HString &rFilepath)
 
bool takeOwnershipOfFile (FILE *pFile)
 
void closeFile ()
 
void setCommentChar (char commentChar)
 
void setLinesToSkip (size_t linesToSkip)
 
void setFieldSeparator (const char sep)
 
char autoSetFieldSeparator (std::vector< char > &rAlternatives)
 
void indexFile ()
 
size_t getNumDataRows () const
 
size_t getNumDataCols (const size_t row=0) const
 
void getMinMaxNumCols (size_t &rMin, size_t &rMax) const
 
bool allRowsHaveSameNumCols () const
 
HString getErrorString () const
 
bool copyRow (const size_t rowIdx, std::vector< double > &rRow)
 
bool copyRow (const size_t rowIdx, std::vector< long int > &rRow)
 
bool copyColumn (const size_t columnIdx, std::vector< double > &rColumn)
 
bool copyRangeFromColumn (const size_t columnIdx, const size_t startRow, const size_t numRows, std::vector< double > &rColumn)
 
bool copyEveryNthFromColumn (const size_t columnIdx, const size_t stepSize, std::vector< double > &rColumn)
 
bool copyEveryNthFromColumnRange (const size_t columnIdx, const size_t startRow, const size_t numRows, const size_t stepSize, std::vector< double > &rColumn)
 

Protected Attributes

indcsvp::IndexingCSVParser * mpCsvParser
 
HString mErrorString
 
bool mConvertDecimalSeparator
 

Detailed Description

The CSV file parser utility.

Member Function Documentation

◆ copyRangeFromColumn()

bool copyRangeFromColumn ( const size_t columnIdx,
const size_t startRow,
const size_t numRows,
std::vector< double > & rColumn )

◆ copyRow()

bool copyRow ( const size_t rowIdx,
std::vector< double > & rRow )