blob: e1f044a584e8b01e0dde1c81dd8d26496f89c841 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <erebos/uuid.h>
#include <stdexcept>
using namespace erebos;
using std::runtime_error;
using std::string;
UUID::UUID(string str)
{
if (uuid_parse(str.c_str(), uuid) != 0)
throw runtime_error("invalid UUID");
}
UUID::operator string() const
{
string str(UUID_STR_LEN - 1, '\0');
uuid_unparse_lower(uuid, str.data());
return str;
}
bool UUID::operator==(const UUID & other) const
{
return std::equal(std::begin(uuid), std::end(uuid), std::begin(other.uuid));
}
bool UUID::operator!=(const UUID & other) const
{
return !(*this == other);
}
|