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.
Public Fields | |
static const guid | empty |
Gets A read-only instance of the xtd::guid structure whose value is all zeros. | |
Public Constructors | |
guid ()=default | |
Initializes a new instance of the xtd::guid structure. | |
guid (const xtd::array< xtd::byte > &data) | |
Initializes a new instance of the xtd::guid structure by using the specified array of bytes. | |
guid (const std::initializer_list< xtd::byte > &data) | |
Initializes a new instance of the xtd::guid structure by using the specified array of bytes. | |
guid (int32 a, int16 b, int16 c, const xtd::array< xtd::byte > &d) | |
Initializes a new instance of the xtd::guid structure by using the specified integers and byte array. | |
guid (uint32 a, uint16 b, uint16 c, const xtd::array< xtd::byte > &d) | |
Initializes a new instance of the xtd::guid structure by using the specified unsigned integers and byte array. | |
guid (int32 a, int16 b, int16 c, xtd::byte d, xtd::byte e, xtd::byte f, xtd::byte g, xtd::byte h, xtd::byte i, xtd::byte j, xtd::byte k) noexcept | |
Initializes a new instance of the xtd::guid structure by using the specified integers and bytes. | |
guid (uint32 a, uint16 b, uint16 c, xtd::byte d, xtd::byte e, xtd::byte f, xtd::byte g, xtd::byte h, xtd::byte i, xtd::byte j, xtd::byte k) noexcept | |
Initializes a new instance of the xtd::guid structure by using the specified unsigned integers and bytes. | |
guid (const string &guid) | |
Initializes a new instance of the xtd::guid structure by using the value represented by the specified string. | |
Public Methods | |
int32 | compare_to (const guid &value) const noexcept override |
Compares the current instance with another object of the same type. | |
bool | equals (const object &obj) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | equals (const guid &g) const noexcept override |
Determines whether the specified object is equal to the current object. | |
xtd::size | get_hash_code () const noexcept override |
Serves as a hash function for a particular type. | |
const xtd::array< xtd::byte > & | to_byte_array () const noexcept |
Returns a 16-element byte array that contains the value of this instance. | |
xtd::string | to_string () const noexcept override |
Returns a string representation of the value of this instance in registry format. | |
string | to_string (const string &format) const |
Returns a string representation of the value of this xtd::guid instance, according to the provided format specifier. | |
string | to_string (const string &format, const std::locale &loc) const override |
Returns a string representation of the value of this xtd::guid instance, according to the provided format specifier, and locale. | |
Public Static Methods | |
static guid | new_guid () noexcept |
Initializes a new instance of the xtd::guid structure. | |
Additional Inherited Members | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<class object_t > | |
xtd::uptr< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
![]() | |
![]() | |
![]() | |
![]() | |
template<class object_a_t , class object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<class object_a_t , class object_b_t > | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
|
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. |
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. |
|
explicit |
Initializes a new instance of the xtd::guid structure by using the specified unsigned 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. |
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 unsigned 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. |
|
explicit |
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. |
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 |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. Reimplemented from xtd::object.
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
g | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. Implements xtd::iequatable< guid >.
|
overridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
|
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} |
|
overridevirtual |
Returns a string representation of the value of this xtd::guid instance, according to the provided format specifier, and locale.
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. |
loc | An std::locale object that contains locale information (see std::locale). |
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} |
Implements xtd::iformatable.
|
staticnoexcept |
Initializes a new instance of the xtd::guid structure.
|
static |
Gets A read-only instance of the xtd::guid structure whose value is all zeros.