[Positioner] Add CSVStringReader(string)

Add a string constructor for CSVStringReader, for easier use outside of
CSVFileReader.
This commit is contained in:
Matteo Cypriani 2013-05-17 14:19:06 -04:00
parent 2e323be423
commit 9ef599b42f
2 changed files with 10 additions and 4 deletions

View File

@ -52,6 +52,13 @@ using namespace boost ;
/* *** Constructors *** */
CSVStringReader::
CSVStringReader(const std::string &_str, const char _separator):
separator(_separator), current_token(NULL), current_field_nb(0)
{
set_str(_str) ;
}
CSVStringReader::~CSVStringReader()
{
delete current_token ;
@ -63,10 +70,7 @@ CSVStringReader::~CSVStringReader()
/**
* Note that this function is not called by the constructor, so you
* must manually call it to set a string to process prior to use
* read_field().
* @return \em false in case of error (EOF, etc.), \em true else.
* @returns \em false in case of error (EOF, etc.), \em true else.
*/
void CSVStringReader::set_str(const string &_str)
{

View File

@ -68,6 +68,8 @@ public:
CSVStringReader(const char _separator = ';'):
separator(_separator), current_token(NULL), current_field_nb(0) {}
CSVStringReader(const std::string &_str, const char _separator = ';') ;
virtual ~CSVStringReader(void) ;
/** @name Accessors */