1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QUuid Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QUuid Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QUuid class stores a Universally Unique Identifier (UUID). <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="quuid.html#Variant-enum">Variant</a></b> { VarUnknown, NCS, DCE, Microsoft, Reserved }</li><li><div class="fn" />enum <b><a href="quuid.html#Version-enum">Version</a></b> { VerUnknown, Time, EmbeddedPOSIX, Name, Random }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="quuid.html#QUuid">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="quuid.html#QUuid-2">__init__</a></b> (<i>self</i>, int, int, int, str, str, str, str, str, str, str, str)</li><li><div class="fn" /><b><a href="quuid.html#QUuid-3">__init__</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="quuid.html#QUuid-4">__init__</a></b> (<i>self</i>, QUuid)</li><li><div class="fn" />bool <b><a href="quuid.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="quuid.html#toString">toString</a></b> (<i>self</i>)</li><li><div class="fn" />Variant <b><a href="quuid.html#variant">variant</a></b> (<i>self</i>)</li><li><div class="fn" />Version <b><a href="quuid.html#version">version</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QUuid <b><a href="quuid.html#createUuid">createUuid</a></b> ()</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="quuid.html#__eq__">__eq__</a></b> (<i>self</i>, QUuid)</li><li><div class="fn" />bool <b><a href="quuid.html#__ge__">__ge__</a></b> (<i>self</i>, QUuid)</li><li><div class="fn" />bool <b><a href="quuid.html#__gt__">__gt__</a></b> (<i>self</i>, QUuid)</li><li><div class="fn" />bool <b><a href="quuid.html#__le__">__le__</a></b> (<i>self</i>, QUuid)</li><li><div class="fn" />bool <b><a href="quuid.html#__lt__">__lt__</a></b> (<i>self</i>, QUuid)</li><li><div class="fn" />bool <b><a href="quuid.html#__ne__">__ne__</a></b> (<i>self</i>, QUuid)</li><li><div class="fn" />str <b><a href="quuid.html#__repr__">__repr__</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QUuid class stores a Universally Unique Identifier (UUID).</p>
<p>Using <i>U</i>niversally <i>U</i>nique <i>ID</i>entifiers (UUID) is a standard way to uniquely identify entities in a distributed computing environment. A UUID is a 16-byte (128-bit) number generated by some algorithm that is meant to guarantee that the UUID will be unique in the distributed computing environment where it is used. The acronym GUID is often used instead, <i>G</i>lobally <i>U</i>nique <i>ID</i>entifiers, but it refers to the same thing.</p>
<a name="variant-field" /><p>Actually, the GUID is one <i>variant</i> of UUID. Multiple variants are in use. Each UUID contains a bit field that specifies which type (variant) of UUID it is. Call <a href="quuid.html#variant">variant</a>() to discover which type of UUID an instance of QUuid contains. It extracts the three most signifcant bits of byte 8 of the 16 bytes. In QUuid, byte 8 is <tt>QUuid.data4[0]</tt>. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the three most significant bits of parameter <tt>b1</tt>, which becomes <tt>QUuid.data4[0]</tt> and contains the variant field in its three most significant bits. In the table, 'x' means <i>don't care</i>.</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic">
<thead><tr class="qt-style" valign="top"><th>msb0</th><th>msb1</th><th>msb2</th><th>Variant</th></tr></thead>
<tr class="odd" valign="top"><td>0</td><td>x</td><td>x</td><td>NCS (Network Computing System)</td></tr>
<tr class="even" valign="top"><td>1</td><td>0</td><td>x</td><td>DCE (Distributed Computing Environment)</td></tr>
<tr class="odd" valign="top"><td>1</td><td>1</td><td>0</td><td>Microsoft (GUID)</td></tr>
<tr class="even" valign="top"><td>1</td><td>1</td><td>1</td><td>Reserved for future expansion</td></tr>
</table></p>
<a name="version-field" /><p>If <a href="quuid.html#variant">variant</a>() returns <a href="quuid.html#Variant-enum">QUuid.DCE</a>, the UUID also contains a <i>version</i> field in the four most significant bits of <tt>QUuid.data3</tt>, and you can call <a href="quuid.html#version">version</a>() to discover which version your QUuid contains. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the four most significant bits of parameter <tt>w2</tt>, which becomes <tt>QUuid.data3</tt> and contains the version field in its four most significant bits.</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic">
<thead><tr class="qt-style" valign="top"><th>msb0</th><th>msb1</th><th>msb2</th><th>msb3</th><th>Version</th></tr></thead>
<tr class="odd" valign="top"><td>0</td><td>0</td><td>0</td><td>1</td><td>Time</td></tr>
<tr class="even" valign="top"><td>0</td><td>0</td><td>1</td><td>0</td><td>Embedded POSIX</td></tr>
<tr class="odd" valign="top"><td>0</td><td>0</td><td>1</td><td>1</td><td>Name</td></tr>
<tr class="even" valign="top"><td>0</td><td>1</td><td>0</td><td>0</td><td>Random</td></tr>
</table></p>
<p>The field layouts for the DCE versions listed in the table above are specified in the <a href="http://www.ietf.org/rfc/rfc4122.txt">Network Working Group UUID Specification</a>.</p>
<p>Most platforms provide a tool for generating new UUIDs, e.g. <tt>uuidgen</tt> and <tt>guidgen</tt>. You can also use <a href="quuid.html#createUuid">createUuid</a>(). UUIDs generated by <a href="quuid.html#createUuid">createUuid</a>() are of the random type. Their <a href="quuid.html#Version-enum">QUuid.Version</a> bits are set to <a href="quuid.html#Version-enum">QUuid.Random</a>, and their <a href="quuid.html#Variant-enum">QUuid.Variant</a> bits are set to <a href="quuid.html#Variant-enum">QUuid.DCE</a>. The rest of the UUID is composed of random numbers. Theoretically, this means there is a small chance that a UUID generated by <a href="quuid.html#createUuid">createUuid</a>() will not be unique. But it is <a href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier#Random_UUID_probability_of_duplicates">a <i>very</i> small chance</a>.</p>
<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>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Variant-enum" />QUuid.Variant</h3><p>This enum defines the values used in the <a href="quuid.html#variant-field">variant field</a> of the UUID. The value in the variant field determines the layout of the 128-bit value.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<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>
<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>
<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>
<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>
<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>
</table></p>
<a name="//apple_ref/cpp/tag/QUuid/Version" />
<a name="//apple_ref/cpp/econst/QUuid/VerUnknown" />
<a name="//apple_ref/cpp/econst/QUuid/Time" />
<a name="//apple_ref/cpp/econst/QUuid/EmbeddedPOSIX" />
<a name="//apple_ref/cpp/econst/QUuid/Name" />
<a name="//apple_ref/cpp/econst/QUuid/Random" />
<h3 class="fn"><a name="Version-enum" />QUuid.Version</h3><p>This enum defines the values used in the <a href="quuid.html#version-field">version field</a> of the UUID. The version field is meaningful only if the value in the <a href="quuid.html#variant-field">variant field</a> is <a href="quuid.html#Variant-enum">QUuid.DCE</a>.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<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>
<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>
<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>
<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>
<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>
</table></p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QUuid" />QUuid.__init__ (<i>self</i>)</h3><p>Creates the null UUID. <a href="quuid.html#toString">toString</a>() will output the null UUID as "{00000000-0000-0000-0000-000000000000}".</p>
<h3 class="fn"><a name="QUuid-2" />QUuid.__init__ (<i>self</i>, int, int, int, str, str, str, str, str, str, str, str)</h3><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>
<p>Example:</p>
<pre><span class="comment"> // {67C8770B-44F1-410A-AB9A-F9B5446F13EE}</span>
QUuid IID_MyInterface(0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 0xee)</pre>
<h3 class="fn"><a name="QUuid-3" />QUuid.__init__ (<i>self</i>, QString)</h3><p>Creates a <a href="quuid.html">QUuid</a> object from the string <i>text</i>, which must be formatted as five hex fields separated by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is created. See <a href="quuid.html#toString">toString</a>() for an explanation of how the five hex fields map to the public data members in <a href="quuid.html">QUuid</a>.</p>
<p>See also <a href="quuid.html#toString">toString</a>() and <a href="quuid.html#QUuid">QUuid</a>().</p>
<h3 class="fn"><a name="QUuid-4" />QUuid.__init__ (<i>self</i>, <a href="quuid.html">QUuid</a>)</h3><h3 class="fn"><a name="createUuid" /><a href="quuid.html">QUuid</a> QUuid.createUuid ()</h3><p>On any platform other than Windows, this function returns a new UUID with variant <a href="quuid.html#Variant-enum">QUuid.DCE</a> and version <a href="quuid.html#Version-enum">QUuid.Random</a>. The random numbers used to construct the UUID are obtained from the local pseudo-random generator, <a href="qtcore.html#qrand">qrand</a>(), which is usually not a cryptographic quality random number generator. Therefore, a UUID generated by this function can't be guaranteed to be unique. If the pseudo-random number generator for the calling thread has not yet been seeded, this function will seed the pseudo-random number generator by calling <a href="qtcore.html#qsrand">qsrand</a>().</p>
<p>On a Windows platform, a GUID is generated, which almost certainly <i>will</i> be unique, on this or any other system, networked or not.</p>
<p>See also <a href="quuid.html#variant">variant</a>() and <a href="quuid.html#version">version</a>().</p>
<a name="//apple_ref/cpp/instm/QUuid/isNull" />
<h3 class="fn"><a name="isNull" />bool QUuid.isNull (<i>self</i>)</h3><p>Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false.</p>
<a name="//apple_ref/cpp/instm/QUuid/toString" />
<h3 class="fn"><a name="toString" />QString QUuid.toString (<i>self</i>)</h3><p>Returns the string representation of this <a href="quuid.html">QUuid</a>. The string is formatted as five hex fields separated by '-' and enclosed in curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit. From left to right, the five hex fields are obtained from the four public data members in <a href="quuid.html">QUuid</a> as follows:</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic">
<thead><tr class="qt-style" valign="top"><th>Field #</th><th>Source</th></tr></thead>
<tr class="odd" valign="top"><td>1</td><td>data1</td></tr>
<tr class="even" valign="top"><td>2</td><td>data2</td></tr>
<tr class="odd" valign="top"><td>3</td><td>data3</td></tr>
<tr class="even" valign="top"><td>4</td><td>data4[0] .. data4[1]</td></tr>
<tr class="odd" valign="top"><td>5</td><td>data4[2] .. data4[7]</td></tr>
</table></p>
<a name="//apple_ref/cpp/instm/QUuid/variant" />
<h3 class="fn"><a name="variant" /><a href="quuid.html#Variant-enum">Variant</a> QUuid.variant (<i>self</i>)</h3><p>Returns the value in the <a href="quuid.html#variant-field">variant field</a> of the UUID. If the return value is <a href="quuid.html#Variant-enum">QUuid.DCE</a>, call <a href="quuid.html#version">version</a>() to see which layout it uses. The null UUID is considered to be of an unknown variant.</p>
<p>See also <a href="quuid.html#version">version</a>().</p>
<a name="//apple_ref/cpp/instm/QUuid/version" />
<h3 class="fn"><a name="version" /><a href="quuid.html#Version-enum">Version</a> QUuid.version (<i>self</i>)</h3><p>Returns the <a href="quuid.html#version-field">version field</a> of the UUID, if the UUID's <a href="quuid.html#variant-field">variant field</a> is <a href="quuid.html#Variant-enum">QUuid.DCE</a>. Otherwise it returns <a href="quuid.html#Version-enum">QUuid.VerUnknown</a>.</p>
<p>See also <a href="quuid.html#variant">variant</a>().</p>
<a name="//apple_ref/cpp/instm/QUuid/operator GUID" />
<h3 class="fn"><a name="__eq__" />bool QUuid.__eq__ (<i>self</i>, <a href="quuid.html">QUuid</a>)</h3><h3 class="fn"><a name="__ge__" />bool QUuid.__ge__ (<i>self</i>, <a href="quuid.html">QUuid</a>)</h3><h3 class="fn"><a name="__gt__" />bool QUuid.__gt__ (<i>self</i>, <a href="quuid.html">QUuid</a>)</h3><h3 class="fn"><a name="__le__" />bool QUuid.__le__ (<i>self</i>, <a href="quuid.html">QUuid</a>)</h3><h3 class="fn"><a name="__lt__" />bool QUuid.__lt__ (<i>self</i>, <a href="quuid.html">QUuid</a>)</h3><h3 class="fn"><a name="__ne__" />bool QUuid.__ne__ (<i>self</i>, <a href="quuid.html">QUuid</a>)</h3><h3 class="fn"><a name="__repr__" />str QUuid.__repr__ (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.2</td></tr></table></div></address></body></html>
|