49 #ifndef QT_NO_QUUID_STRING 50 template <
class Char,
class Integral>
53 static const char digits[] =
"0123456789abcdef";
57 const char* p =
reinterpret_cast<const char*
>(&value);
59 for (
uint i = 0; i <
sizeof(Integral); ++i, dst += 2) {
60 uint j = (p[i] >> 4) & 0xf;
61 dst[0] =
Char(digits[j]);
63 dst[1] =
Char(digits[j]);
67 template <
class Char,
class Integral>
72 for (
uint i = 0; i <
sizeof(Integral) * 2; ++i) {
75 if (ch >=
'0' && ch <=
'9')
77 else if (ch >=
'a' && ch <=
'f')
79 else if (ch >=
'A' && ch <=
'F')
84 value = value * 16 + tmp;
100 for (
int i = 0; i < 2; i++)
103 for (
int i = 2; i < 8; i++)
108 template <
class Char>
111 if (*src ==
Char(
'{'))
114 || *src++ !=
Char(
'-')
116 || *src++ !=
Char(
'-')
118 || *src++ !=
Char(
'-')
121 || *src++ !=
Char(
'-')
323 #ifndef QT_NO_QUUID_STRING 344 if (*data ==
'{' && text.
length() < 37) {
393 if (*data ==
'{' && text.
length() < 37) {
439 for (
int i = 0; i < 8; ++i) {
444 return QUuid(d1, d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]);
466 #ifndef QT_NO_QUUID_STRING 614 for (
int i = 0; i < 8; ++i) {
622 #ifndef QT_NO_DATASTREAM 634 bytes =
id.toRfc4122();
647 for (
int i = 0; i < 8; ++i) {
686 for (
int i = 0; i < 8; ++i) {
687 id.data4[i] = *(
data);
694 #endif // QT_NO_DATASTREAM 761 if ((
data4[0] & 0x80) == 0x00)
return NCS;
762 else if ((
data4[0] & 0xC0) == 0x80)
return DCE;
806 #define ISLESS(f1, f2) if (f1!=f2) return (f1<f2); 815 for (
int n = 0; n < 8; n++) {
835 #define ISMORE(f1, f2) if (f1!=f2) return (f1>f2); 844 for (
int n = 0; n < 8; n++) {
870 #if defined(Q_OS_WIN32) && ! defined(Q_CC_MWERKS) 893 #if !defined(QT_BOOTSTRAPPED) && defined(Q_OS_UNIX) 902 #if defined(Q_OS_UNIX) 904 # if !defined(QT_BOOTSTRAPPED) 905 devUrandom = devUrandomStorage()->localData();
909 devUrandomStorage()->setLocalData(devUrandom);
916 enum { AmountToRead = 4 *
sizeof(
uint) };
918 && devUrandom->
read((
char *) data, AmountToRead) == AmountToRead) {
924 static const int intbits =
sizeof(int)*8;
925 static int randbits = 0;
929 do { ++r; }
while ((max=max>>1));
936 #ifndef QT_BOOTSTRAPPED 940 int *pseed =
new int;
948 static bool seeded =
false;
954 int chunks = 16 /
sizeof(
uint);
957 for (
int filled = 0; filled < intbits; filled += randbits)
958 randNumber |=
qrand()<<filled;
959 #if defined(Q_OS_SYMBIAN) 963 randNumber ^= User::NTickCount() * 0x3b9aca07;
965 *(data+chunks) = randNumber;
969 result.
data4[0] = (result.
data4[0] & 0x3F) | 0x80;
970 result.
data3 = (result.
data3 & 0x0FFF) | 0x4000;
974 #endif // !Q_OS_WIN32
QByteArray toRfc4122() const
Returns the binary representation of this QUuid.
QIntegerForSizeof< void * >::Unsigned quintptr
#define QT_END_NAMESPACE
This macro expands to.
void _q_uuidToHex(Char *&dst, const uint &d1, const ushort &d2, const ushort &d3, const uchar(&d4)[8])
char * data()
Returns a pointer to the data stored in the byte array.
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
static QUuid createUuid()
On any platform other than Windows, this function returns a new UUID with variant QUuid::DCE and vers...
quint16 qFromLittleEndian< quint16 >(const uchar *src)
ByteOrder byteOrder() const
Returns the current byte order setting – either BigEndian or LittleEndian.
The QByteArray class provides an array of bytes.
int length() const
Returns the number of characters in this string.
Version
This enum defines the values used in the Version field {version field} of the UUID.
QDataStream & operator>>(QDataStream &s, QUuid &id)
Reads a UUID from the stream s into id.
QByteArray toByteArray() const
Returns the binary representation of this QUuid.
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setStatus(Status status)
Sets the status of the data stream to the status given.
quint32 qFromBigEndian< quint32 >(const uchar *src)
bool _q_fromHex(const Char *&src, Integral &value)
The QString class provides a Unicode character string.
Q_CORE_EXPORT int qrand()
QUuid::Variant variant() const
Returns the value in the Variant field {variant field} of the UUID.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar(&d4)[8])
QString toString() const
Returns the string representation of this QUuid.
bool isNull() const
Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false...
bool operator>(const QUuid &other) const
Returns true if this QUuid has the same Variant field {variant field} as the other QUuid and is lexic...
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
QDataStream & operator<<(QDataStream &s, const QUuid &id)
Writes the UUID id to the data stream s.
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool isOpen() const
Returns true if the device is open; otherwise returns false.
int readRawData(char *, int len)
Reads at most len bytes from the stream into s and returns the number of bytes read.
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
QUuid()
Creates the null UUID.
quint32 qFromLittleEndian< quint32 >(const uchar *src)
static const char * data(const QByteArray &arr)
void _q_toHex(Char *&dst, Integral value)
Variant
This enum defines the values used in the Variant field {variant field} of the UUID.
quint16 qFromBigEndian< quint16 >(const uchar *src)
int length() const
Same as size().
const char * constData() const
Returns a pointer to the data stored in the byte array.
bool hasLocalData() const
If T is a pointer type, returns true if the calling thread has non-zero data available.
The QFile class provides an interface for reading from and writing to files.
void setLocalData(T t)
Sets the local data for the calling thread to data.
int fetchAndAddRelaxed(int valueToAdd)
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
static QUuid fromRfc4122(const QByteArray &)
Creates a QUuid object from the binary representation of the UUID given by bytes, as specified by RFC...
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Q_GLOBAL_STATIC(QThreadStorage< QFile *>, devUrandomStorage)
The QDataStream class provides serialization of binary data to a QIODevice.
Q_CORE_EXPORT void qsrand(uint seed)
QUuid::Version version() const
Returns the Version field {version field} of the UUID, if the UUID's Variant field {variant field} is...
The QThreadStorage class provides per-thread data storage.
T qToLittleEndian(T source)
int writeRawData(const char *, int len)
Writes len bytes from s to the stream.
The QUuid class stores a Universally Unique Identifier (UUID).
bool operator<(const QUuid &other) const
Returns true if this QUuid has the same Variant field {variant field} as the other QUuid and is lexic...