summaryrefslogtreecommitdiffstats
path: root/src/uscxml/UUID.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/UUID.cpp')
-rw-r--r--src/uscxml/UUID.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/uscxml/UUID.cpp b/src/uscxml/UUID.cpp
index 8647739..b56b727 100644
--- a/src/uscxml/UUID.cpp
+++ b/src/uscxml/UUID.cpp
@@ -31,4 +31,40 @@ std::string UUID::getUUID() {
return os.str();
}
+bool UUID::isUUID(const std::string& uuid) {
+ if (uuid.size() != 36)
+ return false;
+
+ if (uuid[8] != '-' || uuid[13] != '-' || uuid[18] != '-' || uuid[23] != '-')
+ return false;
+
+ for (int i = 0; i < 36; i++) {
+ if (i == 8 || i == 13 || i == 18 || i ==23)
+ continue;
+
+ char c = uuid[i];
+ if (c == 'a' ||
+ c == 'b' ||
+ c == 'c' ||
+ c == 'd' ||
+ c == 'e' ||
+ c == 'f' ||
+ c == '0' ||
+ c == '1' ||
+ c == '2' ||
+ c == '3' ||
+ c == '4' ||
+ c == '5' ||
+ c == '6' ||
+ c == '7' ||
+ c == '8' ||
+ c == '9') {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+}
+
} \ No newline at end of file