1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtCore module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #include "quuid.h"
|
---|
43 |
|
---|
44 | #include "qdatastream.h"
|
---|
45 |
|
---|
46 | QT_BEGIN_NAMESPACE
|
---|
47 |
|
---|
48 | /*!
|
---|
49 | \class QUuid
|
---|
50 | \brief The QUuid class stores a Universally Unique Identifier (UUID).
|
---|
51 |
|
---|
52 | \reentrant
|
---|
53 | \ingroup misc
|
---|
54 |
|
---|
55 | Using \e{U}niversally \e{U}nique \e{ID}entifiers (UUID) is a
|
---|
56 | standard way to uniquely identify entities in a distributed
|
---|
57 | computing environment. A UUID is a 16-byte (128-bit) number
|
---|
58 | generated by some algorithm that is meant to guarantee that the
|
---|
59 | UUID will be unique in the distributed computing environment where
|
---|
60 | it is used. The acronym GUID is often used instead, \e{G}lobally
|
---|
61 | \e{U}nique \e{ID}entifiers, but it refers to the same thing.
|
---|
62 |
|
---|
63 | \target Variant field
|
---|
64 | Actually, the GUID is one \e{variant} of UUID. Multiple variants
|
---|
65 | are in use. Each UUID contains a bit field that specifies which
|
---|
66 | type (variant) of UUID it is. Call variant() to discover which
|
---|
67 | type of UUID an instance of QUuid contains. It extracts the three
|
---|
68 | most signifcant bits of byte 8 of the 16 bytes. In QUuid, byte 8
|
---|
69 | is \c{QUuid::data4[0]}. If you create instances of QUuid using the
|
---|
70 | constructor that accepts all the numeric values as parameters, use
|
---|
71 | the following table to set the three most significant bits of
|
---|
72 | parameter \c{b1}, which becomes \c{QUuid::data4[0]} and contains
|
---|
73 | the variant field in its three most significant bits. In the
|
---|
74 | table, 'x' means \e {don't care}.
|
---|
75 |
|
---|
76 | \table
|
---|
77 | \header
|
---|
78 | \o msb0
|
---|
79 | \o msb1
|
---|
80 | \o msb2
|
---|
81 | \o Variant
|
---|
82 |
|
---|
83 | \row
|
---|
84 | \o 0
|
---|
85 | \o x
|
---|
86 | \o x
|
---|
87 | \o NCS (Network Computing System)
|
---|
88 |
|
---|
89 | \row
|
---|
90 | \o 1
|
---|
91 | \o 0
|
---|
92 | \o x
|
---|
93 | \o DCE (Distributed Computing Environment)
|
---|
94 |
|
---|
95 | \row
|
---|
96 | \o 1
|
---|
97 | \o 1
|
---|
98 | \o 0
|
---|
99 | \o Microsoft (GUID)
|
---|
100 |
|
---|
101 | \row
|
---|
102 | \o 1
|
---|
103 | \o 1
|
---|
104 | \o 1
|
---|
105 | \o Reserved for future expansion
|
---|
106 |
|
---|
107 | \endtable
|
---|
108 |
|
---|
|
---|