C/C++ API Reference
Loading...
Searching...
No Matches
pw_uuid

Overview

128-bit universally unique identifier (UUID).

Main docs: Home

Classes

class  pw::uuid::Uuid
 Represents a 128-bit universally unique identifier (UUID). More...
 

Functions

constexpr pw::uuid::Uuid::Uuid (span< const uint8_t, kSizeBytes > uuid_span)
 Creates a Uuid from a pw::span of 16 const bytes.
 
constexpr pw::uuid::Uuid::Uuid (span< const std::byte, kSizeBytes > uuid_span)
 Creates a Uuid from a pw::span of 16 const std::byte.
 
static constexpr Result< Uuidpw::uuid::Uuid::FromSpan (span< const uint8_t > uuid_span)
 Create a Uuid from a const uint8_t span.
 
static constexpr Result< Uuidpw::uuid::Uuid::FromSpan (ConstByteSpan uuid_span)
 Create a Uuid from a const std::byte span.
 
template<size_t kSize, typename = std::enable_if_t<kSize == kSizeBytes>>
static constexpr Uuid pw::uuid::Uuid::FromSpan (const std::array< uint8_t, kSize > &uuid_array)
 Creates a Uuid from a std::array of 16 const uint8_t.
 
template<size_t kSize, typename = std::enable_if_t<kSize == kSizeBytes>>
static constexpr Uuid pw::uuid::Uuid::FromSpan (const std::array< std::byte, kSize > &uuid_array)
 Creates a Uuid from a std::array of 16 const bytes.
 
template<size_t kSize, typename = std::enable_if_t<kSize == kSizeBytes>>
static constexpr Uuid pw::uuid::Uuid::FromSpan (const uint8_t(&uuid_array)[kSize])
 Creates a Uuid from a C-style array of 16 const uint8_t.
 
template<size_t kSize, typename = std::enable_if_t<kSize == kSizeBytes>>
static constexpr Uuid pw::uuid::Uuid::FromSpan (const std::byte(&uuid_array)[kSize])
 Creates a Uuid from a C-style array of 16 const bytes.
 
static constexpr Result< Uuidpw::uuid::Uuid::FromString (std::string_view string)
 Create a Uuid from a string.
 
constexpr span< const uint8_t, kSizeBytespw::uuid::Uuid::GetSpan () const
 Return the backing span holding the uuid.
 
constexpr bool pw::uuid::Uuid::operator== (const Uuid &other) const
 
constexpr bool pw::uuid::Uuid::operator!= (const Uuid &other) const
 
constexpr InlineString< kStringSizepw::uuid::Uuid::ToString () const
 Convert the Uuid to a human readable string.
 

Variables

static constexpr size_t pw::uuid::Uuid::kSizeBytes = 16
 Size of the UUID in bytes.
 
static constexpr size_t pw::uuid::Uuid::kStringSize
 Length of the UUID's string representation.
 

Function Documentation

◆ FromSpan() [1/6]

template<size_t kSize, typename = std::enable_if_t<kSize == kSizeBytes>>
static constexpr Uuid pw::uuid::Uuid::FromSpan ( const std::array< std::byte, kSize > &  uuid_array)
inlinestaticconstexpr

Creates a Uuid from a std::array of 16 const bytes.

This is guaranteed to be successful as the size is enforced by the type system.

Parameters
uuid_arrayA std::array containing the 16 bytes of the UUID.

◆ FromSpan() [2/6]

template<size_t kSize, typename = std::enable_if_t<kSize == kSizeBytes>>
static constexpr Uuid pw::uuid::Uuid::FromSpan ( const std::array< uint8_t, kSize > &  uuid_array)
inlinestaticconstexpr

Creates a Uuid from a std::array of 16 const uint8_t.

This is guaranteed to be successful as the size is enforced by the type system.

Parameters
uuid_arrayA std::array containing the 16 bytes of the UUID.

◆ FromSpan() [3/6]

template<size_t kSize, typename = std::enable_if_t<kSize == kSizeBytes>>
static constexpr Uuid pw::uuid::Uuid::FromSpan ( const std::byte(&)  uuid_array[kSize])
inlinestaticconstexpr

Creates a Uuid from a C-style array of 16 const bytes.

This is guaranteed to be successful as the size is enforced by the type system.

Parameters
uuid_arrayA C-style array containing the 16 bytes of the UUID.

◆ FromSpan() [4/6]

template<size_t kSize, typename = std::enable_if_t<kSize == kSizeBytes>>
static constexpr Uuid pw::uuid::Uuid::FromSpan ( const uint8_t(&)  uuid_array[kSize])
inlinestaticconstexpr

Creates a Uuid from a C-style array of 16 const uint8_t.

This is guaranteed to be successful as the size is enforced by the type system.

Parameters
uuid_arrayA C-style array containing the 16 bytes of the UUID.

◆ FromSpan() [5/6]

static constexpr Result< Uuid > pw::uuid::Uuid::FromSpan ( ConstByteSpan  uuid_span)
inlinestaticconstexpr

Create a Uuid from a const std::byte span.

Parameters
uuid_spanA span containing the UUID bytes.

◆ FromSpan() [6/6]

static constexpr Result< Uuid > pw::uuid::Uuid::FromSpan ( span< const uint8_t >  uuid_span)
inlinestaticconstexpr

Create a Uuid from a const uint8_t span.

Parameters
uuid_spanA span containing the UUID bytes.

◆ FromString()

static constexpr Result< Uuid > pw::uuid::Uuid::FromString ( std::string_view  string)
inlinestaticconstexpr

Create a Uuid from a string.

Parameters
stringA string representation of the UUID.

◆ Uuid() [1/2]

constexpr pw::uuid::Uuid::Uuid ( span< const std::byte, kSizeBytes uuid_span)
inlineexplicitconstexpr

Creates a Uuid from a pw::span of 16 const std::byte.

This constructor is constexpr and guaranteed to be successful as the size is enforced by the type system.

Parameters
uuid_spanA span containing the 16 bytes of the UUID.

◆ Uuid() [2/2]

constexpr pw::uuid::Uuid::Uuid ( span< const uint8_t, kSizeBytes uuid_span)
inlineexplicitconstexpr

Creates a Uuid from a pw::span of 16 const bytes.

This constructor is constexpr and guaranteed to be successful as the size is enforced by the type system.

Parameters
uuid_spanA span containing the 16 bytes of the UUID.

Variable Documentation

◆ kStringSize

constexpr size_t pw::uuid::Uuid::kStringSize
staticconstexpr
Initial value:
=
std::string_view{"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}.size()

Length of the UUID's string representation.