source: trunk/doc/html/quuid-h.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 6.5 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/quuid.h:1 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>quuid.h Include File</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>quuid.h</h1>
33
34<p>This is the verbatim text of the quuid.h include file. It is provided only for illustration; the copyright remains with Trolltech.
35<hr>
36<pre>
37/****************************************************************************
38** $Id: quuid-h.html 2051 2007-02-21 10:04:20Z chehrlic $
39**
40** Definition of QUuid class
41**
42** Created : 010523
43**
44** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
45**
46** This file is part of the tools module of the Qt GUI Toolkit.
47**
48** This file may be distributed under the terms of the Q Public License
49** as defined by Trolltech ASA of Norway and appearing in the file
50** LICENSE.QPL included in the packaging of this file.
51**
52** This file may be distributed and/or modified under the terms of the
53** GNU General Public License version 2 as published by the Free Software
54** Foundation and appearing in the file LICENSE.GPL included in the
55** packaging of this file.
56**
57** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
58** licenses may use this file in accordance with the Qt Commercial License
59** Agreement provided with the Software.
60**
61** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
62** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
63**
64** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
65** information about Qt Commercial License Agreements.
66** See http://www.trolltech.com/qpl/ for QPL licensing information.
67** See http://www.trolltech.com/gpl/ for GPL licensing information.
68**
69** Contact info@trolltech.com if any conditions of this licensing are
70** not clear to you.
71**
72**********************************************************************/
73
74#ifndef QUUID_H
75#define QUUID_H
76
77#ifndef QT_H
78#include "qstring.h"
79#endif // QT_H
80
81#include &lt;string.h&gt;
82
83#if defined(Q_OS_WIN32)
84#ifndef GUID_DEFINED
85#define GUID_DEFINED
86typedef struct _GUID
87{
88 ulong Data1;
89 ushort Data2;
90 ushort Data3;
91 uchar Data4[ 8 ];
92} GUID, *REFGUID, *LPGUID;
93#endif
94#endif
95
96
97struct Q_EXPORT QUuid
98{
99 enum Variant {
100 VarUnknown =-1,
101 NCS = 0, // 0 - -
102 DCE = 2, // 1 0 -
103 Microsoft = 6, // 1 1 0
104 Reserved = 7 // 1 1 1
105 };
106
107 enum Version {
108 VerUnknown =-1,
109 Time = 1, // 0 0 0 1
110 EmbeddedPOSIX = 2, // 0 0 1 0
111 Name = 3, // 0 0 1 1
112 Random = 4 // 0 1 0 0
113 };
114
115 QUuid()
116 {
117 memset( this, 0, sizeof(QUuid) );
118 }
119 QUuid( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 )
120 {
121 data1 = l;
122 data2 = w1;
123 data3 = w2;
124 data4[0] = b1;
125 data4[1] = b2;
126 data4[2] = b3;
127 data4[3] = b4;
128 data4[4] = b5;
129 data4[5] = b6;
130 data4[6] = b7;
131 data4[7] = b8;
132 }
133 QUuid( const QUuid &amp;uuid )
134 {
135 memcpy( this, &amp;uuid, sizeof(QUuid) );
136 }
137#ifndef QT_NO_QUUID_STRING
138 QUuid( const QString &amp; );
139 QUuid( const char * );
140 QString toString() const;
141 operator QString() const { return toString(); }
142#endif
143 bool isNull() const;
144
145 QUuid &amp;operator=(const QUuid &amp;orig )
146 {
147 memcpy( this, &amp;orig, sizeof(QUuid) );
148 return *this;
149 }
150
151 bool operator==(const QUuid &amp;orig ) const
152 {
153 uint i;
154 if ( data1 != orig.data1 || data2 != orig.data2 ||
155 data3 != orig.data3 )
156 return FALSE;
157
158 for( i = 0; i &lt; 8; i++ )
159 if ( data4[i] != orig.data4[i] )
160 return FALSE;
161
162 return TRUE;
163 }
164
165 bool operator!=(const QUuid &amp;orig ) const
166 {
167 return !( *this == orig );
168 }
169
170 bool operator&lt;(const QUuid &amp;other ) const;
171 bool operator&gt;(const QUuid &amp;other ) const;
172
173#if defined(Q_OS_WIN32)
174 // On Windows we have a type GUID that is used by the platform API, so we
175 // provide convenience operators to cast from and to this type.
176 QUuid( const GUID &amp;guid )
177 {
178 memcpy( this, &amp;guid, sizeof(GUID) );
179 }
180
181 QUuid &amp;operator=(const GUID &amp;orig )
182 {
183 memcpy( this, &amp;orig, sizeof(QUuid) );
184 return *this;
185 }
186
187 operator GUID() const
188 {
189 GUID guid = { data1, data2, data3, { data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7] } };
190 return guid;
191 }
192
193 bool operator==( const GUID &amp;guid ) const
194 {
195 uint i;
196 if ( data1 != guid.Data1 || data2 != guid.Data2 ||
197 data3 != guid.Data3 )
198 return FALSE;
199
200 for( i = 0; i &lt; 8; i++ )
201 if ( data4[i] != guid.Data4[i] )
202 return FALSE;
203
204 return TRUE;
205 }
206
207 bool operator!=( const GUID &amp;guid ) const
208 {
209 return !( *this == guid );
210 }
211#endif
212 static QUuid createUuid();
213 QUuid::Variant variant() const;
214 QUuid::Version version() const;
215
216 uint data1;
217 ushort data2;
218 ushort data3;
219 uchar data4[ 8 ];
220};
221
222#ifndef QT_NO_DATASTREAM
223Q_EXPORT QDataStream &amp;operator&lt;&lt;( QDataStream &amp;, const QUuid &amp; );
224Q_EXPORT QDataStream &amp;operator&gt;&gt;( QDataStream &amp;, QUuid &amp; );
225#endif
226
227#endif //QUUID_H
228</pre>
229<!-- eof -->
230<p><address><hr><div align=center>
231<table width=100% cellspacing=0 border=0><tr>
232<td>Copyright &copy; 2007
233<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
234<td align=right><div align=right>Qt 3.3.8</div>
235</table></div></address></body>
236</html>
Note: See TracBrowser for help on using the repository browser.