From 131b08f191f5d72aa613c98b5e947491623c6f3f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 31 Oct 2014 19:22:34 -0400 Subject: [PATCH] CLI - Implemented ::isOperator. --- src/CLI.cpp | 20 +++++++++++++++++++- src/CLI.h | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/CLI.cpp b/src/CLI.cpp index 13832459b..43acc9722 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -492,7 +492,8 @@ void CLI::addArg (const std::string& arg) isID (arg) || // isPattern (arg) || // ///[g] - isAttribute (arg)) // [.[~]]: + isAttribute (arg) || // [.[~]]: + isOperator (arg)) // { _original_args.push_back (arg); } @@ -1878,3 +1879,20 @@ bool CLI::isAttribute (const std::string& raw) const } //////////////////////////////////////////////////////////////////////////////// +bool CLI::isOperator (const std::string& raw) const +{ + // Find the category. + std::pair ::const_iterator, std::multimap ::const_iterator> c; + c = _entities.equal_range ("operator"); + + // Walk the list of entities for category. + std::vector options; + std::multimap ::const_iterator e; + for (e = c.first; e != c.second; ++e) + if (raw == e->second) + return true; + + return false; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/CLI.h b/src/CLI.h index a5743f45d..e6df50ff9 100644 --- a/src/CLI.h +++ b/src/CLI.h @@ -109,6 +109,7 @@ private: bool isPattern (const std::string&) const; bool isSubstitution (const std::string&) const; bool isAttribute (const std::string&) const; + bool isOperator (const std::string&) const; public: std::multimap _entities;