![]() |
smgl 0.11.0
Structured Metadata Engine and Graph Objects Library
|
Universally unique identifier class. More...
#include <smgl/Uuid.hpp>
Public Types | |
| using | Byte = std::uint8_t |
Public Member Functions | |
| Uuid ()=default | |
| operator bool () const | |
| auto | operator== (const Uuid &rhs) const -> bool |
| auto | operator!= (const Uuid &rhs) const -> bool |
| void | reset () |
| Reset the UUID to a nil value. | |
| auto | is_nil () const -> bool |
| Returns true is all bytes are zero. | |
| auto | string () const -> std::string |
| Get a string representation of the UUID. | |
| auto | short_string () const -> std::string |
| Get a string representation of the short UUID. | |
Static Public Member Functions | |
| static auto | FromString (const std::string &str) -> Uuid |
| Construct a UUID from a string. | |
| static auto | Uuid4 () -> Uuid |
| Generate a UUIDv4 using pseudo-random numbers. | |
Private Attributes | |
| std::array< Byte, 16 > | buffer_ {} |
Universally unique identifier class.
Attempts to implement the UUID defined by RFC 4122.
| using smgl::Uuid::Byte = std::uint8_t |
|
default |
Default constructor. Constructed UUID is nil valued.
|
static |
Construct a UUID from a string.
| std::invalid_argument | if str is not of the form: aabbccdd-eeff-0011-2233-445566778899 |
|
explicit |
Functor: Returns true if not nil
| auto smgl::Uuid::operator!= | ( | const Uuid & | rhs | ) | const -> bool |
Inequality: Returns true if UUID bytes are not the same
| auto smgl::Uuid::operator== | ( | const Uuid & | rhs | ) | const -> bool |
Equality: Returns true if UUID bytes are the same
| auto smgl::Uuid::short_string | ( | ) | const -> std::string |
Get a string representation of the short UUID.
Gets a string representation of the short UUID, the first 4 hexadecimal digits: aabbccdd
| auto smgl::Uuid::string | ( | ) | const -> std::string |
Get a string representation of the UUID.
Gets a string representation of the UUID as 16 hexadecimal digits: aabbccdd-eeff-0011-2233-445566778899
|
static |
Generate a UUIDv4 using pseudo-random numbers.
See RFC 4122 section 4.4 for more details.
|
private |