Adapted it for the poor stdc++ support of g++
This commit is contained in:
parent
737779f235
commit
f290f94301
2 changed files with 10 additions and 8 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
#pragma warning(disable:4786)
|
#pragma warning(disable:4786)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
@ -57,7 +58,7 @@ void eoParser::doRegisterParam(eoParam& param) const
|
||||||
{
|
{
|
||||||
if (param.required() && !isItThere(param))
|
if (param.required() && !isItThere(param))
|
||||||
{
|
{
|
||||||
throw runtime_error("required parameter missing");
|
throw std::runtime_error("required parameter missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
pair<bool, string> value = getValue(param);
|
pair<bool, string> value = getValue(param);
|
||||||
|
|
@ -182,8 +183,9 @@ void eoParser::printOn(ostream& os) const
|
||||||
eoParam* param = p->second;
|
eoParam* param = p->second;
|
||||||
|
|
||||||
string str = "--" + param->longName() + "=" + param->getValue();
|
string str = "--" + param->longName() + "=" + param->getValue();
|
||||||
|
|
||||||
os << left << setw(40) << str;
|
//os.setf(ios_base::left, ios_base::adjustfield);
|
||||||
|
os << setw(40) << str;
|
||||||
os << " # " << '-' << param->shortName() << " : " << param->description();
|
os << " # " << '-' << param->shortName() << " : " << param->description();
|
||||||
|
|
||||||
if (param->required())
|
if (param->required())
|
||||||
|
|
|
||||||
|
|
@ -52,18 +52,18 @@ void eoState::registerObject(eoPersistent& registrant)
|
||||||
void eoState::load(const string& _filename)
|
void eoState::load(const string& _filename)
|
||||||
{
|
{
|
||||||
ifstream is (_filename.c_str());
|
ifstream is (_filename.c_str());
|
||||||
|
|
||||||
if (is.fail())
|
|
||||||
{
|
|
||||||
string str = "Could not open file " + _filename;
|
|
||||||
throw runtime_error(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
string str;
|
string str;
|
||||||
string name;
|
string name;
|
||||||
|
|
||||||
getline(is, str);
|
getline(is, str);
|
||||||
|
|
||||||
|
if (is.fail())
|
||||||
|
{
|
||||||
|
string str = "Could not open file " + _filename;
|
||||||
|
throw runtime_error(str);
|
||||||
|
}
|
||||||
|
|
||||||
while(is)
|
while(is)
|
||||||
{ // parse section header
|
{ // parse section header
|
||||||
if (is_section(str, name))
|
if (is_section(str, name))
|
||||||
|
|
|
||||||
Reference in a new issue