Remove findArg
This commit is contained in:
parent
23346e1a8e
commit
a3e9174476
|
@ -354,33 +354,6 @@ void ArgumentParser::printHelp(ostream &os) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Returns the first argument definition which matches the predicate.
|
|
||||||
*
|
|
||||||
* The search includes all assigned main argument definitions and their sub arguments.
|
|
||||||
*/
|
|
||||||
Argument *ArgumentParser::findArg(const ArgumentPredicate &predicate) const
|
|
||||||
{
|
|
||||||
return findArg(m_mainArgs, predicate);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Returns the first argument definition which matches the predicate.
|
|
||||||
*
|
|
||||||
* The search includes all provided \a arguments and their sub arguments.
|
|
||||||
*/
|
|
||||||
Argument *ArgumentParser::findArg(const ArgumentVector &arguments, const ArgumentPredicate &predicate)
|
|
||||||
{
|
|
||||||
for(Argument *arg : arguments) {
|
|
||||||
if(predicate(arg)) {
|
|
||||||
return arg; // argument matches
|
|
||||||
} else if(Argument *subarg = findArg(arg->subArguments(), predicate)) {
|
|
||||||
return subarg; // a secondary argument matches
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr; // no argument matches
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Parses the specified command line arguments.
|
* \brief Parses the specified command line arguments.
|
||||||
* \remarks
|
* \remarks
|
||||||
|
|
|
@ -208,8 +208,6 @@ public:
|
||||||
void setMainArguments(const ArgumentInitializerList &mainArguments);
|
void setMainArguments(const ArgumentInitializerList &mainArguments);
|
||||||
void addMainArgument(Argument *argument);
|
void addMainArgument(Argument *argument);
|
||||||
void printHelp(std::ostream &os) const;
|
void printHelp(std::ostream &os) const;
|
||||||
Argument *findArg(const ArgumentPredicate &predicate) const;
|
|
||||||
static Argument *findArg(const ArgumentVector &arguments, const ArgumentPredicate &predicate);
|
|
||||||
void parseArgs(int argc, const char *const *argv);
|
void parseArgs(int argc, const char *const *argv);
|
||||||
unsigned int actualArgumentCount() const;
|
unsigned int actualArgumentCount() const;
|
||||||
const char *executable() const;
|
const char *executable() const;
|
||||||
|
|
Loading…
Reference in New Issue