Struct qt_core::QUuid

source ·
#[repr(C)]
pub struct QUuid { /* private fields */ }
Expand description

The QUuid class stores a Universally Unique Identifier (UUID).

C++ class: QUuid.

C++ documentation:

The QUuid class stores a Universally Unique Identifier (UUID).

Using Universally Unique IDentifiers (UUID) is a standard way to uniquely identify entities in a distributed computing environment. A UUID is a 16-byte (128-bit) number generated by some algorithm that is meant to guarantee that the UUID will be unique in the distributed computing environment where it is used. The acronym GUID is often used instead, Globally Unique IDentifiers, but it refers to the same thing.

Actually, the GUID is one variant of UUID. Multiple variants are in use. Each UUID contains a bit field that specifies which type (variant) of UUID it is. Call variant() to discover which type of UUID an instance of QUuid contains. It extracts the three most significant bits of byte 8 of the 16 bytes. In QUuid, byte 8 is QUuid::data4[0]. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the three most significant bits of parameter b1, which becomes QUuid::data4[0] and contains the variant field in its three most significant bits. In the table, 'x' means don't care.

msb0msb1msb2Variant
0xxNCS (Network Computing System)
10xDCE (Distributed Computing Environment)
110Microsoft (GUID)
111Reserved for future expansion

If variant() returns QUuid::DCE, the UUID also contains a version field in the four most significant bits of QUuid::data3, and you can call version() to discover which version your QUuid contains. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the four most significant bits of parameter w2, which becomes QUuid::data3 and contains the version field in its four most significant bits.

msb0msb1msb2msb3Version
0001Time
0010Embedded POSIX
0011Md5(Name)
0100Random
0101Sha1

The field layouts for the DCE versions listed in the table above are specified in the Network Working Group UUID Specification.

Most platforms provide a tool for generating new UUIDs, e.g. uuidgen and guidgen. You can also use createUuid(). UUIDs generated by createUuid() are of the random type. Their QUuid::Version bits are set to QUuid::Random, and their QUuid::Variant bits are set to QUuid::DCE. The rest of the UUID is composed of random numbers. Theoretically, this means there is a small chance that a UUID generated by createUuid() will not be unique. But it is a very small chance.

UUIDs can be constructed from numeric values or from strings, or using the static createUuid() function. They can be converted to a string with toString(). UUIDs have a variant() and a version(), and null UUIDs return true from isNull().

Implementations§

source§

impl QUuid

source

pub unsafe fn copy_from(&self, other: impl CastInto<Ref<QUuid>>) -> Ref<QUuid>

The QUuid class stores a Universally Unique Identifier (UUID).

Calls C++ function: QUuid& QUuid::operator=(const QUuid& other).

C++ documentation:

The QUuid class stores a Universally Unique Identifier (UUID).

Using Universally Unique IDentifiers (UUID) is a standard way to uniquely identify entities in a distributed computing environment. A UUID is a 16-byte (128-bit) number generated by some algorithm that is meant to guarantee that the UUID will be unique in the distributed computing environment where it is used. The acronym GUID is often used instead, Globally Unique IDentifiers, but it refers to the same thing.

Actually, the GUID is one variant of UUID. Multiple variants are in use. Each UUID contains a bit field that specifies which type (variant) of UUID it is. Call variant() to discover which type of UUID an instance of QUuid contains. It extracts the three most significant bits of byte 8 of the 16 bytes. In QUuid, byte 8 is QUuid::data4[0]. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the three most significant bits of parameter b1, which becomes QUuid::data4[0] and contains the variant field in its three most significant bits. In the table, 'x' means don't care.

msb0msb1msb2Variant
0xxNCS (Network Computing System)
10xDCE (Distributed Computing Environment)
110Microsoft (GUID)
111Reserved for future expansion

If variant() returns QUuid::DCE, the UUID also contains a version field in the four most significant bits of QUuid::data3, and you can call version() to discover which version your QUuid contains. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the four most significant bits of parameter w2, which becomes QUuid::data3 and contains the version field in its four most significant bits.

msb0msb1msb2msb3Version
0001Time
0010Embedded POSIX
0011Md5(Name)
0100Random
0101Sha1

The field layouts for the DCE versions listed in the table above are specified in the Network Working Group UUID Specification.

