diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-21 11:34:44 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-21 11:34:44 (GMT) |
commit | dc5f5ddfa10bf91524e6f7555c263eaea069dcb0 (patch) | |
tree | 576b15e7fe75476e8ece954b52aa88871941beb5 /src/uscxml/UUID.cpp | |
parent | 641117e7400e9e5ef0fa451f732eb9009f0914cb (diff) | |
download | uscxml-dc5f5ddfa10bf91524e6f7555c263eaea069dcb0.zip uscxml-dc5f5ddfa10bf91524e6f7555c263eaea069dcb0.tar.gz uscxml-dc5f5ddfa10bf91524e6f7555c263eaea069dcb0.tar.bz2 |
try / catch blocks for applications and work on dot output
Diffstat (limited to 'src/uscxml/UUID.cpp')
-rw-r--r-- | src/uscxml/UUID.cpp | 36 |
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 |