12#include "private/qtools_p.h"
23template <
class Integral>
28 const char *
p =
reinterpret_cast<const char *
>(&
value);
30 for (
uint i = 0;
i <
sizeof(Integral); ++
i,
dst += 2) {
36template <
class Integral>
41 for (
uint i = 0;
i <
sizeof(Integral) * 2; ++
i) {
66 for (
int i = 0;
i < 2;
i++)
70 for (
int i = 2;
i < 8;
i++)
112 return QUuid(
d1,
d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]);
122 hash.addData(
ns.toRfc4122());
123 hash.addData(baseData);
126 hashResult.truncate(16);
131 result.data3 |= (version << 12);
498 *
dst++ =
ch.toLatin1();
567#ifndef QT_BOOTSTRAPPED
597 if (bytes.isEmpty() || bytes.size() != 16)
599 return fromBytes(bytes.data());
741#ifndef QT_NO_DATASTREAM
748 constexpr int NumBytes =
sizeof(
QUuid);
749 static_assert(NumBytes == 16,
"Change the serialization format when this ever hits");
750 char bytes[NumBytes];
752 const auto id128 =
id.toBytes();
753 static_assert(
sizeof(id128) == NumBytes);
754 memcpy(bytes, &id128, NumBytes);
768 for (
int i = 0;
i < 8; ++
i) {
769 *(
data) =
id.data4[
i];
774 if (
s.writeRawData(bytes, NumBytes) != NumBytes)
775 s.setStatus(QDataStream::WriteFailed);
786 std::array<char, 16> bytes;
787 if (
s.readRawData(bytes.data(), 16) != 16) {
795 const uchar *
data =
reinterpret_cast<const uchar *
>(bytes.data());
797 id.data1 = qFromLittleEndian<quint32>(
data);
799 id.data2 = qFromLittleEndian<quint16>(
data);
801 id.data3 = qFromLittleEndian<quint16>(
data);
804 for (
int i = 0;
i < 8; ++
i) {
805 id.data4[
i] = *(
data);
872 if ((
data4[0] & 0x80) == 0x00)
return NCS;
873 else if ((
data4[0] & 0xC0) == 0x80)
return DCE;
916#define ISLESS(f1, f2) if (f1!=f2) return (f1<f2);
920 for (
int n = 0;
n < 8;
n++) {
940 return other < *
this;
995#elif !defined(QT_BOOTSTRAPPED)
1001 enum { AmountToRead = 4 };
1025#ifndef QT_NO_DEBUG_STREAM
1033 dbg.nospace() <<
"QUuid(" <<
id.toString() <<
')';
1045 return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16)
1046 ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3])
1047 ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7])
QByteArray toByteArray() const
\inmodule QtCore\reentrant
void setStatus(Status status)
Sets the status of the data stream to the status given.
static Q_DECL_CONST_FUNCTION QRandomGenerator * system()
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void truncate(qsizetype pos)
Truncates the string at the given position index.
qsizetype size() const noexcept
Returns the number of characters in this string.
QChar * data()
Returns a pointer to the data stored in the QString.
Version
This enum defines the values used in the \l{Version field} {version field} of the UUID.
size_t qHash(const QUuid &uuid, size_t seed) noexcept
static QUuid createUuid()
On any platform other than Windows, this function returns a new UUID with variant QUuid::DCE and vers...
Variant
This enum defines the values used in the \l{Variant field} {variant field} of the UUID.
QString toString(StringFormat mode=WithBraces) const
bool operator>(const QUuid &other) const noexcept
Returns true if this QUuid has the same \l{Variant field} {variant field} as the other QUuid and is l...
static QUuid createUuidV5(const QUuid &ns, const QByteArray &baseData)
QUuid::Variant variant() const noexcept
Returns the value in the \l{Variant field} {variant field} of the UUID.
Id128Bytes toBytes(QSysInfo::Endian order=QSysInfo::BigEndian) const noexcept
static QUuid createUuidV3(const QUuid &ns, const QByteArray &baseData)
static QUuid fromRfc4122(QByteArrayView) noexcept
Creates a QUuid object from the binary representation of the UUID, as specified by RFC 4122 section 4...
QByteArray toByteArray(StringFormat mode=WithBraces) const
static QUuid fromString(QAnyStringView string) noexcept
bool isNull() const noexcept
Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false...
QDataStream & operator>>(QDataStream &s, QUuid &id)
Reads a UUID from the stream s into id.
QUuid::Version version() const noexcept
Returns the \l{Version field} {version field} of the UUID, if the UUID's \l{Variant field} {variant f...
bool operator<(const QUuid &other) const noexcept
Returns true if this QUuid has the same \l{Variant field} {variant field} as the other QUuid and is l...
QByteArray toRfc4122() const
Returns the binary representation of this QUuid.
QDebug operator<<(QDebug dbg, const QUuid &id)
Writes the UUID id to the output stream for debugging information dbg.
QDataStream & operator<<(QDataStream &s, const QUuid &id)
Writes the UUID id to the data stream s.
QHash< int, QWidget * > hash
[35multi]
Combined button and popup list for selecting options.
constexpr char toHexLower(char32_t value) noexcept
constexpr int fromHex(char32_t c) noexcept
constexpr Initialization Uninitialized
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr T qToBigEndian(T source)
constexpr T qToLittleEndian(T source)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
#define QT_BEGIN_INCLUDE_NAMESPACE
#define QT_END_INCLUDE_NAMESPACE
bool _q_fromHex(const char *&src, Integral &value)
static char * _q_uuidToHex(const QUuid &uuid, char *dst, QUuid::StringFormat mode=QUuid::WithBraces)
void _q_toHex(char *&dst, Integral value)
static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCryptographicHash::Algorithm algorithm, int version)
static Q_NEVER_INLINE QUuid _q_uuidFromHex(const char *src)
static QUuid uuidFromString(QStringView text) noexcept