diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2020-06-06 14:47:45 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2020-06-06 15:01:19 +0200 |
commit | c00945ec1e5804003fb47798e86cd0c737a14d46 (patch) | |
tree | 06fa802760dcfb041d0ff0eda22cd9a1e661dc49 /include | |
parent | fd04142b2accb08ab3c79bfd5c5bffd25b3f5784 (diff) |
UUID: random generation and format checking functions
Diffstat (limited to 'include')
-rw-r--r-- | include/erebos/uuid.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/erebos/uuid.h b/include/erebos/uuid.h index 9b615f8..e67677a 100644 --- a/include/erebos/uuid.h +++ b/include/erebos/uuid.h @@ -1,15 +1,22 @@ #pragma once #include <array> +#include <optional> #include <string> namespace erebos { struct UUID { - explicit UUID(std::string); + UUID(): uuid({}) {} + explicit UUID(const std::string &); explicit operator std::string() const; + static std::optional<UUID> fromString(const std::string &); + static bool fromString(const std::string &, UUID &); + + static UUID generate(); + bool operator==(const UUID &) const; bool operator!=(const UUID &) const; |