Most platforms provide a tool for generating new UUIDs, e.g. uuidgen and guidgen. You can also use createUuid(). UUIDs generated by createUuid() are of the random type. Their QUuid::Version bits are set to QUuid::Random, and their QUuid::Variant bits are set to QUuid::DCE. The rest of the UUID is composed of random numbers. Theoretically, this means there is a small chance that a UUID generated by createUuid() will not be unique. But it is a very small chance.

UUIDs can be constructed from numeric values or from strings, or using the static createUuid() function. They can be converted to a string with toString(). UUIDs have a variant() and a version(), and null UUIDs return true from isNull().

source

pub unsafe fn create_uuid() -> CppBox<QUuid>

On any platform other than Windows, this function returns a new UUID with variant QUuid::DCE and version QUuid::Random. If the /dev/urandom device exists, then the numbers used to construct the UUID will be of cryptographic quality, which will make the UUID unique. Otherwise, the numbers of the UUID will be obtained from the local pseudo-random number generator (qrand(), which is seeded by qsrand()) which is usually not of cryptograhic quality, which means that the UUID can't be guaranteed to be unique.

Calls C++ function: static QUuid QUuid::createUuid().

C++ documentation:

On any platform other than Windows, this function returns a new UUID with variant QUuid::DCE and version QUuid::Random. If the /dev/urandom device exists, then the numbers used to construct the UUID will be of cryptographic quality, which will make the UUID unique. Otherwise, the numbers of the UUID will be obtained from the local pseudo-random number generator (qrand(), which is seeded by qsrand()) which is usually not of cryptograhic quality, which means that the UUID can’t be guaranteed to be unique.

On a Windows platform, a GUID is generated, which almost certainly will be unique, on this or any other system, networked or not.

See also variant() and version().

source

pub unsafe fn create_uuid_v3_q_uuid_q_byte_array( ns: impl CastInto<Ref<QUuid>>, base_data: impl CastInto<Ref<QByteArray>> ) -> CppBox<QUuid>

This function returns a new UUID with variant QUuid::DCE and version QUuid::Md5. ns is the namespace and baseData is the basic data as described by RFC 4122.

Calls C++ function: static QUuid QUuid::createUuidV3(const QUuid& ns, const QByteArray& baseData).

C++ documentation:

This function returns a new UUID with variant QUuid::DCE and version QUuid::Md5. ns is the namespace and baseData is the basic data as described by RFC 4122.

This function was introduced in Qt 5.0.

See also variant(), version(), and createUuidV5().

source

pub unsafe fn create_uuid_v3_q_uuid_q_string( ns: impl CastInto<Ref<QUuid>>, base_data: impl CastInto<Ref<QString>> ) -> CppBox<QUuid>

This function returns a new UUID with variant QUuid::DCE and version QUuid::Md5. ns is the namespace and baseData is the basic data as described by RFC 4122.

Calls C++ function: static QUuid QUuid::createUuidV3(const QUuid& ns, const QString& baseData).

C++ documentation:

This function returns a new UUID with variant QUuid::DCE and version QUuid::Md5. ns is the namespace and baseData is the basic data as described by RFC 4122.

This function was introduced in Qt 5.0.

See also variant(), version(), and createUuidV5().

source

pub unsafe fn create_uuid_v5_q_uuid_q_byte_array( ns: impl CastInto<Ref<QUuid>>, base_data: impl CastInto<Ref<QByteArray>> ) -> CppBox<QUuid>

This function returns a new UUID with variant QUuid::DCE and version QUuid::Sha1. ns is the namespace and baseData is the basic data as described by RFC 4122.

Calls C++ function: static QUuid QUuid::createUuidV5(const QUuid& ns, const QByteArray& baseData).

C++ documentation:

This function returns a new UUID with variant QUuid::DCE and version QUuid::Sha1. ns is the namespace and baseData is the basic data as described by RFC 4122.

This function was introduced in Qt 5.0.

See also variant(), version(), and createUuidV3().

source

pub unsafe fn create_uuid_v5_q_uuid_q_string( ns: impl CastInto<Ref<QUuid>>, base_data: impl CastInto<Ref<QString>> ) -> CppBox<QUuid>

This function returns a new UUID with variant QUuid::DCE and version QUuid::Sha1. ns is the namespace and baseData is the basic data as described by RFC 4122.

