added a getParam method to the eoParser, that raise an exception if the parameter has not been declared

This commit is contained in:
nojhan 2012-03-15 18:14:04 +01:00
commit 7e7a47c9ba
2 changed files with 15 additions and 0 deletions

View file

@ -129,6 +129,15 @@ eoParam * eoParser::getParamWithLongName(const std::string& _name) const
return 0; return 0;
} }
eoParam * getParam(const std::string& _name) const
{
eoParam * p = getParamWithLongName( _name );
if( p == NULL ) {
throw eoMissingParamException(_name );
} else {
return p;
}
}
void eoParser::processParam(eoParam& param, std::string section) void eoParser::processParam(eoParam& param, std::string section)
{ {

View file

@ -176,6 +176,12 @@ public:
eoParam * getParamWithLongName(const std::string& _name) const; eoParam * getParamWithLongName(const std::string& _name) const;
/**
* Get a handle on a param from its long name
* If not found, raise an eoMissingParamException
*/
eoParam * getParam(const std::string& _name) const;
/** Get or create parameter /** Get or create parameter