![]() |
Audacity 3.2.0
|
Utility class that generates and parses UUIDs. More...
#include <Uuid.h>
Public Types | |
| using | Bytes = std::array< uint8_t, 16 > |
Public Member Functions | |
| Uuid () | |
| Creates a nil UUID. More... | |
| Uuid (const Bytes &data) noexcept | |
| Creates UUID from the 16 bytes long array. More... | |
| bool | IsNil () const noexcept |
| Checks, if the UUID is nil. More... | |
| operator bool () const noexcept | |
| Synonymous to !isNil() More... | |
| bool | operator== (const Uuid &other) const noexcept |
| bool | operator!= (const Uuid &other) const noexcept |
| bool | operator> (const Uuid &other) const noexcept |
| bool | operator>= (const Uuid &other) const noexcept |
| bool | operator< (const Uuid &other) const noexcept |
| bool | operator<= (const Uuid &other) const noexcept |
| const Bytes & | ToBytes () const noexcept |
| Get the 16 bytes long array with the raw UUID data. More... | |
| std::string | ToString () const |
| Get a string in the xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format. More... | |
| std::string | ToHexString () const |
| Get a string in the xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx format. More... | |
| std::size_t | GetHash () const noexcept |
Static Public Member Functions | |
| static Uuid | Generate () |
| Generate a new UUID. More... | |
| static Uuid | FromString (const std::string &str) |
Private Attributes | |
| Bytes | mData |
Utility class that generates and parses UUIDs.
UUIDs are generated using: UuidCreate on Windows, CFUUIDCreate on macOS, libuuid on other systems.
| using audacity::Uuid::Bytes = std::array<uint8_t, 16> |
|
explicitnoexcept |
Creates UUID from the 16 bytes long array.
|
static |
Parses an UUID from the string. This method expects the string to be in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} formats. This will return nil UUID if parsing fails
Definition at line 119 of file Uuid.cpp.
References audacity::BRACED_UUID_LENGTH, mData, audacity::anonymous_namespace{Uuid.cpp}::readByte(), str, and audacity::UUID_LENGTH.
|
static |
Generate a new UUID.
Definition at line 82 of file Uuid.cpp.
References mData.
Referenced by audacity::sentry::anonymous_namespace{SentryReport.cpp}::CreateSentryDocument().
|
noexcept |
Definition at line 252 of file Uuid.cpp.
References mData.
|
noexcept |
|
explicitnoexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
| std::string Uuid::ToHexString | ( | ) | const |
Get a string in the xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx format.
Definition at line 215 of file Uuid.cpp.
References audacity::HEX_UUID_LENGTH, and mData.
Referenced by audacity::sentry::anonymous_namespace{SentryReport.cpp}::CreateSentryDocument().
| std::string Uuid::ToString | ( | ) | const |
Get a string in the xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
Definition at line 199 of file Uuid.cpp.
References mData, and audacity::UUID_LENGTH.
|
private |
Definition at line 78 of file Uuid.h.
Referenced by FromString(), Generate(), GetHash(), IsNil(), ToBytes(), ToHexString(), and ToString().