UuidΒΆ
Inherited: None
DescriptionΒΆ
Uuid represents a 128-bit UUID (RFC 4122 compatible). It provides utilities to create random (version 4) UUIDs, convert to/from string and byte array representations, and basic comparison operators.
Public MethodsΒΆ
Uuid () |
|
Uuid (const TString & uuid) |
|
void |
fromByteArray (const ByteArray & array) |
bool |
isNull () const |
ByteArray |
toByteArray () const |
toString () const |
|
bool |
operator!= (const Uuid & other) const |
bool |
operator< (const Uuid & other) const |
bool |
operator== (const Uuid & other) const |
Static MethodsΒΆ
createUuid () |
Methods DescriptionΒΆ
Uuid::Uuid ()
The internal 16-byte value is zero-initialized.
Uuid::Uuid (TString & uuid)
Construct a uuid from its textual representation.
Accepts common UUID formats with or without braces and dashes (for example: {550e8400-e29b-41d4-a716-446655440000} or 550e8400e29b41d4a716446655440000). Non-hex characters except for separators are ignored. If the input contains fewer than 16 bytes, the remaining bytes stay zero.
Uuid Uuid::createUuid ()
Generate a random (version 4) UUID.
Uses a C++ random device and Mersenne Twister generator to produce 16 random bytes. Sets version and variant bits according to RFC 4122.
void Uuid::fromByteArray (ByteArray & array)
Load UUID bytes from a 16-byte ByteArray.
The provided array is expected to contain at least 16 bytes.
bool Uuid::isNull () const
Returns true if UUID is the null UUID (all bytes zero).
ByteArray Uuid::toByteArray () const
Convert the UUID to a 16-byte ByteArray.
TString Uuid::toString () const
Return the canonical string representation of the UUID.
The returned string is formatted with braces and hyphens, e.g. {550e8400-e29b-41d4-a716-446655440000}.
bool Uuid::operator!= (Uuid & other) const
Inequality comparison with other UUIDs. Returns true if the UUIDs are different; otherwise returns false.
bool Uuid::operator< (Uuid & other) const
Ordering with other UUID (lexicographical by bytes). Returns true if this UUID is lexicographically less than other; otherwise returns false.
bool Uuid::operator== (Uuid & other) const
Equality comparison with other UUID. Returns true if the UUIDs are equal; otherwise returns false.