- Implemented ::isOperator.
This commit is contained in:
Paul Beckingham 2014-10-31 19:22:34 -04:00
parent 6784c8d108
commit 131b08f191
2 changed files with 20 additions and 1 deletions

View file

@ -492,7 +492,8 @@ void CLI::addArg (const std::string& arg)
isID (arg) || // <id>
isPattern (arg) || // /<pattern</
isSubstitution (arg) || // /<from>/<to>/[g]
isAttribute (arg)) // <name>[.[~]<modfifier>]:<value>
isAttribute (arg) || // <name>[.[~]<modfifier>]:<value>
isOperator (arg)) // <operator>
{
_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 <std::multimap <std::string, std::string>::const_iterator, std::multimap <std::string, std::string>::const_iterator> c;
c = _entities.equal_range ("operator");
// Walk the list of entities for category.
std::vector <std::string> options;
std::multimap <std::string, std::string>::const_iterator e;
for (e = c.first; e != c.second; ++e)
if (raw == e->second)
return true;
return false;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -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 <std::string, std::string> _entities;