EtcPal
0.4.1
ETC Platform Abstraction Layer (EtcPal)
|
View other versions:
|
A wrapper class for the EtcPal UUID type.
Provides C++ syntactic sugar for working with UUIDs. UUIDs are considered immutable after they are created, so there is no non-const access to the underlying data as of now.
Public Member Functions | |
Uuid ()=default | |
Constructs a null UUID by default. | |
Uuid (const uint8_t *data) noexcept | |
Construct a UUID from raw data. More... | |
constexpr | Uuid (const EtcPalUuid &c_uuid) noexcept |
Construct a UUID copied from an instance of the C EtcPalUuid type. | |
Uuid & | operator= (const EtcPalUuid &c_uuid) noexcept |
Assign an instance of the C EtcPalUuid type to an instance of this class. | |
constexpr const EtcPalUuid & | get () const noexcept |
Get a reference to the underlying C type. | |
const uint8_t * | data () const noexcept |
Get the raw data of a UUID. More... | |
std::string | ToString () const |
Convert the UUID to a string representation formatted per RFC 4122. | |
bool | IsNull () const noexcept |
Check if a UUID is null (all 0's). | |
UuidVersion | version () const noexcept |
Get the version type of a UUID. More... | |
UUID field accessors | |
uint32_t | time_low () const noexcept |
Get the time_low portion of a UUID. | |
uint16_t | time_mid () const noexcept |
Get the time_mid portion of a UUID. | |
uint16_t | time_hi_and_version () const noexcept |
Get the time_hi_and_version portion of a UUID. | |
std::array< uint8_t, 8 > | clock_seq_and_node () const noexcept |
Get the remaining portion of a UUID, including clock_seq_hi_and_res, clock_seq_low, and node. | |
Static Public Member Functions | |
static Uuid | FromString (const char *uuid_str) noexcept |
Create a UUID from a string representation. More... | |
static Uuid | FromString (const std::string &uuid_str) noexcept |
Create a UUID from a string representation. More... | |
static Uuid | V1 () noexcept |
Generate and return a Version 1 UUID. More... | |
static Uuid | V3 (const Uuid &ns, const void *name, size_t name_len) noexcept |
Generate and return a Version 3 UUID. More... | |
static Uuid | V3 (const Uuid &ns, const char *name) noexcept |
Generate and return a Version 3 UUID. More... | |
static Uuid | V3 (const Uuid &ns, const std::string &name) noexcept |
Generate and return a Version 3 UUID. More... | |
static Uuid | V4 () noexcept |
Generate and return a Version 4 UUID. More... | |
static Uuid | V5 (const Uuid &ns, const void *name, size_t name_len) noexcept |
Generate and return a Version 5 UUID. More... | |
static Uuid | V5 (const Uuid &ns, const char *name) noexcept |
Generate and return a Version 5 UUID. More... | |
static Uuid | V5 (const Uuid &ns, const std::string &name) noexcept |
Generate and return a Version 5 UUID. More... | |
static Uuid | OsPreferred () noexcept |
Generate and return a UUID of the version preferred by the underlying OS. More... | |
static Uuid | Device (const std::string &device_str, const uint8_t *mac_addr, uint32_t uuid_num) noexcept |
Generate and return a Device UUID. More... | |
static Uuid | Device (const std::string &device_str, const std::array< uint8_t, 6 > &mac_addr, uint32_t uuid_num) noexcept |
Generate and return a Device UUID. More... | |
|
inlinenoexcept |
Construct a UUID from raw data.
data | The raw data array, must be at least ETCPAL_UUID_BYTES in length. |
|
inlinenoexcept |
Get the raw data of a UUID.
|
inlinestaticnoexcept |
Generate and return a Device UUID.
See etcpal_generate_device_uuid() for more information.
|
inlinestaticnoexcept |
Generate and return a Device UUID.
See etcpal_generate_device_uuid() for more information.
|
inlinestaticnoexcept |
Create a UUID from a string representation.
|
inlinestaticnoexcept |
Create a UUID from a string representation.
|
inlinestaticnoexcept |
Generate and return a UUID of the version preferred by the underlying OS.
If not implemented, returns a null UUID. See etcpal_generate_os_preferred_uuid() for more information.
|
inlinestaticnoexcept |
Generate and return a Version 1 UUID.
If not implemented, returns a null UUID. See etcpal_generate_v1_uuid() for more information.
Generate and return a Version 3 UUID.
ns | UUID to use as a namespace. |
name | A null-terminated C string representing the name to convert into a UUID. |
See etcpal_generate_v3_uuid() for more information.
Generate and return a Version 3 UUID.
ns | UUID to use as a namespace. |
name | A string representing the name to convert into a UUID. |
See etcpal_generate_v3_uuid() for more information.
Generate and return a Version 3 UUID.
See etcpal_generate_v3_uuid() for more information.
|
inlinestaticnoexcept |
Generate and return a Version 4 UUID.
If not implemented, returns a null UUID. See etcpal_generate_v4_uuid() for more information.
Generate and return a Version 5 UUID.
ns | UUID to use as a namespace. |
name | A null-terminated C string representing the name to convert into a UUID. |
See etcpal_generate_v5_uuid() for more information.
Generate and return a Version 5 UUID.
ns | UUID to use as a namespace. |
name | A string representing the name to convert into a UUID. |
See etcpal_generate_v5_uuid() for more information.
Generate and return a Version 5 UUID.
See etcpal_generate_v5_uuid() for more information.
|
inlinenoexcept |
Get the version type of a UUID.