Logo
Reference manual - version ored_version
Public Member Functions | List of all members
CSVReader Class Reference
+ Inheritance diagram for CSVReader:

Public Member Functions

 CSVReader (const bool firstLineContainsHeaders, const std::string &delimiters=",;\t", const std::string &escapeCharacters="\\", const std::string &quoteCharacters="\"", const char eolMarker='\n')
 
void setStream (std::istream *stream)
 
const std::vector< std::string > & fields () const
 
const bool hasField (const std::string &field) const
 
Size numberOfColumns () const
 
bool next ()
 
Size currentLine () const
 
std::string get (const std::string &field) const
 
std::string get (const Size column) const
 
virtual void close ()
 

Constructor & Destructor Documentation

◆ CSVReader()

CSVReader ( const bool  firstLineContainsHeaders,
const std::string &  delimiters = ",;\t",
const std::string &  escapeCharacters = "\\",
const std::string &  quoteCharacters = "\"",
const char  eolMarker = '\n' 
)

Ctor

Member Function Documentation

◆ setStream()

void setStream ( std::istream *  stream)

Set stream for function

◆ fields()

const std::vector<std::string>& fields ( ) const

Returns the fields, if a header line is present, otherwise throws

◆ hasField()

const bool hasField ( const std::string &  field) const

Return true if a field is present

◆ numberOfColumns()

Size numberOfColumns ( ) const

Returns the number of columns

◆ next()

bool next ( )

Go to next line in file, returns false if there are no more lines

◆ currentLine()

Size currentLine ( ) const

Number of the current data line

◆ get() [1/2]

std::string get ( const std::string &  field) const

Get content of field in current data line, throws if field is not present

◆ get() [2/2]

std::string get ( const Size  column) const

Get content of column in current data line, throws if column is out of range

◆ close()

virtual void close ( )
virtual

Close the file

Reimplemented in CSVFileReader.