Defines a Universally Unique IDentifier (UUID), also known as GUIDs (Globally Unique IDentifier). 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. | |
| Uuid (DataType theData) | |
| const DataType & | Data () const |
| bool | IsNull () const |
| Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false. | |
| operator bool () const | |
| std::string | ToString () const |
| Returns the string representation of this UUID. | |
Static Public Member Functions | |
| static Uuid | FromString (const std::string &theStr) |
| Creates a UUID object from a string. | |
| static Uuid | CreateRandom () |
| Creates new random uuid. | |
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 ).
| cadex::Uuid::Uuid | ( | ) |
Creates the null UUID.
|
explicit |
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.
|
static |
Creates new random uuid.
This method is thread-safe and uses mutex to syncrhonize access to random number generator.
|
static |
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.
| bool cadex::Uuid::IsNull | ( | ) | const |
Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false.
| std::string cadex::Uuid::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.