43 IO(
const string aFilePattern);
48 virtual ~IO(
void) {fAllLines.clear();}
60 void Dump(ostream& out = cout)
const;
66 inline bool IsZombie(
void)
const {
return !fAllLines.size();}
79 bool GetOpt(
const char* aTag,
const char* aKey, vector< T >& aValues)
const;
90 bool GetOpt(
const char* aTag,
const char* aKey, T& aValue)
const;
100 bool GetOpt(
const char* aTag,
const char* aKey,
string& aValue)
const;
108 string GetLineData(
const char* aTag,
const char* aKey)
const;
119 bool GetAllOpt(
const char* aTag,
const char* aKey, vector< T >& aValues);
129 bool GetAllOpt(
const char* aTag,
const char* aKey, T& aValue);
138 string GetNextLineData(
const char* aTag,
const char* aKey);
143 bool ParseFile(
const char* filename);
151 bool IO::GetOpt(
const char* tag,
const char* key, vector< T >& values)
const {
152 string data = GetLineData(tag,key);
154 istringstream in(data.c_str());
159 values.push_back(tmp);
162 return (
bool)values.size();
166 bool IO::GetOpt(
const char* tag,
const char* key, T& value)
const {
167 string data = GetLineData(tag,key);
169 istringstream in(data.c_str());
171 return (!!in)&&data.size();
181 data=GetNextLineData(tag, key);
182 if(!data.compare(
""))
break;
183 istringstream inval(data.c_str());
187 values.push_back(tmp);
192 return (
bool)values.size();
197 string data = GetNextLineData(tag, key);
198 if(data.empty())
return false;
200 istringstream in(data.c_str());
This module offers C++ utility functions.
ostream & operator<<(ostream &out, IO &io)
Definition: IO.cc:66
Parse option files.
Definition: IO.h:19
string fCurtag
current tag
Definition: IO.h:146
bool GetOpt(const char *aTag, const char *aKey, vector< T > &aValues) const
Gets an option vector.
Definition: IO.h:151
bool IsZombie(void) const
Flags the parsing sequence.
Definition: IO.h:66
bool GetAllOpt(const char *aTag, const char *aKey, vector< T > &aValues)
Gets a vector of all options.
Definition: IO.h:175
string fCurkey
current key
Definition: IO.h:145
int fCurline
line counter
Definition: IO.h:144
static const unsigned sLinesize
maximum number of characters in a line
Definition: IO.h:147
vector< pair< string, string > > fAllLines
option lines
Definition: IO.h:142
virtual ~IO(void)
Destructor of the IO class.
Definition: IO.h:48