TQUuid Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQUuid Class Reference

The TQUuid class defines a Universally Unique Identifier (UUID). More...

All the functions in this class are reentrant when TQt is built with thread support.

`#include <ntquuid.h>`

List of all member functions.

## Public Members

- enum Variant { VarUnknown = -1, NCS = 0, DCE = 2, Microsoft = 6, Reserved = 7 }
- enum Version { VerUnknown = -1, Time = 1, EmbeddedPOSIX = 2, Name = 3, Random = 4 }
- TQUuid ()
- TQUuid ( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 )
- TQUuid ( const TQUuid & orig )
- TQUuid ( const TQString & text )
- TQString toString () const
- operator TQString () const
- bool isNull () const
- TQUuid & operator= ( const TQUuid & uuid )
- bool operator== ( const TQUuid & other ) const
- bool operator!= ( const TQUuid & other ) const
- bool operator< ( const TQUuid & other ) const
- bool operator> ( const TQUuid & other ) const
- TQUuid::Variant variant () const
- TQUuid::Version version () const

## Static Public Members

- TQUuid createUuid ()

## Related Functions

- TQDataStream & operator<< ( TQDataStream & s, const TQUuid & id )
- TQDataStream & operator>> ( TQDataStream & s, TQUuid & id )

## Detailed Description

The TQUuid class defines a Universally Unique Identifier (UUID).

For objects or declarations that must be uniquely identified, UUIDs (also known as GUIDs) are widely used in order to assign a fixed and easy to compare value to the object or declaration. The 128-bit value of a UUID is generated by an algorithm that guarantees that the value is unique.

In TQt, UUIDs are wrapped by the TQUuid struct which provides convenience functions for handling UUIDs. Most platforms provide a tool to generate new UUIDs, for example, uuidgen and guidgen.

UUIDs generated by TQUuid, are based on the Random version of the DCE (Distributed Computing Environment) standard.

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().

## Member Type Documentation

### TQUuid::Variant

This enum defines the variant of the UUID, which is the scheme which defines the layout of the 128-bits value.

- `TQUuid::VarUnknown` - Variant is unknown
- `TQUuid::NCS` - Reserved for NCS (Network Computing System) backward compatibility
- `TQUuid::DCE` - Distributed Computing Environment, the scheme used by TQUuid
- `TQUuid::Microsoft` - Reserved for Microsoft backward compatibility (GUID)
- `TQUuid::Reserved` - Reserved for future definition

### TQUuid::Version

This enum defines the version of the UUID.

- `TQUuid::VerUnknown` - Version is unknown
- `TQUuid::Time` - Time-based, by using timestamp, clock sequence, and MAC network card address (if available) for the node sections
- `TQUuid::EmbeddedPOSIX` - DCE Security version, with embedded POSIX UUIDs
- `TQUuid::Name` - Name-based, by using values from a name for all sections
- `TQUuid::Random` - Random-based, by using random numbers for all sections

## Member Function Documentation

### TQUuid::TQUuid ()

Creates the null UUID {00000000-0000-0000-0000-000000000000}.

### TQUuid::TQUuid ( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 )

Creates a UUID with the value specified by the parameters, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8.

Example:

        // {67C8770B-44F1-410A-AB9A-F9B5446F13EE}
        TQUuid IID_MyInterface( 0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 0xee )

### TQUuid::TQUuid ( const TQUuid & orig )

Creates a copy of the TQUuid orig.

### TQUuid::TQUuid ( const TQString & text )

Creates a TQUuid object from the string text. The function can only convert a string in the format {HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH} (where 'H' stands for a hex digit). If the conversion fails a null UUID is created.

### TQUuid TQUuid::createUuid ()`[static]`

Returns a new UUID of DCE variant, and Random type. The UUIDs generated are based on the platform specific pseudo-random generator, which is usually not a cryptographic-quality random number generator. Therefore, a UUID is not guaranteed to be unique cross application instances.

On Windows, the new UUID is extremely likely to be unique on the same or any other system, networked or not.

See also variant() and version().

### bool TQUuid::isNull () const

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

### TQUuid::operator TQString () const

Returns the string representation of the uuid.

See also toString().

### bool TQUuid::operator!= ( const TQUuid & other ) const

Returns true if this TQUuid and the other TQUuid are different; otherwise returns false.

### bool TQUuid::operator< ( const TQUuid & other ) const

Returns true if this TQUuid is of the same variant, and lexicographically before the other TQUuid; otherwise returns false.

See also variant().

### TQUuid & TQUuid::operator= ( const TQUuid & uuid )

Assigns the value of uuid to this TQUuid object.

### bool TQUuid::operator== ( const TQUuid & other ) const

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

### bool TQUuid::operator> ( const TQUuid & other ) const

Returns true if this TQUuid is of the same variant, and lexicographically after the other TQUuid; otherwise returns false.

See also variant().

### TQString TQUuid::toString () const

TQString TQUuid::toString() const

Returns the string representation of the uuid.

### TQUuid::Variant TQUuid::variant () const

Returns the variant of the UUID. The null UUID is considered to be of an unknown variant.

See also version().

### TQUuid::Version TQUuid::version () const

Returns the version of the UUID, if the UUID is of the DCE variant; otherwise returns VerUnknown.

See also variant().

## Related Functions

### TQDataStream & operator<< ( TQDataStream & s, const TQUuid & id )

Writes the uuid id to the datastream s.

### TQDataStream & operator>> ( TQDataStream & s, TQUuid & id )

Reads uuid from from the stream s into id.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.