xentara-utils v1.2.1
Xentara utilities library
|
A UUID. More...
#include <core/Uuid.hpp>
Public Member Functions | |
constexpr | Uuid ()=default |
Default constructor. Generates a nil UUID. | |
auto | hash () const noexcept -> std::size_t |
Calculates a hash value for the UUID. | |
template<tools::CharType Char, typename CharTraits = std::char_traits<Char>> | |
auto | toBasicString () const -> string::BasicFixedString< Char, kStringSize, CharTraits > |
Converts the UUID to a string. | |
auto | toString () const -> std::string |
Converts the UUID to a string of type char. | |
auto | toWString () const -> std::wstring |
Converts the UUID to a string of type wchar_t. | |
auto | toU8String () const -> std::u8string |
Converts the UUID to a string of type char8_t. | |
auto | toU16String () const -> std::u16string |
Converts the UUID to a string of type char16_t. | |
auto | toU32String () const -> std::u32string |
Converts the UUID to a string of type char32_t. | |
auto | rawData () const -> std::span< const std::byte, kRawDataSize > |
Gets the raw data of the UUID. | |
constexpr auto | operator== (const Uuid &rhs) const -> bool |
Comparison operator. | |
constexpr auto | operator<=> (const Uuid &rhs) const -> std::strong_ordering |
Three-Way-Comparison operator. | |
constexpr auto | isNull () const noexcept -> bool |
Determines if the UUID is 00000000-0000-0000-0000-000000000000 | |
Static Public Member Functions | |
template<tools::StringViewable String> | |
static auto | fromString (const String &string) -> eh::expected< Uuid, std::error_code > |
Creates a new UUID from a string. | |
static auto | fromRawData (const std::span< const std::byte, kRawDataSize > &data) -> Uuid |
Creates a new UUID from raw data. | |
static auto | create () -> Uuid |
Creates a new UUID. | |
static auto | createVersion4 () -> Uuid |
Creates a version 4 UUID. | |
static auto | createVersion5 (const Uuid &namespaceUuid, const void *data, std::size_t size) -> Uuid |
Creates a version 5 UUID from a block of memory. | |
template<tools::StringViewable String> | |
static auto | createVersion5 (const Uuid &namespaceUuid, const String &string) -> Uuid |
Creates a version 5 UUID from a Unicode string. | |
template<memory::MemoryRegion Region> requires (!tools::StringViewable<Region>) | |
static auto | createVersion5 (const Uuid &namespaceUuid, const Region ®ion) -> Uuid |
Creates a version 5 UUID from a memory region. | |
template<memory::MemoryIterator Iterator> | |
static auto | createVersion5 (const Uuid &namespaceUuid, Iterator begin, Iterator end) -> Uuid |
Creates a version 5 UUID from a memory region defined by a pair of iterators. | |
template<memory::MemoryIterator Iterator> requires (!std::convertible_to<Iterator, const void *>) | |
static auto | createVersion5 (const Uuid &namespaceUuid, Iterator begin, std::iter_difference_t< Iterator > size) -> Uuid |
Creates a version 5 UUID from a memory region defined by an iterator and a size. | |
Static Public Attributes | |
static constexpr std::size_t | kRawDataSize |
The size of the raw data. | |
static constexpr std::size_t | kStringSize |
The size of the string representation. | |
Related Symbols | |
(Note that these are not member symbols.) | |
consteval auto | operator""_uuid (const char *string, std::size_t size) -> utils::core::Uuid |
Literal operator for creating literal UUIDs. | |
A UUID.
|
constexprdefault |
Default constructor. Generates a nil UUID.
|
static |
Creates a new UUID.
Creates a new general purpose UUID, using a suitable version.
|
static |
Creates a version 4 UUID.
|
static |
Creates a version 5 UUID from a memory region.
namespaceUuid | The namespace UUID |
region | The memory region |
|
static |
Creates a version 5 UUID from a Unicode string.
namespaceUuid | The namespace UUID |
string | The string. Must be encoded as UTF-8, UTF-16, or UTF-32. |
|
static |
Creates a version 5 UUID from a block of memory.
namespaceUuid | The namespace UUID |
data | A pointer to the memory block |
size | The size of the memory block |
|
static |
Creates a version 5 UUID from a memory region defined by a pair of iterators.
namespaceUuid | The namespace UUID |
begin | An iterator that points at the beginning of the memory region |
end | An iterator that points at the end of the memory region |
|
static |
Creates a version 5 UUID from a memory region defined by an iterator and a size.
namespaceUuid | The namespace UUID |
begin | An iterator that points at the beginning of the memory region |
size | The size of the memory region |
|
static |
Creates a new UUID from raw data.
data | The raw bytes that should make up the UUID, in big endian byte order. The UUID 00112233-4455-6677-8899-aabbccddeeff must be represented as { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }. |
|
static |
Creates a new UUID from a string.
string | The string. The encoding of the string can be ASCII, or any encoding compatible with ASCII. This includes, but is not limited to, UTF-8, Latin-1, Windows Code Page 1252, and Windows Code Page 850 (OEM). |
|
noexcept |
Calculates a hash value for the UUID.
|
constexprnoexcept |
Determines if the UUID is 00000000-0000-0000-0000-000000000000
|
constexpr |
Three-Way-Comparison operator.
|
constexpr |
Comparison operator.
auto xentara::utils::core::Uuid::rawData | ( | ) | const -> std::span<const std::byte, kRawDataSize> |
Gets the raw data of the UUID.
The returned span will become invalid when this Uuid object is destroyed.
auto xentara::utils::core::Uuid::toBasicString | ( | ) | const -> string::BasicFixedString<Char, kStringSize, CharTraits> |
Converts the UUID to a string.
auto xentara::utils::core::Uuid::toString | ( | ) | const -> std::string |
Converts the UUID to a string of type char.
auto xentara::utils::core::Uuid::toU16String | ( | ) | const -> std::u16string |
Converts the UUID to a string of type char16_t.
auto xentara::utils::core::Uuid::toU32String | ( | ) | const -> std::u32string |
Converts the UUID to a string of type char32_t.
auto xentara::utils::core::Uuid::toU8String | ( | ) | const -> std::u8string |
Converts the UUID to a string of type char8_t.
auto xentara::utils::core::Uuid::toWString | ( | ) | const -> std::wstring |
Converts the UUID to a string of type wchar_t.
|
related |
Literal operator for creating literal UUIDs.
|
staticconstexpr |
The size of the raw data.
|
staticconstexpr |
The size of the string representation.