8 #include "error_code.h"
9 #include "randomness.h"
20 using value_type = uint8_t;
22 static UUID fromString(
const std::string& from) noexcept;
25 template <
typename RandomnessSourceT>
27 std::array<value_type, 16> data{ {0} };
29 from.nextBytes(16,randomness);
30 for (std::size_t i = 0;i < 16;i++) {
31 data[i] = (value_type)randomness.
at(i);
34 constexpr value_type M = 0x40;
35 constexpr value_type N = 0x80;
36 data[6] = (0x0f & data[6]) | M;
37 data[8] = (0x3f & data[8]) | N;
38 UUID uuid(data,
false);
42 UUID(
const char* from) noexcept;
45 ~
UUID() noexcept =
default;
47 UUID& operator=(
const UUID& other) noexcept;
49 bool valid()
const noexcept;
51 bool operator==(
const UUID& other)
const noexcept;
52 bool operator!=(
const UUID& other)
const noexcept;
53 bool operator<(
const UUID& other)
const noexcept;
54 bool operator<=(
const UUID& other)
const noexcept;
55 bool operator>(
const UUID& other)
const noexcept;
56 bool operator>=(
const UUID& other)
const noexcept;
59 std::array<value_type, 16> data()
const noexcept;
60 std::string string()
const noexcept;
63 std::array<value_type, 16> mData = { {0}};
66 UUID(std::array<value_type, 16> data,
bool isValid) noexcept;
The main data workhorse class of the Herald API.
Definition: data.h:33
std::byte at(std::size_t index) const
Returns the individual byte at index position, or a byte value of zero if index is out of bounds.
Definition: data.h:178
Definition: randomness.h:126
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15