35 #include "CSV_Reader.h" 36 #include "CSV_Utils.h" 39 CSV_Reader::CSV_Reader()
41 _stream_in =
new fstream() ;
44 CSV_Reader::~CSV_Reader()
48 if( _stream_in->is_open() )
58 CSV_Reader::open(
const string& filepath )
61 _filepath = filepath ;
62 _stream_in->open( filepath.c_str(), fstream::in ) ;
63 if( !(_stream_in->fail()) && _stream_in->is_open() )
71 CSV_Reader::close()
const 77 if( !(_stream_in->bad()) && !(_stream_in->is_open()) )
86 CSV_Reader::eof()
const 88 return _stream_in->eof() ;
94 _stream_in->seekg( ios::beg ) ;
99 CSV_Reader::get( vector<string> &row )
103 getline( *_stream_in, line ) ;
110 strm << BESIndent::LMarg <<
"CSV_Reader::dump - (" 111 << (
void *)
this <<
")" << endl ;
112 BESIndent::Indent() ;
115 strm << BESIndent::LMarg <<
"File " << _filepath <<
" is open" << endl ;
119 strm << BESIndent::LMarg <<
"No stream opened at this time" << endl ;
121 BESIndent::UnIndent() ;
static void split(const string &str, char delimiter, vector< string > &tokens)
Splits a string into separate strings based on the delimiter.
virtual void dump(ostream &strm) const
dump the contents of this object to the specified ostream