Home · All Classes · Grouped Classes · Annotated · Functions

QUniqueId Class Reference

The QUniqueId class provides an identifier that is unique and yet can be stored efficiently. More...

    #include <QUniqueId>

Public Functions

Static Public Members

Protected Functions


Detailed Description

The QUniqueId class provides an identifier that is unique and yet can be stored efficiently.

The unique identifiers are 32 bits and are unique within the device they is created upon. If you require an identifier that is unique across multiple devices use QUuid instead. The QUniqueId objects are composed of an 8 bit context representing the data source that created them and a 24 bit index component. The unique identifiers are intended for record identifiers such as user contacts. Given the limited space of identifiers they are unsuitable for use as identifiers that might get created on the order of thousands per day.

The context identifier should be generated with a program such as uuidgen and represent the data store or context within which the identifier is generated. For example SQL, and SIM card storage for QContacts each have their own context.

See also QUniqueIdGenerator.


Member Function Documentation

QUniqueId::QUniqueId ()

Constructs a null QUniqueId.

QUniqueId::QUniqueId ( const QUniqueId & other )

Constructs a copy of other.

QUniqueId::QUniqueId ( const QString & string )

Constructs a QUniqueId based on the given string.

QUniqueId::QUniqueId ( const QByteArray & array )

Constructs a QUniqueId based on the given array.

QUuid QUniqueId::context () const

Returns the context component of the identifier.

See also index().

QDataStream & QUniqueId::fromLocalContextDataStream ( QDataStream & stream )   [protected]

Reads the identifier from the given stream, and returns a reference to the stream. This function is not suitable for streaming data from another device or from a file that may have been transferred from another device.

QUniqueId QUniqueId::fromUInt ( uint value )   [static]

Converts the packed value to a QUniqueId,

See also toUInt().

uint QUniqueId::index () const

Returns the index component of the identifier.

See also context().

bool QUniqueId::isNull () const

Returns true if the identifier is null. Otherwise returns false.

bool QUniqueId::isTemporary () const

Returns true if this is a temporary identifier, otherwise returns false.

Temporary identifiers are scoped so as not to conflict with other identifiers.

They are suitable for working with data sets when the identifiers are not intended to be permanent.

uint QUniqueId::mappedContext () const

Returns a locally mapped integer value for the context of the id. This is useful for efficiently checking if a QUniqueId was generated from an equivalent QUniqueIdGenerator.

See also QUniqueIdGenerator::mappedContext().

QByteArray QUniqueId::toByteArray () const

Converts the identifier to a byte array. The byte array contains the expanded form of the context. This allows the identifier to be backed up independent of the internal mapping of context QUuid to the internal context component.

See also toLocalContextByteArray().

QByteArray QUniqueId::toLocalContextByteArray () const

Converts the identifier to a byte array. The mapped representation of the context will be written rather than the expanded QUuid. If the tracking or generating file is reset this byte array won't be usable to gain the original id.

See also toByteArray().

QDataStream & QUniqueId::toLocalContextDataStream ( QDataStream & stream ) const   [protected]

Writes the identifier to the given stream, and returns a reference to the stream. This function is not suitable for streaming data to another device or to a file that may be transferred to another device.

QString QUniqueId::toLocalContextString () const

Converts the identifier to a string. This string will only include latin1 characters, and will contains the mapped context. If the tracking or generating file is reset this string won't be usable to gain the original id.

See also toString().

QString QUniqueId::toString () const

Converts the identifier to a string. This string will only include latin1 characters and contains the expanded form of the context. This allows the identifier to be backed up independent of the internal mapping of context QUuid to the internal context component.

See also toLocalContextString().

uint QUniqueId::toUInt () const

Converts the identifier to a packed value containing both the context and index components of the identifier.

See also fromUInt().

bool QUniqueId::operator!= ( const QUniqueId & i ) const

Returns true if the identifier is not equal to i. Otherwise returns false.

bool QUniqueId::operator< ( QUniqueId i ) const

Returns true if the identifier is less than i. Otherwise returns false.

bool QUniqueId::operator<= ( QUniqueId i ) const

Returns true if the identifier is less than or equal to i. Otherwise returns false.

QUniqueId QUniqueId::operator= ( const QUniqueId & o )

Assigns the value of identifier o to this identifier.

bool QUniqueId::operator== ( const QUniqueId & i ) const

Returns true if the identifier is equal to i. Otherwise returns false.

bool QUniqueId::operator> ( QUniqueId i ) const

Returns true if the identifier is greater than i. Otherwise returns false.

bool QUniqueId::operator>= ( QUniqueId i ) const

Returns true if the identifier is greater than or equal to i. Otherwise returns false.


Copyright © 2008 Nokia Trademarks
Qtopia 4.3.3