12 const char ParsedParameterFile::_ignoreLinesStartingWith[] = {
'*',
'#',
'\0'};
15 ParsedParameterFile::ParsedParameterFile(istream& inputStream)
18 if(inputStream.bad()){
19 cout <<
"ERROR in ParsedParameterFile constructor from inputStream" 20 <<
"\n > status of input stream is bad!" 23 readStream(inputStream);
28 ParsedParameterFile::ParsedParameterFile(
const std::string& fname)
31 std::ifstream is(fname.c_str());
33 cout <<
"ERROR in ParsedParameterFile constructor from filename:" 34 <<
"\n > status of input stream is bad - file might not exist" 35 <<
"\n > or be otherwise corrupt." 36 <<
"\n > The file name you passes was: \"" << fname <<
"\"." 46 : _lines(other._lines)
47 , _statusOK(other._statusOK)
59 if(line.empty())
return true;
69 char line[slmax]={
'\0'};
70 while( is.getline(line, slmax)){
87 for(map<string, ParsedParameterLine>::const_iterator it =
_lines.begin();
90 os <<
" " << i <<
") " << it->second << endl;
virtual const std::string & name() const
static const ParsedParameterLine dummyLine
void readStream(std::istream &is)
ParsedParameterFile(std::istream &inputStream=std::cin)
const Val & keyFinder(const Key &k, const std::map< Key, Val > &m, const Val &dummy, bool &successFlag)
const ParsedParameterLine & find(const std::string &name) const
std::map< std::string, ParsedParameterLine > _lines
std::ostream & operator<<(std::ostream &os, const ParsedParameterFile &ppf)
unsigned int numLines() const
void print(std::ostream &os=std::cout) const
static const char _ignoreLinesStartingWith[]
static bool ignoreThisLine(const std::string &line)