summaryrefslogtreecommitdiff
path: root/qmake/include/quuid.h
Unidiff
Diffstat (limited to 'qmake/include/quuid.h') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/include/quuid.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/qmake/include/quuid.h b/qmake/include/quuid.h
index 664c149..f5d8a86 100644
--- a/qmake/include/quuid.h
+++ b/qmake/include/quuid.h
@@ -1,14 +1,14 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2**
3** 3**
4** Definition of QUuid class 4** Definition of QUuid class
5** 5**
6** Created : 010523 6** Created : 010523
7** 7**
8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the tools module of the Qt GUI Toolkit. 10** This file is part of the tools module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
@@ -30,44 +30,61 @@
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#ifndef QUUID_H 38#ifndef QUUID_H
39#define QUUID_H 39#define QUUID_H
40 40
41#ifndef QT_H 41#ifndef QT_H
42#include <qstring.h> 42#include "qstring.h"
43#endif // QT_H 43#endif // QT_H
44 44
45#include <string.h> 45#include <string.h>
46 46
47#if defined(Q_OS_WIN32) 47#if defined(Q_OS_WIN32)
48#ifndef GUID_DEFINED 48#ifndef GUID_DEFINED
49#define GUID_DEFINED 49#define GUID_DEFINED
50typedef struct _GUID 50typedef struct _GUID
51{ 51{
52 ulong Data1; 52 ulong Data1;
53 ushort Data2; 53 ushort Data2;
54 ushort Data3; 54 ushort Data3;
55 uchar Data4[ 8 ]; 55 uchar Data4[ 8 ];
56} GUID, *REFGUID, *LPGUID; 56} GUID, *REFGUID, *LPGUID;
57#endif 57#endif
58#endif 58#endif
59 59
60
60struct Q_EXPORT QUuid 61struct Q_EXPORT QUuid
61{ 62{
63 enum Variant {
64 VarUnknown=-1,
65 NCS = 0, // 0 - -
66 DCE = 2, // 1 0 -
67 Microsoft= 6, // 1 1 0
68 Reserved= 7 // 1 1 1
69 };
70
71 enum Version {
72 VerUnknown=-1,
73 Time = 1, // 0 0 0 1
74 EmbeddedPOSIX= 2, // 0 0 1 0
75 Name = 3, // 0 0 1 1
76 Random = 4 // 0 1 0 0
77 };
78
62 QUuid() 79 QUuid()
63 { 80 {
64 memset( this, 0, sizeof(QUuid) ); 81 memset( this, 0, sizeof(QUuid) );
65 } 82 }
66 QUuid( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 ) 83 QUuid( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 )
67 { 84 {
68 data1 = l; 85 data1 = l;
69 data2 = w1; 86 data2 = w1;
70 data3 = w2; 87 data3 = w2;
71 data4[0] = b1; 88 data4[0] = b1;
72 data4[1] = b2; 89 data4[1] = b2;
73 data4[2] = b3; 90 data4[2] = b3;
@@ -105,24 +122,27 @@ struct Q_EXPORT QUuid
105 for( i = 0; i < 8; i++ ) 122 for( i = 0; i < 8; i++ )
106 if ( data4[i] != orig.data4[i] ) 123 if ( data4[i] != orig.data4[i] )
107 return FALSE; 124 return FALSE;
108 125
109 return TRUE; 126 return TRUE;
110 } 127 }
111 128
112 bool operator!=(const QUuid &orig ) const 129 bool operator!=(const QUuid &orig ) const
113 { 130 {
114 return !( *this == orig ); 131 return !( *this == orig );
115 } 132 }
116 133
134 bool operator<(const QUuid &other ) const;
135 bool operator>(const QUuid &other ) const;
136
117#if defined(Q_OS_WIN32) 137#if defined(Q_OS_WIN32)
118 // On Windows we have a type GUID that is used by the platform API, so we 138 // On Windows we have a type GUID that is used by the platform API, so we
119 // provide convenience operators to cast from and to this type. 139 // provide convenience operators to cast from and to this type.
120 QUuid( const GUID &guid ) 140 QUuid( const GUID &guid )
121 { 141 {
122 memcpy( this, &guid, sizeof(GUID) ); 142 memcpy( this, &guid, sizeof(GUID) );
123 } 143 }
124 144
125 QUuid &operator=(const GUID &orig ) 145 QUuid &operator=(const GUID &orig )
126 { 146 {
127 memcpy( this, &orig, sizeof(QUuid) ); 147 memcpy( this, &orig, sizeof(QUuid) );
128 return *this; 148 return *this;
@@ -144,24 +164,27 @@ struct Q_EXPORT QUuid
144 for( i = 0; i < 8; i++ ) 164 for( i = 0; i < 8; i++ )
145 if ( data4[i] != guid.Data4[i] ) 165 if ( data4[i] != guid.Data4[i] )
146 return FALSE; 166 return FALSE;
147 167
148 return TRUE; 168 return TRUE;
149 } 169 }
150 170
151 bool operator!=( const GUID &guid ) const 171 bool operator!=( const GUID &guid ) const
152 { 172 {
153 return !( *this == guid ); 173 return !( *this == guid );
154 } 174 }
155#endif 175#endif
176 static QUuid createUuid();
177 QUuid::Variant variant() const;
178 QUuid::Version version() const;
156 179
157 uint data1; 180 uint data1;
158 ushort data2; 181 ushort data2;
159 ushort data3; 182 ushort data3;
160 uchar data4[ 8 ]; 183 uchar data4[ 8 ];
161}; 184};
162 185
163#ifndef QT_NO_DATASTREAM 186#ifndef QT_NO_DATASTREAM
164Q_EXPORT QDataStream &operator<<( QDataStream &, const QUuid & ); 187Q_EXPORT QDataStream &operator<<( QDataStream &, const QUuid & );
165Q_EXPORT QDataStream &operator>>( QDataStream &, QUuid & ); 188Q_EXPORT QDataStream &operator>>( QDataStream &, QUuid & );
166#endif 189#endif
167 190