From a3e9174476c56fa87e5a3a7125c5058c8e49ba9d Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 17 Jul 2016 01:27:42 +0200 Subject: [PATCH] Remove findArg --- application/argumentparser.cpp | 27 --------------------------- application/argumentparser.h | 2 -- 2 files changed, 29 deletions(-) diff --git a/application/argumentparser.cpp b/application/argumentparser.cpp index 4649f4b..0fcd8ca 100644 --- a/application/argumentparser.cpp +++ b/application/argumentparser.cpp @@ -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. * \remarks diff --git a/application/argumentparser.h b/application/argumentparser.h index 4f7c928..39b89ae 100644 --- a/application/argumentparser.h +++ b/application/argumentparser.h @@ -208,8 +208,6 @@ public: void setMainArguments(const ArgumentInitializerList &mainArguments); void addMainArgument(Argument *argument); 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); unsigned int actualArgumentCount() const; const char *executable() const;