summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/Uuid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/framing/Uuid.cpp')
-rw-r--r--cpp/src/qpid/framing/Uuid.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/cpp/src/qpid/framing/Uuid.cpp b/cpp/src/qpid/framing/Uuid.cpp
index b3d1e2e1e4..e377c1172d 100644
--- a/cpp/src/qpid/framing/Uuid.cpp
+++ b/cpp/src/qpid/framing/Uuid.cpp
@@ -43,6 +43,13 @@ Uuid::Uuid(const uint8_t* data) {
assign(data);
}
+Uuid::Uuid(const std::string& s) {
+ if (s.size() != UNPARSED_SIZE)
+ throw IllegalArgumentException(QPID_MSG("Invalid UUID: " << s));
+ if (uuid_parse(const_cast<char *>(&s[0]), c_array()) != 0)
+ throw IllegalArgumentException(QPID_MSG("Invalid UUID: " << s));
+}
+
void Uuid::assign(const uint8_t* data) {
// This const cast is for Solaris which has a
// uuid_copy that takes a non const 2nd argument