Qore uuid Module 1.4.1
Loading...
Searching...
No Matches
Qore::UUID::UUID Class Reference

The UUID class provides methods that allow UUIDs to be created, manipulated, and parsed. More...

#include <QC_UUID.dox.h>

Public Member Methods

nothing clear ()
 Clears the UUID and sets the null value ("00000000-0000-0000-0000-000000000000")
 
int compare (UUID other)
 Compares the current UUID with another UUID and returns -1, 0, or 1 if the other UUID is greater than, equal to, or less than the current UUID respectively. More...
 
 constructor (int flags=Qore::UUID::None)
 Generates a UUID. More...
 
 constructor (string uuid_str)
 parses a string to construct a UUID More...
 
 copy ()
 Creates an exact copy of the UUID object. More...
 
nothing generate (int flags=Qore::UUID::None)
 Generates a new UUID value for the object; the current value of the UUID object is overwritten with the newly-generated value. More...
 
bool isNull ()
 Returns True if the current UUID is the null UUID, or False if not. More...
 
nothing set (string uuid_str)
 sets the UUID from the given string More...
 
string toString (int flag=Qore::UUID::LowerCase)
 Returns the string representation of the UUID. More...
 

Static Public Member Methods

static string get (int str_flag=Qore::UUID::LowerCase, int gen_flags=Qore::UUID::None)
 Returns a UUID string without having to create a UUID object. More...
 

Detailed Description

The UUID class provides methods that allow UUIDs to be created, manipulated, and parsed.

Member Function Documentation

◆ compare()

int Qore::UUID::UUID::compare ( UUID  other)

Compares the current UUID with another UUID and returns -1, 0, or 1 if the other UUID is greater than, equal to, or less than the current UUID respectively.

Code Flags:
CONSTANT
Parameters
otherthe other UUID to compare
Returns
-1, 0, or 1 if the other UUID is greater than, equal to, or less than the current UUID respectively
Example:
my int $rc = $uuid.compare($other_uuid);

◆ constructor() [1/2]

Qore::UUID::UUID::constructor ( int  flags = Qore::UUID::None)

Generates a UUID.

Parameters
flagsUUID Generation Constants combined with binary or to affect how the UUID is generated
Examples:
  • to generate a UUID using the default algorithm:
    my UUID $uuid();
    The UUID class provides methods that allow UUIDs to be created, manipulated, and parsed.
    Definition: QC_UUID.dox.h:7
  • to make a UUID object from an explicit value:
    my UUID $uuid("93c40733-9b99-46c6-91a5-f3989067dc1e");
  • to create a UUID with the null value:
    my UUID $uuid(UUID::Empty);
    const Empty
    The UUID will be assigned the null value on creation.
    Definition: QC_UUID.dox.h:149

◆ constructor() [2/2]

Qore::UUID::UUID::constructor ( string  uuid_str)

parses a string to construct a UUID

Parameters
uuid_stra UUID string in a format as in the following example: "93c40733-9b99-46c6-91a5-f3989067dc1e"
Example:
  • to make a UUID object from an explicit value:
    my UUID $uuid("93c40733-9b99-46c6-91a5-f3989067dc1e");
Exceptions
UUID-STRING-ERRORinvalid UUID string (invalid format, invalid characters, etc)

◆ copy()

Qore::UUID::UUID::copy ( )

Creates an exact copy of the UUID object.

Example:
my UUID $new_uuid = $uuid.copy();
copy()
Creates an exact copy of the UUID object.

◆ generate()

nothing Qore::UUID::UUID::generate ( int  flags = Qore::UUID::None)

Generates a new UUID value for the object; the current value of the UUID object is overwritten with the newly-generated value.

Parameters
flagsUUID Generation Constants combined with binary or to affect how the UUID is generated
Examples:
  • to generate a UUID using the default algorithm:
    $uuid.generate();
  • to create a UUID with the null value:
    $uuid.generate(UUID::Empty);

◆ get()

static string Qore::UUID::UUID::get ( int  str_flag = Qore::UUID::LowerCase,
int  gen_flags = Qore::UUID::None 
)
static

Returns a UUID string without having to create a UUID object.

Code Flags:
CONSTANT
Parameters
str_flagone of the UUID Formatting Constants to affect the formatting of the UUID string output
gen_flagsUUID Generation Constants combined with binary or to affect how the UUID is generated
Returns
the string representation of the UUID according to the arguments, ex: "f5c5fd74-5b3e-4f02-8772-f8a80da9b028"

◆ isNull()

bool Qore::UUID::UUID::isNull ( )

Returns True if the current UUID is the null UUID, or False if not.

Returns
True if the current UUID is the null UUID, or False if not
Code Flags:
CONSTANT
Example:
my bool $b = $uuid.isNull();

◆ set()

nothing Qore::UUID::UUID::set ( string  uuid_str)

sets the UUID from the given string

Parameters
uuid_stra UUID string in a format as in the following example: "93c40733-9b99-46c6-91a5-f3989067dc1e"
Example:
$uuid.set("93c40733-9b99-46c6-91a5-f3989067dc1e");
Exceptions
UUID-STRING-ERRORinvalid UUID string (invalid format, invalid characters, etc)

◆ toString()

string Qore::UUID::UUID::toString ( int  flag = Qore::UUID::LowerCase)

Returns the string representation of the UUID.

Code Flags:
CONSTANT
Parameters
flagone of the UUID Formatting Constants to affect the formatting of the UUID string output
Returns
the string representation of the UUID, ex: "f5c5fd74-5b3e-4f02-8772-f8a80da9b028"
Example:
my string $str = $uuid.toString();

The documentation for this class was generated from the following file: