xtd - Reference Guide
0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <guid.h>
Represents a globally unique identifier (GUID). A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
Inherits xtd::object, xtd::icomparable< guid >, and xtd::iequatable< guid >.
Static Public Attributes | |
static const guid | empty |
Get A read-only instance of the xtd::guid structure whose value is all zeros. More... | |
Public Member Functions | |
guid ()=default | |
Initializes a new instance of the xtd::guid structure. More... | |
guid (const std::initializer_list< byte_t > &data) | |
Initializes a new instance of the xtd::guid structure by using the specified array of bytes. More... | |
guid (const std::vector< byte_t > &data) | |
Initializes a new instance of the xtd::guid structure by using the specified array of bytes. More... | |
guid (const ustring &guid) | |
Initializes a new instance of the xtd::guid structure by using the value represented by the specified string. More... | |
guid (int32_t a, int16_t b, int16_t c, byte_t d, byte_t e, byte_t f, byte_t g, byte_t h, byte_t i, byte_t j, byte_t k) noexcept | |
Initializes a new instance of the xtd::guid structure by using the specified integers and bytes. More... | |
guid (int32_t a, int32_t b, int32_t c, const std::vector< byte_t > &d) | |
Initializes a new instance of the xtd::guid structure by using the specified integers and byte array. More... | |
guid (uint32_t a, uint16_t b, uint16_t c, byte_t d, byte_t e, byte_t f, byte_t g, byte_t h, byte_t i, byte_t j, byte_t k) noexcept | |
Initializes a new instance of the xtd::guid structure by using the specified uint32_integers and bytes. More... | |
int32_t | compare_to (const guid &value) const noexcept override |
Compares the current instance with another object of the same type. More... | |
int32_t | compare_to (const object &obj) const noexcept override |
Compares the current instance with another object of the same type. More... | |
bool | equals (const guid &g) const noexcept override |
Indicates whether the current object is equal to another object of the same type. More... | |
bool | equals (const object &g) const noexcept override |
Determines whether the specified object is equal to the current object. More... | |
const std::vector< byte_t > & | to_byte_array () const noexcept |
Returns a 16-element byte array that contains the value of this instance. More... | |
xtd::ustring | to_string () const noexcept override |
Returns a string representation of the value of this instance in registry format. More... | |
ustring | to_string (ustring format) const |
Returns a string representation of the value of this xtd::guid instance, according to the provided format specifier. More... | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. More... | |
Static Public Member Functions | |
static guid | new_guid () noexcept |
Initializes a new instance of the xtd::guid structure. More... | |
Static Public Member Functions inherited from xtd::object | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. More... | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. More... | |
|
default |
Initializes a new instance of the xtd::guid structure.
|
explicit |
Initializes a new instance of the xtd::guid structure by using the specified array of bytes.
bytes | A 16-element byte array containing values with which to initialize the GUID. |
xtd::argument_exception | bytes is not 16 bytes long. |
|
explicit |
Initializes a new instance of the xtd::guid structure by using the specified array of bytes.
bytes | A 16-element byte array containing values with which to initialize the GUID. |
xtd::argument_exception | bytes is not 16 bytes long. |
|
explicit |
Initializes a new instance of the xtd::guid structure by using the specified integers and byte array.
a | The first 4 bytes of the GUID. |
b | The next 2 bytes of the GUID. |
c | The next 2 bytes of the GUID. |
d | The remaining 8 bytes of the GUID. |
xtd::argument_exception | bytes is not 8 bytes long. |
|
noexcept |
Initializes a new instance of the xtd::guid structure by using the specified integers and bytes.
a | The first 4 bytes of the GUID. |
b | The next 2 bytes of the GUID. |
c | The next 2 bytes of the GUID. |
d | The next byte of the GUID. |
e | The next byte of the GUID. |
f | The next byte of the GUID. |
g | The next byte of the GUID. |
h | The next byte of the GUID. |
i | The next byte of the GUID. |
j | The next byte of the GUID. |
k | The next byte of the GUID. |
|
noexcept |
Initializes a new instance of the xtd::guid structure by using the specified uint32_integers and bytes.
a | The first 4 bytes of the GUID. |
b | The next 2 bytes of the GUID. |
c | The next 2 bytes of the GUID. |
d | The next byte of the GUID. |
e | The next byte of the GUID. |
f | The next byte of the GUID. |
g | The next byte of the GUID. |
h | The next byte of the GUID. |
i | The next byte of the GUID. |
j | The next byte of the GUID. |
k | The next byte of the GUID. |
xtd::guid::guid | ( | const ustring & | guid | ) |
Initializes a new instance of the xtd::guid structure by using the value represented by the specified string.
guid | A string that contains a GUID in one of the following formats ("d" represents a hexadecimal digit whose case is ignored): 32 contiguous digits: dddddddddddddddddddddddddddddddd -or- Groups of 8, 4, 4, 4, and 12 digits with hyphens between the groups. The entire GUID can optionally be enclosed in matching braces or parentheses: dddddddd-dddd-dddd-dddd-dddddddddddd -or- {dddddddd-dddd-dddd-dddd-dddddddddddd} -or- (dddddddd-dddd-dddd-dddd-dddddddddddd) -or- Groups of 8, 4, and 4 digits, and a subset of eight groups of 2 digits, with each group prefixed by "0x" or "0X", and separated by commas. The entire GUID, as well as the subset, is enclosed in matching braces: {0xdddddddd, 0xdddd, 0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}} All braces, commas, and "0x" prefixes are required. All embedded spaces are ignored. All leading zeros in a group are ignored. The digits shown in a group are the maximum number of meaningful digits that can appear in that group. You can specify from 1 to the number of digits shown for a group. The specified digits are assumed to be the low-order digits of the group. |
xtd::format_exception | The format of gui is invalid. |
|
overridevirtualnoexcept |
Compares the current instance with another object of the same type.
obj | An object to compare with this instance. |
Value | Condition |
---|---|
Less than zero | This instance is less than obj. |
Zero | This instance is equal to obj. |
Greater than zero | This instance is greater than obj. |
Implements xtd::icomparable< guid >.
|
overridevirtualnoexcept |
Compares the current instance with another object of the same type.
obj | An object to compare with this instance. |
Value | Condition |
---|---|
Less than zero | This instance is less than obj. |
Zero | This instance is equal to obj. |
Greater than zero | This instance is greater than obj. |
Reimplemented from xtd::icomparable< guid >.
|
overridevirtualnoexcept |
Indicates whether the current object is equal to another object of the same type.
obj | An object to compare with this object. |
Implements xtd::iequatable< guid >.
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
Reimplemented from xtd::object.
|
staticnoexcept |
Initializes a new instance of the xtd::guid structure.
|
noexcept |
Returns a 16-element byte array that contains the value of this instance.
|
overridevirtualnoexcept |
Returns a string representation of the value of this instance in registry format.
Reimplemented from xtd::object.
Returns a string representation of the value of this xtd::guid instance, according to the provided format specifier.
format | A single format specifier that indicates how to format the value of this xtd::guid. The format parameter can be "N", "D", "B", "P", or "X". If format is null or an empty string (""), "D" is used. |
xtd::format_exception | The value of format is not null, an empty string (""), "N", "D", "B", "P", or "X". |
Specifier | Format of return value |
---|---|
N | 32 digits: |
00000000000000000000000000000000 | |
D | 32 digits separated by hyphens: |
00000000-0000-0000-0000-000000000000 | |
B | 32 digits separated by hyphens, enclosed in braces: |
{00000000-0000-0000-0000-000000000000} | |
P | 32 digits separated by hyphens, enclosed in parentheses: |
(00000000-0000-0000-0000-000000000000) | |
X | Four hexadecimal values enclosed in braces, where the fourth value is a subset of eight hexadecimal values that is also enclosed in braces: |
{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} |
|
static |
Get A read-only instance of the xtd::guid structure whose value is all zeros.