Hide menu
Loading...
Searching...
No Matches

Defines a Universally Unique IDentifier (UUID), also known as GUIDs (Globally Unique IDentifier). A UUID is a 16-byte (128-bit) number, that is unique in the computer system (guaranteed by generated algorithm ). More...

#include <cadex/Uuid.hxx>

Public Types

typedef uint8_t ValueType
 
typedef std::array< ValueType, 16 > DataType
 

Public Member Functions

 Uuid ()
 Creates the null UUID.
 
 Uuid (const ValueType *theData)
 Creates a UUID with the values specified by the parameter. The function assumes theData contains 16 bytes and initializes the object with the values of these 16 bytes.
 
 Uuid (DataType theData)
 
const DataType & Data () const
 
bool IsNull () const
 
 operator bool () const
 
std::string ToString () const
 Returns the string representation of this UUID. The string representation of a uuid is "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" where 'x' is a hexidecimal digit.
 

Static Public Member Functions

static Uuid FromString (const std::string &theStr)
 Creates a UUID object from a string. String must be formatted as five hex fields separated by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where each 'x' is a hexidecimal digit. The curly braces shown here are optional. If the conversion fails, a null UUID is returned.
 
static Uuid CreateRandom ()
 

Detailed Description

Defines a Universally Unique IDentifier (UUID), also known as GUIDs (Globally Unique IDentifier). A UUID is a 16-byte (128-bit) number, that is unique in the computer system (guaranteed by generated algorithm ).

Member Function Documentation

◆ CreateRandom()

Uuid cadex::Uuid::CreateRandom ( )
static

Creates new random uuid. This method is thread-safe and uses mutex to syncrhonize access to random number generator.

◆ IsNull()

bool cadex::Uuid::IsNull ( ) const

Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false.