Calls C++ function: static QUuid QUuid::createUuidV5(const QUuid& ns, const QString& baseData).

C++ documentation:

This function returns a new UUID with variant QUuid::DCE and version QUuid::Sha1. ns is the namespace and baseData is the basic data as described by RFC 4122.

This function was introduced in Qt 5.0.

See also variant(), version(), and createUuidV3().

source

pub unsafe fn data1(&self) -> c_uint

Returns the value of the data1 field.

source

pub unsafe fn data2(&self) -> c_ushort

Returns the value of the data2 field.

source

pub unsafe fn data3(&self) -> c_ushort

Returns the value of the data3 field.

source

pub unsafe fn from_rfc4122( arg1: impl CastInto<Ref<QByteArray>> ) -> CppBox<QUuid>

Creates a QUuid object from the binary representation of the UUID, as specified by RFC 4122 section 4.1.2. See toRfc4122() for a further explanation of the order of bytes required.

Calls C++ function: static QUuid QUuid::fromRfc4122(const QByteArray& arg1).

C++ documentation:

Creates a QUuid object from the binary representation of the UUID, as specified by RFC 4122 section 4.1.2. See toRfc4122() for a further explanation of the order of bytes required.

The byte array accepted is NOT a human readable format.

If the conversion fails, a null UUID is created.

This function was introduced in Qt 4.8.

See also toRfc4122() and QUuid().

source

pub unsafe fn from_string_q_string_view( string: impl CastInto<Ref<QStringView>> ) -> CppBox<QUuid>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Creates a QUuid object from the string text, which must be formatted as five hex fields separated by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where each 'x' is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is returned. See toString() for an explanation of how the five hex fields map to the public data members in QUuid.

Calls C++ function: static QUuid QUuid::fromString(QStringView string).

C++ documentation:

Creates a QUuid object from the string text, which must be formatted as five hex fields separated by ‘-’, e.g., “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}” where each ‘x’ is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is returned. See toString() for an explanation of how the five hex fields map to the public data members in QUuid.

This function was introduced in Qt 5.10.

See also toString() and QUuid().

source

pub unsafe fn from_string_q_latin1_string( string: impl CastInto<Ref<QLatin1String>> ) -> CppBox<QUuid>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: static QUuid QUuid::fromString(QLatin1String string).

C++ documentation:

This is an overloaded function.

Creates a QUuid object from the string text, which must be formatted as five hex fields separated by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where each 'x' is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is returned. See toString() for an explanation of how the five hex fields map to the public data members in QUuid.

This function was introduced in Qt 5.10.

See also toString() and QUuid().

source

pub unsafe fn is_null(&self) -> bool

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

Calls C++ function: bool QUuid::isNull() const.

C++ documentation:

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

source

pub unsafe fn new() -> CppBox<QUuid>

Creates the null UUID. toString() will output the null UUID as "{00000000-0000-0000-0000-000000000000}".

Calls C++ function: [constructor] void QUuid::QUuid().

C++ documentation:

Creates the null UUID. toString() will output the null UUID as “{00000000-0000-0000-0000-000000000000}”.

source

pub unsafe fn from_uint2_ushort8_uchar( l: c_uint, w1: c_ushort, w2: c_ushort, b1: c_uchar, b2: c_uchar, b3: c_uchar, b4: c_uchar, b5: c_uchar, b6: c_uchar, b7: c_uchar, b8: c_uchar ) -> CppBox<QUuid>

Calls C++ function: [constructor] void QUuid::QUuid(unsigned int l, unsigned short w1, unsigned short w2, unsigned char b1, unsigned char b2, unsigned char b3, unsigned char b4, unsigned char b5, unsigned char b6, unsigned char b7, unsigned char b8).

source

pub unsafe fn from_q_string(arg1: impl CastInto<Ref<QString>>) -> CppBox<QUuid>

Creates a QUuid object from the string text, which must be formatted as five hex fields separated by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is created. See toString() for an explanation of how the five hex fields map to the public data members in QUuid.

Calls C++ function: [constructor] void QUuid::QUuid(const QString& arg1).

C++ documentation:

Creates a QUuid object from the string text, which must be formatted as five hex fields separated by ‘-’, e.g., “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}” where ‘x’ is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is created. See toString() for an explanation of how the five hex fields map to the public data members in QUuid.

