9 IO::IO(
const char* filepattern) : fCurline(0) {
13 cout<<
"------ Reading User Parameters : "<<filepattern<<endl;
18 string err =
"IO::IO : no files verify pattern ";
23 for(
unsigned i=0;
i<files.size();
i++) {
26 cout<<
"------ Reading User Parameters : DONE ---------"<<endl;
32 cout<<
"file : "<<filename<<
"\t\t";
34 ifstream
in(filename);
36 cout<<
"unreadable"<<endl;
50 if(
string(s).
empty()) {
59 if(!strncmp(tag.c_str(),
"//",2))
continue;
63 fAllLines.push_back(pair<string, string>(tag, data));
98 string readkey;
in>>readkey;
110 if(found)
return string(data);
111 else return string();
129 string readkey;
in>>readkey;
139 if(found)
return string(data);
140 else return string();
148 istringstream
in(data.c_str());
155 int pos = value.find_first_not_of(
" \t");
156 value = value.substr(pos);
158 pos = value.find_last_not_of(
" \t");
159 value = value.substr(0,pos+1);
161 if(!value.empty())
return true;
static std::vector< std::string > Glob(const char *pattern)
get all files matching pattern
void Dump(std::ostream &out=std::cout) const
dumps fAllLines
General option file parser.
static const unsigned sLinesize
maximum line size
std::ostream & operator<<(std::ostream &out, const ALILine &li)
std::string GetNextLineData(const char *tag, const char *key)
bool GetOpt(const char *tag, const char *key, std::vector< T > &values) const
reads a vector of T
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, std::string > > fAllLines
all non empty, uncommented lines
std::string fCurtag
current tag
bool ParseFile(const char *filename)
parse one file
std::string fCurkey
current key
std::string GetLineData(const char *tag, const char *key) const
IO(const char *filepattern)
builds IO from files matching filepattern