1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/corelib/plugin/quuid.cpp -->
7
<title>Qt 4.0: QUuid Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QUuid Class Reference</h1>
21
<p>The QUuid class stores a Universally Unique Identifier (UUID). <a href="#details">More...</a></p>
22
<pre>#include <QUuid></pre><p>Part of the <a href="qtcore.html">QtCore</a> module.</p>
23
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
25
<li><a href="quuid-members.html">List of all members, including inherited members</a></li>
27
<a name="public-types"></a>
30
<li><div class="fn"/>enum <b><a href="quuid.html#Variant-enum">Variant</a></b> { VarUnknown, NCS, DCE, Microsoft, Reserved }</li>
31
<li><div class="fn"/>enum <b><a href="quuid.html#Version-enum">Version</a></b> { VerUnknown, Time, EmbeddedPOSIX, Name, Random }</li>
33
<a name="public-functions"></a>
34
<h3>Public Functions</h3>
36
<li><div class="fn"/><b><a href="quuid.html#QUuid">QUuid</a></b> ()</li>
37
<li><div class="fn"/><b><a href="quuid.html#QUuid-2">QUuid</a></b> ( uint <i>l</i>, ushort <i>w1</i>, ushort <i>w2</i>, uchar <i>b1</i>, uchar <i>b2</i>, uchar <i>b3</i>, uchar <i>b4</i>, uchar <i>b5</i>, uchar <i>b6</i>, uchar <i>b7</i>, uchar <i>b8</i> )</li>
38
<li><div class="fn"/><b><a href="quuid.html#QUuid-3">QUuid</a></b> ( const QString & <i>text</i> )</li>
39
<li><div class="fn"/><b><a href="quuid.html#QUuid-5">QUuid</a></b> ( const GUID & <i>guid</i> )</li>
40
<li><div class="fn"/>bool <b><a href="quuid.html#isNull">isNull</a></b> () const</li>
41
<li><div class="fn"/>QString <b><a href="quuid.html#toString">toString</a></b> () const</li>
42
<li><div class="fn"/>QUuid::Variant <b><a href="quuid.html#variant">variant</a></b> () const</li>
43
<li><div class="fn"/>QUuid::Version <b><a href="quuid.html#version">version</a></b> () const</li>
44
<li><div class="fn"/><b><a href="quuid.html#operator-GUID">operator GUID</a></b> () const</li>
45
<li><div class="fn"/><b><a href="quuid.html#operator-QString">operator QString</a></b> () const</li>
46
<li><div class="fn"/>bool <b><a href="quuid.html#operator-not-eq">operator!=</a></b> ( const QUuid & <i>other</i> ) const</li>
47
<li><div class="fn"/>bool <b><a href="quuid.html#operator-not-eq-2">operator!=</a></b> ( const GUID & <i>guid</i> ) const</li>
48
<li><div class="fn"/>bool <b><a href="quuid.html#operator-lt">operator<</a></b> ( const QUuid & <i>other</i> ) const</li>
49
<li><div class="fn"/>QUuid & <b><a href="quuid.html#operator-eq">operator=</a></b> ( const GUID & <i>guid</i> )</li>
50
<li><div class="fn"/>bool <b><a href="quuid.html#operator-eq-eq">operator==</a></b> ( const QUuid & <i>other</i> ) const</li>
51
<li><div class="fn"/>bool <b><a href="quuid.html#operator-eq-eq-2">operator==</a></b> ( const GUID & <i>guid</i> ) const</li>
52
<li><div class="fn"/>bool <b><a href="quuid.html#operator-gt">operator></a></b> ( const QUuid & <i>other</i> ) const</li>
54
<a name="static-public-members"></a>
55
<h3>Static Public Members</h3>
57
<li><div class="fn"/>QUuid <b><a href="quuid.html#createUuid">createUuid</a></b> ()</li>
59
<a name="related-non-members"></a>
60
<h3>Related Non-Members</h3>
62
<li><div class="fn"/>QDataStream & <b><a href="quuid.html#operator-lt-lt-24">operator<<</a></b> ( QDataStream & <i>s</i>, const QUuid & <i>id</i> )</li>
63
<li><div class="fn"/>QDataStream & <b><a href="quuid.html#operator-gt-gt-15">operator>></a></b> ( QDataStream & <i>s</i>, QUuid & <i>id</i> )</li>
65
<a name="details"></a>
67
<h2>Detailed Description</h2>
68
<p>The QUuid class stores a Universally Unique Identifier (UUID).</p>
69
<p>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.</p>
70
<p>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, <tt>uuidgen</tt> and <tt>guidgen</tt>.</p>
71
<p>UUIDs generated by QUuid, are based on the <tt>Random</tt> version of the <tt>DCE</tt> (Distributed Computing Environment) standard.</p>
72
<p>UUIDs can be constructed from numeric values or from strings, or using the static <a href="quuid.html#createUuid">createUuid</a>() function. They can be converted to a string with <a href="quuid.html#toString">toString</a>(). UUIDs have a <a href="quuid.html#variant">variant</a>() and a <a href="quuid.html#version">version</a>(), and null UUIDs return true from <a href="quuid.html#isNull">isNull</a>().</p>
74
<h2>Member Type Documentation</h2>
75
<h3 class="fn"><a name="Variant-enum"></a>enum QUuid::Variant</h3>
76
<p>This enum defines the variant of the UUID, which is the scheme which defines the layout of the 128-bits value.</p>
77
<table border="1" cellpadding="2" cellspacing="1" width="100%">
78
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
79
<tr><td valign="top"><tt>QUuid::VarUnknown</tt></td><td align="center" valign="top"><tt>-1</tt></td><td valign="top">Variant is unknown</td></tr>
80
<tr><td valign="top"><tt>QUuid::NCS</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Reserved for NCS (Network Computing System) backward compatibility</td></tr>
81
<tr><td valign="top"><tt>QUuid::DCE</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Distributed Computing Environment, the scheme used by <a href="quuid.html">QUuid</a></td></tr>
82
<tr><td valign="top"><tt>QUuid::Microsoft</tt></td><td align="center" valign="top"><tt>6</tt></td><td valign="top">Reserved for Microsoft backward compatibility (GUID)</td></tr>
83
<tr><td valign="top"><tt>QUuid::Reserved</tt></td><td align="center" valign="top"><tt>7</tt></td><td valign="top">Reserved for future definition</td></tr>
85
<h3 class="fn"><a name="Version-enum"></a>enum QUuid::Version</h3>
86
<p>This enum defines the version of the UUID.</p>
87
<table border="1" cellpadding="2" cellspacing="1" width="100%">
88
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
89
<tr><td valign="top"><tt>QUuid::VerUnknown</tt></td><td align="center" valign="top"><tt>-1</tt></td><td valign="top">Version is unknown</td></tr>
90
<tr><td valign="top"><tt>QUuid::Time</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Time-based, by using timestamp, clock sequence, and MAC network card address (if available) for the node sections</td></tr>
91
<tr><td valign="top"><tt>QUuid::EmbeddedPOSIX</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">DCE Security version, with embedded POSIX UUIDs</td></tr>
92
<tr><td valign="top"><tt>QUuid::Name</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Name-based, by using values from a name for all sections</td></tr>
93
<tr><td valign="top"><tt>QUuid::Random</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">Random-based, by using random numbers for all sections</td></tr>
96
<h2>Member Function Documentation</h2>
97
<h3 class="fn"><a name="QUuid"></a>QUuid::QUuid ()</h3>
98
<p>Creates the null UUID {00000000-0000-0000-0000-000000000000}.</p>
99
<h3 class="fn"><a name="QUuid-2"></a>QUuid::QUuid ( <a href="qtglobal.html#uint-typedef">uint</a> <i>l</i>, <a href="qtglobal.html#ushort-typedef">ushort</a> <i>w1</i>, <a href="qtglobal.html#ushort-typedef">ushort</a> <i>w2</i>, <a href="qtglobal.html#uchar-typedef">uchar</a> <i>b1</i>, <a href="qtglobal.html#uchar-typedef">uchar</a> <i>b2</i>, <a href="qtglobal.html#uchar-typedef">uchar</a> <i>b3</i>, <a href="qtglobal.html#uchar-typedef">uchar</a> <i>b4</i>, <a href="qtglobal.html#uchar-typedef">uchar</a> <i>b5</i>, <a href="qtglobal.html#uchar-typedef">uchar</a> <i>b6</i>, <a href="qtglobal.html#uchar-typedef">uchar</a> <i>b7</i>, <a href="qtglobal.html#uchar-typedef">uchar</a> <i>b8</i> )</h3>
100
<p>Creates a UUID with the value specified by the parameters, <i>l</i>, <i>w1</i>, <i>w2</i>, <i>b1</i>, <i>b2</i>, <i>b3</i>, <i>b4</i>, <i>b5</i>, <i>b6</i>, <i>b7</i>, <i>b8</i>.</p>
102
<pre> // {67C8770B-44F1-410A-AB9A-F9B5446F13EE}
103
QUuid IID_MyInterface(0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 0xee)</pre>
104
<h3 class="fn"><a name="QUuid-3"></a>QUuid::QUuid ( const <a href="qstring.html">QString</a> & <i>text</i> )</h3>
105
<p>Creates a <a href="quuid.html">QUuid</a> object from the string <i>text</i>. 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.</p>
106
<h3 class="fn"><a name="QUuid-5"></a>QUuid::QUuid ( const GUID & <i>guid</i> )</h3>
107
<p>Casts a Windows <i>guid</i> to a Qt <a href="quuid.html">QUuid</a>.</p>
108
<p><b>Warning:</b> This function is only for Windows platforms.</p>
109
<h3 class="fn"><a name="createUuid"></a>QUuid QUuid::createUuid () <tt> [static]</tt></h3>
110
<p>Returns a new UUID of <tt>DCE</tt> variant, and <tt>Random</tt> 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.</p>
111
<p>On Windows, the new UUID is extremely likely to be unique on the same or any other system, networked or not.</p>
112
<p>See also <a href="quuid.html#variant">variant</a>() and <a href="quuid.html#version">version</a>().</p>
113
<h3 class="fn"><a name="isNull"></a>bool QUuid::isNull () const</h3>
114
<p>Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false.</p>
115
<h3 class="fn"><a name="toString"></a><a href="qstring.html">QString</a> QUuid::toString () const</h3>
116
<p>Returns the string representation of the uuid.</p>
117
<h3 class="fn"><a name="variant"></a><a href="quuid.html#Variant-enum">QUuid::Variant</a> QUuid::variant () const</h3>
118
<p>Returns the variant of the UUID. The null UUID is considered to be of an unknown variant.</p>
119
<p>See also <a href="quuid.html#version">version</a>().</p>
120
<h3 class="fn"><a name="version"></a><a href="quuid.html#Version-enum">QUuid::Version</a> QUuid::version () const</h3>
121
<p>Returns the version of the UUID, if the UUID is of the DCE variant; otherwise returns <a href="quuid.html#Version-enum">VerUnknown</a>.</p>
122
<p>See also <a href="quuid.html#variant">variant</a>().</p>
123
<h3 class="fn"><a name="operator-GUID"></a>QUuid::operator GUID () const</h3>
124
<p>Returns a Windows GUID from a <a href="quuid.html">QUuid</a>.</p>
125
<p><b>Warning:</b> This function is only for Windows platforms.</p>
126
<h3 class="fn"><a name="operator-QString"></a>QUuid::operator QString () const</h3>
127
<p>Returns the string representation of the uuid.</p>
128
<p>See also <a href="quuid.html#toString">toString</a>().</p>
129
<h3 class="fn"><a name="operator-not-eq"></a>bool QUuid::operator!= ( const QUuid & <i>other</i> ) const</h3>
130
<p>Returns true if this <a href="quuid.html">QUuid</a> and the <i>other</i> <a href="quuid.html">QUuid</a> are different; otherwise returns false.</p>
131
<h3 class="fn"><a name="operator-not-eq-2"></a>bool QUuid::operator!= ( const GUID & <i>guid</i> ) const</h3>
132
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
133
<p>Returns true if this UUID is not equal to the Windows GUID <i>guid</i>; otherwise returns false.</p>
134
<h3 class="fn"><a name="operator-lt"></a>bool QUuid::operator< ( const QUuid & <i>other</i> ) const</h3>
135
<p>Returns true if this <a href="quuid.html">QUuid</a> is of the same variant, and lexicographically before the <i>other</i> <a href="quuid.html">QUuid</a>; otherwise returns false.</p>
136
<p>See also <a href="quuid.html#variant">variant</a>().</p>
137
<h3 class="fn"><a name="operator-eq"></a>QUuid & QUuid::operator= ( const GUID & <i>guid</i> )</h3>
138
<p>Assigns a Windows <i>guid</i> to a Qt <a href="quuid.html">QUuid</a>.</p>
139
<p><b>Warning:</b> This function is only for Windows platforms.</p>
140
<h3 class="fn"><a name="operator-eq-eq"></a>bool QUuid::operator== ( const QUuid & <i>other</i> ) const</h3>
141
<p>Returns true if this <a href="quuid.html">QUuid</a> and the <i>other</i> <a href="quuid.html">QUuid</a> are identical; otherwise returns false.</p>
142
<h3 class="fn"><a name="operator-eq-eq-2"></a>bool QUuid::operator== ( const GUID & <i>guid</i> ) const</h3>
143
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
144
<p>Returns true if this UUID is equal to the Windows GUID <i>guid</i>; otherwise returns false.</p>
145
<h3 class="fn"><a name="operator-gt"></a>bool QUuid::operator> ( const QUuid & <i>other</i> ) const</h3>
146
<p>Returns true if this <a href="quuid.html">QUuid</a> is of the same variant, and lexicographically after the <i>other</i> <a href="quuid.html">QUuid</a>; otherwise returns false.</p>
147
<p>See also <a href="quuid.html#variant">variant</a>().</p>
149
<h2>Related Non-Members</h2>
150
<h3 class="fn"><a name="operator-lt-lt-24"></a><a href="qdatastream.html">QDataStream</a> & operator<< ( <a href="qdatastream.html">QDataStream</a> & <i>s</i>, const QUuid & <i>id</i> )</h3>
151
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
152
<p>Writes the uuid <i>id</i> to the datastream <i>s</i>.</p>
153
<h3 class="fn"><a name="operator-gt-gt-15"></a><a href="qdatastream.html">QDataStream</a> & operator>> ( <a href="qdatastream.html">QDataStream</a> & <i>s</i>, QUuid & <i>id</i> )</h3>
154
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
155
<p>Reads uuid from from the stream <i>s</i> into <i>id</i>.</p>
156
<p /><address><hr /><div align="center">
157
<table width="100%" cellspacing="0" border="0"><tr class="address">
158
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
159
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
160
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
161
</tr></table></div></address></body>