See also toString() and QUuid().

source

pub unsafe fn from_char(arg1: *const c_char) -> CppBox<QUuid>

Calls C++ function: [constructor] void QUuid::QUuid(const char* arg1).

source

pub unsafe fn from_q_byte_array( arg1: impl CastInto<Ref<QByteArray>> ) -> CppBox<QUuid>

Creates a QUuid object from the QByteArray text, which must be formatted as five hex fields separated by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is created. See toByteArray() for an explanation of how the five hex fields map to the public data members in QUuid.

Calls C++ function: [constructor] void QUuid::QUuid(const QByteArray& arg1).

C++ documentation:

Creates a QUuid object from the QByteArray text, which must be formatted as five hex fields separated by ‘-’, e.g., “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}” where ‘x’ is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is created. See toByteArray() for an explanation of how the five hex fields map to the public data members in QUuid.

This function was introduced in Qt 4.8.

See also toByteArray() and QUuid().

source

pub unsafe fn new_copy(other: impl CastInto<Ref<QUuid>>) -> CppBox<QUuid>

The QUuid class stores a Universally Unique Identifier (UUID).

Calls C++ function: [constructor] void QUuid::QUuid(const QUuid& other).

C++ documentation:

The QUuid class stores a Universally Unique Identifier (UUID).

Using Universally Unique IDentifiers (UUID) is a standard way to uniquely identify entities in a distributed computing environment. A UUID is a 16-byte (128-bit) number generated by some algorithm that is meant to guarantee that the UUID will be unique in the distributed computing environment where it is used. The acronym GUID is often used instead, Globally Unique IDentifiers, but it refers to the same thing.

Actually, the GUID is one variant of UUID. Multiple variants are in use. Each UUID contains a bit field that specifies which type (variant) of UUID it is. Call variant() to discover which type of UUID an instance of QUuid contains. It extracts the three most significant bits of byte 8 of the 16 bytes. In QUuid, byte 8 is QUuid::data4[0]. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the three most significant bits of parameter b1, which becomes QUuid::data4[0] and contains the variant field in its three most significant bits. In the table, 'x' means don't care.

msb0msb1msb2Variant
0xxNCS (Network Computing System)
10xDCE (Distributed Computing Environment)
110Microsoft (GUID)
111Reserved for future expansion

If variant() returns QUuid::DCE, the UUID also contains a version field in the four most significant bits of QUuid::data3, and you can call version() to discover which version your QUuid contains. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the four most significant bits of parameter w2, which becomes QUuid::data3 and contains the version field in its four most significant bits.

msb0msb1msb2msb3Version
0001Time
0010Embedded POSIX
0011Md5(Name)
0100Random
0101Sha1

The field layouts for the DCE versions listed in the table above are specified in the Network Working Group UUID Specification.

Most platforms provide a tool for generating new UUIDs, e.g. uuidgen and guidgen. You can also use createUuid(). UUIDs generated by createUuid() are of the random type. Their QUuid::Version bits are set to QUuid::Random, and their QUuid::Variant bits are set to QUuid::DCE. The rest of the UUID is composed of random numbers. Theoretically, this means there is a small chance that a UUID generated by createUuid() will not be unique. But it is a very small chance.

UUIDs can be constructed from numeric values or from strings, or using the static createUuid() function. They can be converted to a string with toString(). UUIDs have a variant() and a version(), and null UUIDs return true from isNull().

source

pub unsafe fn set_data1(&self, value: c_uint)

Sets the value of the data1 field.

source

pub unsafe fn set_data2(&self, value: c_ushort)

Sets the value of the data2 field.

source

pub unsafe fn set_data3(&self, value: c_ushort)

Sets the value of the data3 field.

source

pub unsafe fn to_byte_array_0a(&self) -> CppBox<QByteArray>

Returns the binary representation of this QUuid. The byte array is formatted as five hex fields separated by '-' and enclosed in curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit. From left to right, the five hex fields are obtained from the four public data members in QUuid as follows:

Calls C++ function: QByteArray QUuid::toByteArray() const.

C++ documentation:

Returns the binary representation of this QUuid. The byte array is formatted as five hex fields separated by ‘-’ and enclosed in curly braces, i.e., “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}” where ‘x’ is a hex digit. From left to right, the five hex fields are obtained from the four public data members in QUuid as follows:

