com.trolltech.qt.core
Class QUuid

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QUuid
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable, java.lang.Comparable

public class QUuid
extends QtJambiObject
implements java.lang.Comparable, java.lang.Cloneable

The QUuid class stores 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 Qt, UUIDs are wrapped by the QUuid 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 QUuid, 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().


Nested Class Summary
static class QUuid.Variant
           
static class QUuid.Version
          This enum defines the version of the UUID.
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Constructor Summary
QUuid()
          Creates the null UUID {00000000-0000-0000-0000-000000000000}.
QUuid(int l, char w1, char w2, byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8)
          Creates a UUID with the value specified by the parameters, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8.
QUuid(java.lang.String arg__1)
          Creates a QUuid object from the string text.
 
Method Summary
 QUuid clone()
          This method is reimplemented for internal reasons
static QUuid createUuid()
          Returns a new UUID of DCE variant, and Random type.
 int data1()
          Returns the data of this QUuid.
 char data2()
          Returns the data of this QUuid.
 char data3()
          Returns the data of this QUuid.
 byte[] data4()
           
static QUuid fromNativePointer(QNativePointer nativePointer)
          This method returns the QUuid instance pointed to by nativePointer.
 boolean isNull()
          Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false.
static QNativePointer nativePointerArray(QUuid[] array)
          This function returns a QNativePointer that is pointing to the specified QUuid array.
 void readFrom(QDataStream arg__1)
          Reads a QUuid
 void setData1(int data1)
          Sets the data of this QUuid to data1.
 void setData2(char data2)
          Sets the data of this QUuid to data2.
 void setData3(char data3)
          Sets the data of this QUuid to data3.
 void setData4(byte[] data4)
           
 java.lang.String toString()
          Returns a string representation of the this QUuid.
 QUuid.Variant variant()
          Returns the variant of the UUID.
 QUuid.Version version()
          Returns the version of the UUID, if the UUID is of the DCE variant; otherwise returns VerUnknown .
 void writeTo(QDataStream arg__1)
          Writes thisQUuid
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QUuid

public QUuid()
Creates the null UUID {00000000-0000-0000-0000-000000000000}.


QUuid

public QUuid(java.lang.String arg__1)
Creates a QUuid 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.


QUuid

public QUuid(int l,
             char w1,
             char w2,
             byte b1,
             byte b2,
             byte b3,
             byte b4,
             byte b5,
             byte b6,
             byte b7,
             byte 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}
    QUuid IID_MyInterface = new QUuid(0x67c8770b, (char) 0x44f1, (char) 0x410a, (byte) 0xab,
                      (byte) 0x9a, (byte) 0xf9, (byte) 0xb5, (byte) 0x44,
                      (byte) 0x6f, (byte) 0x13, (byte) 0xee);

Method Detail

isNull

public final boolean isNull()
Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false.


writeTo

public final void writeTo(QDataStream arg__1)
Writes thisQUuid


readFrom

public final void readFrom(QDataStream arg__1)
Reads a QUuid


toString

public final java.lang.String toString()
Returns a string representation of the this QUuid.

Overrides:
toString in class java.lang.Object

variant

public final QUuid.Variant variant()
Returns the variant of the UUID. The null UUID is considered to be of an unknown variant.

See also:
version().


version

public final QUuid.Version version()
Returns the version of the UUID, if the UUID is of the DCE variant; otherwise returns VerUnknown .

See also:
variant().


createUuid

public static QUuid createUuid()
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().


setData1

public final void setData1(int data1)
Sets the data of this QUuid to data1.


data1

public final int data1()
Returns the data of this QUuid.


setData2

public final void setData2(char data2)
Sets the data of this QUuid to data2.


data2

public final char data2()
Returns the data of this QUuid.


setData3

public final void setData3(char data3)
Sets the data of this QUuid to data3.


data3

public final char data3()
Returns the data of this QUuid.


setData4

public final void setData4(byte[] data4)

data4

public final byte[] data4()

fromNativePointer

public static QUuid fromNativePointer(QNativePointer nativePointer)
This method returns the QUuid instance pointed to by nativePointer.


nativePointerArray

public static QNativePointer nativePointerArray(QUuid[] array)
This function returns a QNativePointer that is pointing to the specified QUuid array.


clone

public QUuid clone()
This method is reimplemented for internal reasons

Overrides:
clone in class java.lang.Object