summaryrefslogtreecommitdiff
path: root/include/erebos/uuid.h
blob: e67677a60e013fdec478f605c9aa0d43cb4f4855 (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
#pragma once

#include <array>
#include <optional>
#include <string>

namespace erebos {

struct UUID
{
	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;

	std::array<uint8_t, 16> uuid;
};

}