Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
CSVFileReader Class Reference

#include <ored/utilities/csvfilereader.hpp>

+ Inheritance diagram for CSVFileReader:
+ Collaboration diagram for CSVFileReader:

Public Member Functions

 CSVFileReader (const std::string &fileName, const bool firstLineContainsHeaders, const std::string &delimiters=",;\t", const std::string &escapeCharacters="\\", const std::string &quoteCharacters="\"", const char eolMarker='\n')
 
void close () override
 
- Public Member Functions inherited from CSVReader
 CSVReader (const bool firstLineContainsHeaders, const std::string &delimiters=",;\t", const std::string &escapeCharacters="\\", const std::string &quoteCharacters="\"", const char eolMarker='\n')
 
virtual ~CSVReader ()
 
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 ()
 

Private Attributes

const std::string fileName_
 
std::ifstream * file_
 

Detailed Description

Definition at line 76 of file csvfilereader.hpp.

Constructor & Destructor Documentation

◆ CSVFileReader()

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

Ctor

Definition at line 118 of file csvfilereader.cpp.

121 : CSVReader(firstLineContainsHeaders, delimiters, escapeCharacters, quoteCharacters,
122 eolMarker),
123 fileName_(fileName) {
124
125 // set file name
126 file_ = new std::ifstream(fileName);
127
128 // pass stream to function set stream
130
131}
const std::string fileName_
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)
+ Here is the call graph for this function:

Member Function Documentation

◆ close()

void close ( )
overridevirtual

Close the file

Reimplemented from CSVReader.

Definition at line 133 of file csvfilereader.cpp.

133{ file_->close(); }

Member Data Documentation

◆ fileName_

const std::string fileName_
private

Definition at line 86 of file csvfilereader.hpp.

◆ file_

std::ifstream* file_
private

Definition at line 87 of file csvfilereader.hpp.