-rw-r--r-- | library/quuid.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/quuid.cpp b/library/quuid.cpp index fb4387c..46fd816 100644 --- a/library/quuid.cpp +++ b/library/quuid.cpp | |||
@@ -1,146 +1,146 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "quuid.h" | 21 | #include "quuid.h" |
22 | 22 | ||
23 | /*! | 23 | /*! |
24 | \class QUuid quuid.h | 24 | \class QUuid quuid.h |
25 | \brief The QUuid class defines a Universally Unique Identifier (UUID). | 25 | \brief The QUuid class defines a Universally Unique Identifier (UUID). |
26 | 26 | ||
27 | This class is temporarily copied from Qt 3.0. | 27 | This class is temporarily copied from Qt 3.0. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | /*! | 30 | /*! |
31 | \fn QUuid::QUuid() | 31 | \fn QUuid::QUuid() |
32 | 32 | ||
33 | Creates the null UUID {00000000-0000-0000-0000-000000000000}. | 33 | Creates the null UUID {00000000-0000-0000-0000-000000000000}. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | /*! | 36 | /*! |
37 | \fn QUuid::QUuid( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 ) | 37 | \fn QUuid::QUuid( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 ) |
38 | 38 | ||
39 | Creates an UUID with the value specified by the parameters, \a l, \a | 39 | Creates an UUID with the value specified by the parameters, \a l, \a |
40 | w1, \a w2, \a b1, \a b2, \a b3, \a b4, \a b5, \a b6, \a b7, \a b8. | 40 | w1, \a w2, \a b1, \a b2, \a b3, \a b4, \a b5, \a b6, \a b7, \a b8. |
41 | 41 | ||
42 | Example: | 42 | Example: |
43 | \code | 43 | \code |
44 | // {67C8770B-44F1-410A-AB9A-F9B5446F13EE} | 44 | // {67C8770B-44F1-410A-AB9A-F9B5446F13EE} |
45 | QUuid IID_MyInterface( 0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 0xee ) | 45 | QUuid IID_MyInterface( 0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 0xee ) |
46 | \endcode | 46 | \endcode |
47 | */ | 47 | */ |
48 | 48 | ||
49 | /*! | 49 | /*! |
50 | \fn QUuid::QUuid( const QUuid &orig ) | 50 | \fn QUuid::QUuid( const QUuid &orig ) |
51 | 51 | ||
52 | Creates a copy of the QUuid \a orig. | 52 | Creates a copy of the QUuid \a orig. |
53 | */ | 53 | */ |
54 | #ifndef QT_NO_QUUID_STRING | 54 | #ifndef QT_NO_QUUID_STRING |
55 | /*! | 55 | /*! |
56 | Creates a QUuid object from the string \a text. Right now, the function | 56 | Creates a QUuid object from the string \a text. Right now, the function |
57 | can only convert the format {12345678-1234-1234-1234-123456789ABC} and | 57 | can only convert the format {12345678-1234-1234-1234-123456789ABC} and |
58 | will create the null UUID when the conversion fails. | 58 | will create the null UUID when the conversion fails. |
59 | */ | 59 | */ |
60 | QUuid::QUuid( const QString &text ) | 60 | QUuid::QUuid( const QString &text ) |
61 | { | 61 | { |
62 | bool ok; | 62 | bool ok; |
63 | QString temp = text.upper(); | 63 | QString temp = text.upper(); |
64 | 64 | ||
65 | data1 = temp.mid( 1, 8 ).toULong( &ok, 16 ); | 65 | data1 = temp.mid( 1, 8 ).toULong( &ok, 16 ); |
66 | if ( !ok ) { | 66 | if ( !ok ) { |
67 | *this = QUuid(); | 67 | *this = QUuid(); |
68 | return; | 68 | return; |
69 | } | 69 | } |
70 | 70 | ||
71 | data2 = temp.mid( 10, 4 ).toUInt( &ok, 16 ); | 71 | data2 = temp.mid( 10, 4 ).toUInt( &ok, 16 ); |
72 | if ( !ok ) { | 72 | if ( !ok ) { |
73 | *this = QUuid(); | 73 | *this = QUuid(); |
74 | return; | 74 | return; |
75 | } | 75 | } |
76 | data3 = temp.mid( 15, 4 ).toUInt( &ok, 16 ); | 76 | data3 = temp.mid( 15, 4 ).toUInt( &ok, 16 ); |
77 | if ( !ok ) { | 77 | if ( !ok ) { |
78 | *this = QUuid(); | 78 | *this = QUuid(); |
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | data4[0] = temp.mid( 20, 2 ).toUInt( &ok, 16 ); | 81 | data4[0] = temp.mid( 20, 2 ).toUInt( &ok, 16 ); |
82 | if ( !ok ) { | 82 | if ( !ok ) { |
83 | *this = QUuid(); | 83 | *this = QUuid(); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | data4[1] = temp.mid( 22, 2 ).toUInt( &ok, 16 ); | 86 | data4[1] = temp.mid( 22, 2 ).toUInt( &ok, 16 ); |
87 | if ( !ok ) { | 87 | if ( !ok ) { |
88 | *this = QUuid(); | 88 | *this = QUuid(); |
89 | return; | 89 | return; |
90 | } | 90 | } |
91 | for ( int i = 2; i<8; i++ ) { | 91 | for ( int i = 2; i<8; i++ ) { |
92 | data4[i] = temp.mid( 25 + (i-2)*2, 2 ).toUShort( &ok, 16 ); | 92 | data4[i] = temp.mid( 25 + (i-2)*2, 2 ).toUShort( &ok, 16 ); |
93 | if ( !ok ) { | 93 | if ( !ok ) { |
94 | *this = QUuid(); | 94 | *this = QUuid(); |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | } | 98 | } |
99 | #endif | 99 | #endif |
100 | /*! | 100 | /*! |
101 | \fn QUuid QUuid::operator=(const QUuid &uuid ) | 101 | \fn QUuid QUuid::operator=(const QUuid &uuid ) |
102 | 102 | ||
103 | Assigns the value of \a uuid to this QUuid object. | 103 | Assigns the value of \a uuid to this QUuid object. |
104 | */ | 104 | */ |
105 | 105 | ||
106 | /*! | 106 | /*! |
107 | \fn bool QUuid::operator==(const QUuid &other) const | 107 | \fn bool QUuid::operator==(const QUuid &other) const |
108 | 108 | ||
109 | Returns TRUE if this QUuid and the \a other QUuid are identical, otherwise returns FALSE. | 109 | Returns TRUE if this QUuid and the \a other QUuid are identical, otherwise returns FALSE. |
110 | */ | 110 | */ |
111 | 111 | ||
112 | /*! | 112 | /*! |
113 | \fn bool QUuid::operator!=(const QUuid &other) const | 113 | \fn bool QUuid::operator!=(const QUuid &other) const |
114 | 114 | ||
115 | Returns TRUE if this QUuid and the \a other QUuid are different, otherwise returns FALSE. | 115 | Returns TRUE if this QUuid and the \a other QUuid are different, otherwise returns FALSE. |
116 | */ | 116 | */ |
117 | #ifndef QT_NO_QUUID_STRING | 117 | #ifndef QT_NO_QUUID_STRING |
118 | /*! | 118 | /*! |
119 | QString QUuid::toString() const | 119 | QString QUuid::toString() const |
120 | 120 | ||
121 | Returns a string in {12345678-1234-1234-1234-123456789ABC} format. | 121 | Returns a string in {12345678-1234-1234-1234-123456789ABC} format. |
122 | */ | 122 | */ |
123 | QString QUuid::toString() const | 123 | QString QUuid::toString() const |
124 | { | 124 | { |
125 | QString result; | 125 | QString result; |
126 | 126 | ||
127 | result = "{" + QString::number( data1, 16 ).rightJustify( 8, '0' ) + "-"; | 127 | result = "{" + QString::number( data1, 16 ).rightJustify( 8, '0' ) + "-"; |
128 | result += QString::number( (int)data2, 16 ).rightJustify( 4, '0' ) + "-"; | 128 | result += QString::number( (int)data2, 16 ).rightJustify( 4, '0' ) + "-"; |
129 | result += QString::number( (int)data3, 16 ).rightJustify( 4, '0' ) + "-"; | 129 | result += QString::number( (int)data3, 16 ).rightJustify( 4, '0' ) + "-"; |
130 | result += QString::number( (int)data4[0], 16 ).rightJustify( 2, '0' ); | 130 | result += QString::number( (int)data4[0], 16 ).rightJustify( 2, '0' ); |
131 | result += QString::number( (int)data4[1], 16 ).rightJustify( 2, '0' ) + "-"; | 131 | result += QString::number( (int)data4[1], 16 ).rightJustify( 2, '0' ) + "-"; |
132 | for ( int i = 2; i < 8; i++ ) | 132 | for ( int i = 2; i < 8; i++ ) |
133 | result += QString::number( (int)data4[i], 16 ).rightJustify( 2, '0' ); | 133 | result += QString::number( (int)data4[i], 16 ).rightJustify( 2, '0' ); |
134 | 134 | ||
135 | return result + "}"; | 135 | return result + "}"; |
136 | } | 136 | } |
137 | #endif | 137 | #endif |
138 | /*! | 138 | /*! |
139 | Returns TRUE if this is the null UUID {00000000-0000-0000-0000-000000000000}, otherwise returns FALSE. | 139 | Returns TRUE if this is the null UUID {00000000-0000-0000-0000-000000000000}, otherwise returns FALSE. |
140 | */ | 140 | */ |
141 | bool QUuid::isNull() const | 141 | bool QUuid::isNull() const |
142 | { | 142 | { |
143 | return data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 && | 143 | return data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 && |
144 | data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 && | 144 | data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 && |
145 | data1 == 0 && data2 == 0 && data3 == 0; | 145 | data1 == 0 && data2 == 0 && data3 == 0; |
146 | } | 146 | } |