5#ifndef CONDITIONS_GENERALCSVLOADER_H_
6#define CONDITIONS_GENERALCSVLOADER_H_
31 const std::string&
get(
const std::string& colname,
32 bool ignore_case =
true)
const;
35 int getInteger(
const std::string& colname,
bool ignore_case =
true)
const;
61 const std::string lineseparators =
"\n");
Class which parses a CSV file and provides the rows one at a time to a user The parser ignores any li...
bool nextRow()
Advance to next row if possible.
const std::string & get(const std::string &colname, bool ignore_case=true) const
Get the value for the given column in the current row.
int getInteger(const std::string &colname, bool ignore_case=true) const
Get the value for the given column in the current row as an integer.
virtual std::string getNextLine()=0
Get the next line, returning an empty string when there is no further data.
virtual ~GeneralCSVLoader()
Destructor.
std::vector< std::string > columnNames() const
Get the column names.
std::vector< std::string > rowData_
The row data.
std::vector< std::string > colNames_
The column names.
Specialization of the GeneralCSVLoader for loading from a file/stream.
virtual ~StreamCSVLoader()
Clean-up the stream if we own it.
virtual std::string getNextLine()
Get the next line, returning an empty string when there is no further data.
bool ownStream_
Own stream?
std::string line_
Line buffer.
std::istream * source_
The stream.
Specialization of the GeneralCSVLoader for loading from a string.
const std::string & source_
The original string.
std::string::size_type rowBegin_
The current start and end pointers.
const std::string linesep_
The separators.
virtual std::string getNextLine()
Get the next line, returning an empty string when there is no further data.