Field #Source
1data1
2data2
3data3
4data4[0] .. data4[1]
5data4[2] .. data4[7]

This function was introduced in Qt 4.8.

source

pub unsafe fn to_byte_array_1a(&self, mode: StringFormat) -> CppBox<QByteArray>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the string representation of this QUuid, with the formattiong controlled by the mode parameter. From left to right, the five hex fields are obtained from the four public data members in QUuid as follows:

Calls C++ function: QByteArray QUuid::toByteArray(QUuid::StringFormat mode) const.

C++ documentation:

Returns the string representation of this QUuid, with the formattiong controlled by the mode parameter. From left to right, the five hex fields are obtained from the four public data members in QUuid as follows:

Field #Source
1data1
2data2
3data3
4data4[0] .. data4[1]
5data4[2] .. data4[7]

This function was introduced in Qt 5.11.

source

pub unsafe fn to_rfc4122(&self) -> CppBox<QByteArray>

Returns the binary representation of this QUuid. The byte array is in big endian format, and formatted according to RFC 4122, section 4.1.2 - "Layout and byte order".

Calls C++ function: QByteArray QUuid::toRfc4122() const.

C++ documentation:

Returns the binary representation of this QUuid. The byte array is in big endian format, and formatted according to RFC 4122, section 4.1.2 - “Layout and byte order”.

The order is as follows:

Field #Source
1data1
2data2
3data3
4data4[0] .. data4[7]

This function was introduced in Qt 4.8.

source

pub unsafe fn to_string_0a(&self) -> CppBox<QString>

Returns the string representation of this QUuid. The string is formatted as five hex fields separated by '-' and enclosed in curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit. From left to right, the five hex fields are obtained from the four public data members in QUuid as follows:

Calls C++ function: QString QUuid::toString() const.

C++ documentation:

Returns the string representation of this QUuid. The string is formatted as five hex fields separated by ‘-’ and enclosed in curly braces, i.e., “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}” where ‘x’ is a hex digit. From left to right, the five hex fields are obtained from the four public data members in QUuid as follows:

Field #Source
1data1
2data2
3data3
4data4[0] .. data4[1]
5data4[2] .. data4[7]
source

pub unsafe fn to_string_1a(&self, mode: StringFormat) -> CppBox<QString>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the string representation of this QUuid, with the formattiong controlled by the mode parameter. From left to right, the five hex fields are obtained from the four public data members in QUuid as follows:

Calls C++ function: QString QUuid::toString(QUuid::StringFormat mode) const.

C++ documentation:

Returns the string representation of this QUuid, with the formattiong controlled by the mode parameter. From left to right, the five hex fields are obtained from the four public data members in QUuid as follows:

Field #Source
1data1
2data2
3data3
4data4[0] .. data4[1]
5data4[2] .. data4[7]

This function was introduced in Qt 5.11.

source

pub unsafe fn variant(&self) -> Variant

Returns the value in the variant field of the UUID. If the return value is QUuid::DCE, call version() to see which layout it uses. The null UUID is considered to be of an unknown variant.

Calls C++ function: QUuid::Variant QUuid::variant() const.

C++ documentation:

Returns the value in the variant field of the UUID. If the return value is QUuid::DCE, call version() to see which layout it uses. The null UUID is considered to be of an unknown variant.

See also version().

source

pub unsafe fn version(&self) -> Version

Returns the version field of the UUID, if the UUID's variant field is QUuid::DCE. Otherwise it returns QUuid::VerUnknown.

Calls C++ function: QUuid::Version QUuid::version() const.

C++ documentation:

Returns the version field of the UUID, if the UUID’s variant field is QUuid::DCE. Otherwise it returns QUuid::VerUnknown.

See also variant().

Trait Implementations§

source§

impl CppDeletable for QUuid

source§

unsafe fn delete(&self)

The QUuid class stores a Universally Unique Identifier (UUID).

Calls C++ function: [destructor] void QUuid::~QUuid().

C++ documentation:

The QUuid class stores a Universally Unique Identifier (UUID).

