Qt Jambi Home

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.Comparable

public class QUuid
extends QtJambiObject
implements java.lang.Comparable

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
          This enum defines the variant of the UUID, which is the scheme which defines the layout of the 128-bits value.
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<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
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 arg__1.
 
Method Summary
 int compareTo(java.lang.Object other)
          
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()
          Returns the data of this QUuid.
 boolean equals(java.lang.Object other)
          
static QUuid fromNativePointer(QNativePointer nativePointer)
          This function 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 from arg__1.
 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)
          Sets the data of this QUuid to data4.
 java.lang.String toString()
          Returns the string representation of the uuid.
 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 to arg__1.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, 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
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QUuid

public QUuid(java.lang.String arg__1)

Creates a QUuid object from the string arg__1. 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()

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


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(0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 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 to arg__1.


readFrom

public final void readFrom(QDataStream arg__1)
Reads a QUuid from arg__1.


toString

public final java.lang.String toString()

Returns the string representation of the uuid.

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, 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)
Sets the data of this QUuid to data4.


data4

public final byte[] data4()
Returns the data of this QUuid.


fromNativePointer

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

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

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

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object other)

Specified by:
compareTo in interface java.lang.Comparable

Qt Jambi Home