From dd8972525fcdd59535e692ed10e205892660700a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 27 Oct 2014 10:57:41 -0400 Subject: [PATCH] CLI - Implemented ::isUUID helper function. --- src/CLI.cpp | 14 ++++++++++++++ src/CLI.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/CLI.cpp b/src/CLI.cpp index 4c0aef9ca..4c029a23f 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -1624,3 +1624,17 @@ void CLI::decomposeModSubstitutions () } //////////////////////////////////////////////////////////////////////////////// +bool CLI::isUUID (const std::string& raw, std::string& token) const +{ + // UUIDs have a limited character set. + if (raw.find_first_not_of ("0123456789abcdefABCDEF-,") == std::string::npos) + { + Nibbler n (raw); + if (n.getUUID (token) || n.getPartialUUID (token)) + return true; + } + + return false; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/CLI.h b/src/CLI.h index aa1915c9e..1fc28a0d6 100644 --- a/src/CLI.h +++ b/src/CLI.h @@ -97,6 +97,8 @@ private: void decomposeModTags (); void decomposeModSubstitutions (); + bool isUUID (const std::string&, std::string&) const; + public: std::multimap _entities; std::map _aliases;