Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QUUID_H
00043 #define QUUID_H
00044
00045 #include <QtCore/qstring.h>
00046
00047 QT_BEGIN_HEADER
00048
00049 #if defined(Q_OS_WIN)
00050 #ifndef GUID_DEFINED
00051 #define GUID_DEFINED
00052 typedef struct _GUID
00053 {
00054 ulong Data1;
00055 ushort Data2;
00056 ushort Data3;
00057 uchar Data4[8];
00058 } GUID, *REFGUID, *LPGUID;
00059 #endif
00060 #endif
00061
00062
00063 QT_BEGIN_NAMESPACE
00064
00065 QT_MODULE(Core)
00066
00067 struct Q_CORE_EXPORT QUuid
00068 {
00069 enum Variant {
00070 VarUnknown =-1,
00071 NCS = 0,
00072 DCE = 2,
00073 Microsoft = 6,
00074 Reserved = 7
00075 };
00076
00077 enum Version {
00078 VerUnknown =-1,
00079 Time = 1,
00080 EmbeddedPOSIX = 2,
00081 Name = 3,
00082 Random = 4
00083 };
00084
00085 QUuid()
00086 {
00087 data1 = 0;
00088 data2 = 0;
00089 data3 = 0;
00090 for(int i = 0; i < 8; i++)
00091 data4[i] = 0;
00092 }
00093 QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8)
00094 {
00095 data1 = l;
00096 data2 = w1;
00097 data3 = w2;
00098 data4[0] = b1;
00099 data4[1] = b2;
00100 data4[2] = b3;
00101 data4[3] = b4;
00102 data4[4] = b5;
00103 data4[5] = b6;
00104 data4[6] = b7;
00105 data4[7] = b8;
00106 }
00107 #ifndef QT_NO_QUUID_STRING
00108 QUuid(const QString &);
00109 QUuid(const char *);
00110 QString toString() const;
00111 operator QString() const { return toString(); }
00112 #endif
00113 bool isNull() const;
00114
00115 bool operator==(const QUuid &orig) const
00116 {
00117 uint i;
00118 if (data1 != orig.data1 || data2 != orig.data2 ||
00119 data3 != orig.data3)
00120 return false;
00121
00122 for(i = 0; i < 8; i++)
00123 if (data4[i] != orig.data4[i])
00124 return false;
00125
00126 return true;
00127 }
00128
00129 bool operator!=(const QUuid &orig) const
00130 {
00131 return !(*this == orig);
00132 }
00133
00134 bool operator<(const QUuid &other) const;
00135 bool operator>(const QUuid &other) const;
00136
00137 #if defined(Q_OS_WIN)
00138
00139
00140 QUuid(const GUID &guid)
00141 {
00142 data1 = guid.Data1;
00143 data2 = guid.Data2;
00144 data3 = guid.Data3;
00145 for(int i = 0; i < 8; i++)
00146 data4[i] = guid.Data4[i];
00147 }
00148
00149 QUuid &operator=(const GUID &guid)
00150 {
00151 *this = QUuid(guid);
00152 return *this;
00153 }
00154
00155 operator GUID() const
00156 {
00157 GUID guid = { data1, data2, data3, { data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7] } };
00158 return guid;
00159 }
00160
00161 bool operator==(const GUID &guid) const
00162 {
00163 return *this == QUuid(guid);
00164 }
00165
00166 bool operator!=(const GUID &guid) const
00167 {
00168 return !(*this == guid);
00169 }
00170 #endif
00171 static QUuid createUuid();
00172 QUuid::Variant variant() const;
00173 QUuid::Version version() const;
00174
00175 uint data1;
00176 ushort data2;
00177 ushort data3;
00178 uchar data4[8];
00179 };
00180
00181 #ifndef QT_NO_DATASTREAM
00182 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUuid &);
00183 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUuid &);
00184 #endif
00185
00186 QT_END_NAMESPACE
00187
00188 QT_END_HEADER
00189
00190 #endif // QUUID_H