Added method
eoParam* getParamWithLongName(std::string _name); so now you can get a parameter in another place than where it was defined just by giving its name
This commit is contained in:
parent
aee6584cea
commit
58f5fd2f61
2 changed files with 31 additions and 1 deletions
|
|
@ -79,6 +79,26 @@ eoParser::eoParser ( unsigned _argc, char **_argv , string _programDescription,
|
|||
processParam(needHelp);
|
||||
}
|
||||
|
||||
/**
|
||||
* get a handle on a param from its longName
|
||||
*
|
||||
* if not found, returns 0 (null pointer :-)
|
||||
*
|
||||
* Not very clean (requires hard-coding of the long name twice!)
|
||||
* but very useful in many occasions...
|
||||
*/
|
||||
eoParam* eoParser::getParamWithLongName(std::string _name)
|
||||
{
|
||||
typedef std::multimap<std::string, eoParam*> MultiMapType;
|
||||
typedef MultiMapType::const_iterator It;
|
||||
for (It p = params.begin(); p != params.end(); ++p)
|
||||
{
|
||||
if (p->second->longName() == _name)
|
||||
return p->second;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void eoParser::processParam(eoParam& param, std::string section)
|
||||
{
|
||||
doRegisterParam(param); // plainly register it
|
||||
|
|
|
|||
Reference in a new issue