diff --git a/src/CLI.cpp b/src/CLI.cpp index 2b558e6e4..1c5e71ccc 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -105,6 +105,29 @@ void CLI::aliasExpansion () dump ("CLI::aliasExpansion"); } +//////////////////////////////////////////////////////////////////////////////// +// Search for exact 'value' in _entities category. +bool CLI::exactMatch ( + const std::string& category, + const std::string& value) const +{ + // Find the category. + std::pair ::const_iterator, std::multimap ::const_iterator> c; + c = _entities.equal_range (category); + + // Extract a list of entities for category. + std::vector options; + std::multimap ::const_iterator e; + for (e = c.first; e != c.second; ++e) + { + // Shortcut: if an exact match is found, success. + if (value == e->second) + return true; + } + + return false; +} + //////////////////////////////////////////////////////////////////////////////// void CLI::dump (const std::string& label) const {