65 bPrintErrorMessages = bPrintErrorMessages_;
93 getline(inconffile, temp);
95 while( !inconffile.eof() )
98 if(temp.substr(0,1) !=
"#")
101 if(temp.substr(0,1) ==
"[")
104 tmpPos = temp.find(
"]");
105 if (tmpPos != string::npos)
107 data.section = temp.substr(1, tmpPos-1);
109 getline(inconffile, temp);
111 while( (temp.substr(0,1) !=
"[") &&
112 (!inconffile.eof()) )
114 if(temp.substr(0,1) !=
"#")
116 if(temp.find(
":") != string::npos)
118 istringstream inputString(temp);
119 inputString >> data.parameter >> data.value;
121 while(inputString >> tmp_value)
123 data.value.append(
" ");
124 data.value.append(tmp_value);
127 tmpPos = data.parameter.find(
":");
128 if (tmpPos != string::npos)
130 data.parameter = data.parameter.substr(0, tmpPos);
133 inputString >> data.value;
135 while(inputString >> tmp_value)
137 data.value.append(
" ");
138 data.value.append(tmp_value);
143 conf.push_back(data);
147 getline(inconffile, temp);
152 getline(inconffile, temp);
158 if(temp.substr(0,1) !=
"[") {
159 getline(inconffile, temp);
165 if (bPrintErrorMessages)
167 cerr <<
"Config::read_conf: invalid input ifstream " << endl;
184 for(Conf_data::iterator iter = conf.begin(); iter != conf.end(); ++iter)
186 if (tmpSection != iter->section)
189 tmpSection = iter->section;
190 cout <<
"\n[" << tmpSection <<
"]" << endl;
191 cout << iter->parameter+
":" <<
" " << iter->value << endl;
194 cout << iter->parameter+
":" <<
" " << iter->value << endl;
204 for(Conf_data::const_iterator iter = conf.begin(); iter != conf.end(); ++iter)
205 if(iter->section == section)
216 for(Conf_data::const_iterator iter = conf.begin(); iter != conf.end(); ++iter)
217 if( (iter->section == section) && (iter->parameter == parameter) )
223 const int space_between_column)
233 outconffile <<
"# ---------------------------------------------------" << endl;
234 outconffile <<
"# " << file_title << endl;
235 outconffile <<
"# ---------------------------------------------------" << endl;
240 for(Conf_data::iterator iterConf = conf.begin(); iterConf != conf.end(); ++iterConf)
242 if(section != iterConf->section)
244 section = iterConf->section;
245 outconffile <<
"\n[" << section <<
"]\n" << endl;
247 outconffile << setw(space_between_column-iterConf->parameter.size())
248 << iterConf->parameter +
":" <<
" " << iterConf->value << endl;
254 if (bPrintErrorMessages)
256 cerr <<
"Config::write_conf: invalid input ofstream " << endl;