Using Universally Unique IDentifiers (UUID) is a standard way to uniquely identify entities in a distributed computing environment. A UUID is a 16-byte (128-bit) number generated by some algorithm that is meant to guarantee that the UUID will be unique in the distributed computing environment where it is used. The acronym GUID is often used instead, Globally Unique IDentifiers, but it refers to the same thing.

Actually, the GUID is one variant of UUID. Multiple variants are in use. Each UUID contains a bit field that specifies which type (variant) of UUID it is. Call variant() to discover which type of UUID an instance of QUuid contains. It extracts the three most significant bits of byte 8 of the 16 bytes. In QUuid, byte 8 is QUuid::data4[0]. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the three most significant bits of parameter b1, which becomes QUuid::data4[0] and contains the variant field in its three most significant bits. In the table, 'x' means don't care.

msb0msb1msb2Variant
0xxNCS (Network Computing System)
10xDCE (Distributed Computing Environment)
110Microsoft (GUID)
111Reserved for future expansion

If variant() returns QUuid::DCE, the UUID also contains a version field in the four most significant bits of QUuid::data3, and you can call version() to discover which version your QUuid contains. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the four most significant bits of parameter w2, which becomes QUuid::data3 and contains the version field in its four most significant bits.

msb0msb1msb2msb3Version
0001Time
0010Embedded POSIX
0011Md5(Name)
0100Random
0101Sha1

The field layouts for the DCE versions listed in the table above are specified in the Network Working Group UUID Specification.

Most platforms provide a tool for generating new UUIDs, e.g. uuidgen and guidgen. You can also use createUuid(). UUIDs generated by createUuid() are of the random type. Their QUuid::Version bits are set to QUuid::Random, and their QUuid::Variant bits are set to QUuid::DCE. The rest of the UUID is composed of random numbers. Theoretically, this means there is a small chance that a UUID generated by createUuid() will not be unique. But it is a very small chance.

UUIDs can be constructed from numeric values or from strings, or using the static createUuid() function. They can be converted to a string with toString(). UUIDs have a variant() and a version(), and null UUIDs return true from isNull().

source§

impl Ge<Ref<QUuid>> for QUuid

source§

unsafe fn ge(&self, rhs: &Ref<QUuid>) -> bool

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

Calls C++ function: bool operator>=(const QUuid& lhs, const QUuid& rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator>=(QChar c1, QChar c2):

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

source§

impl Gt<Ref<QUuid>> for QUuid

source§

unsafe fn gt(&self, other: &Ref<QUuid>) -> bool

Returns true if this QUuid has the same variant field as the other QUuid and is lexicographically after the other QUuid. If the other QUuid has a different variant field, the return value is determined by comparing the two variants.

Calls C++ function: bool QUuid::operator>(const QUuid& other) const.

C++ documentation:

Returns true if this QUuid has the same variant field as the other QUuid and is lexicographically after the other QUuid. If the other QUuid has a different variant field, the return value is determined by comparing the two variants.

See also variant().

source§

impl Le<Ref<QUuid>> for QUuid

source§

unsafe fn le(&self, rhs: &Ref<QUuid>) -> bool

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

Calls C++ function: bool operator<=(const QUuid& lhs, const QUuid& rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator<=(QChar c1, QChar c2):

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

source§

impl Lt<Ref<QUuid>> for QUuid

source§

unsafe fn lt(&self, other: &Ref<QUuid>) -> bool

Returns true if this QUuid has the same variant field as the other QUuid and is lexicographically before the other QUuid. If the other QUuid has a different variant field, the return value is determined by comparing the two variants.

Calls C++ function: bool QUuid::operator<(const QUuid& other) const.

C++ documentation:

Returns true if this QUuid has the same variant field as the other QUuid and is lexicographically before the other QUuid. If the other QUuid has a different variant field, the return value is determined by comparing the two variants.

See also variant().

source§

impl PartialEq<Ref<QUuid>> for QUuid

source§

fn eq(&self, orig: &Ref<QUuid>) -> bool

Returns true if this QUuid and the other QUuid are identical; otherwise returns false.

Calls C++ function: bool QUuid::operator==(const QUuid& orig) const.

C++ documentation:

Returns true if this QUuid and the other QUuid are identical; otherwise returns false.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl RefUnwindSafe for QUuid

§

impl Send for QUuid

§

impl Sync for QUuid

§

impl Unpin for QUuid

§

impl UnwindSafe for QUuid

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.