added a getParam method to the eoParser, that raise an exception if the parameter has not been declared
This commit is contained in:
parent
af0102a5d7
commit
7e7a47c9ba
2 changed files with 15 additions and 0 deletions
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue