Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
quuid.cpp File Reference
#include "quuid.h"
#include "qcryptographichash.h"
#include "qdatastream.h"
#include "qdebug.h"
#include "qendian.h"
#include "qrandom.h"
#include "private/qtools_p.h"
+ Include dependency graph for quuid.cpp:

Go to the source code of this file.

Macros

#define ISLESS(f1, f2)   if (f1!=f2) return (f1<f2);
 

Enumerations

enum  { MaxStringUuidLength = 38 }
 

Functions

template<class Integral >
void _q_toHex (char *&dst, Integral value)
 
template<class Integral >
bool _q_fromHex (const char *&src, Integral &value)
 
static char * _q_uuidToHex (const QUuid &uuid, char *dst, QUuid::StringFormat mode=QUuid::WithBraces)
 
static Q_NEVER_INLINE QUuid _q_uuidFromHex (const char *src)
 
static QUuid createFromName (const QUuid &ns, const QByteArray &baseData, QCryptographicHash::Algorithm algorithm, int version)
 
static QUuid uuidFromString (QStringView text) noexcept
 
static QUuid uuidFromString (QLatin1StringView text) noexcept
 
static Q_ALWAYS_INLINE QUuid uuidFromString (QUtf8StringView text) noexcept
 

Variables

 QT_BEGIN_NAMESPACE
 

Macro Definition Documentation

◆ ISLESS

#define ISLESS (   f1,
  f2 
)    if (f1!=f2) return (f1<f2);

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MaxStringUuidLength 

Definition at line 21 of file quuid.cpp.

Function Documentation

◆ _q_fromHex()

template<class Integral >
bool _q_fromHex ( const char *&  src,
Integral &  value 
)

Definition at line 37 of file quuid.cpp.

References ch, QtMiscUtils::fromHex(), and i.

Referenced by _q_uuidFromHex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _q_toHex()

template<class Integral >
void _q_toHex ( char *&  dst,
Integral  value 
)

Definition at line 24 of file quuid.cpp.

References i, qToBigEndian(), and QtMiscUtils::toHexLower().

Referenced by _q_uuidToHex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _q_uuidFromHex()

static Q_NEVER_INLINE QUuid _q_uuidFromHex ( const char *  src)
static

Parses the string representation of a UUID (with optional surrounding "{}") by reading at most MaxStringUuidLength (38) characters from src, which may be \nullptr. Stops at the first invalid character (which includes a premature NUL).

Returns the successfully parsed QUuid, or a null QUuid in case of failure.

Definition at line 88 of file quuid.cpp.

References _q_fromHex(), d1, d2, and Q_LIKELY.

Referenced by uuidFromString(), and uuidFromString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _q_uuidToHex()

static char * _q_uuidToHex ( const QUuid uuid,
char *  dst,
QUuid::StringFormat  mode = QUuid::WithBraces 
)
static

Definition at line 53 of file quuid.cpp.

References _q_toHex(), QUuid::data1, QUuid::data2, QUuid::data3, QUuid::data4, i, QUuid::Id128, and QUuid::WithoutBraces.

Referenced by QUuid::toByteArray(), and QUuid::toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createFromName()

static QUuid createFromName ( const QUuid ns,
const QByteArray baseData,
QCryptographicHash::Algorithm  algorithm,
int  version 
)
static

Definition at line 119 of file quuid.cpp.

References QUuid::fromRfc4122(), hash, Q_ASSERT, QByteArrayView::size(), and QByteArrayView::truncate().

Referenced by QUuid::createUuidV3(), and QUuid::createUuidV5().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uuidFromString() [1/3]

static QUuid uuidFromString ( QLatin1StringView  text)
staticnoexcept

Definition at line 457 of file quuid.cpp.

References _q_uuidFromHex(), QString::data(), QString::front(), MaxStringUuidLength, Q_UNLIKELY, QString::size(), and text.

+ Here is the call graph for this function:

◆ uuidFromString() [2/3]

static QUuid uuidFromString ( QStringView  text)
staticnoexcept

Definition at line 441 of file quuid.cpp.

References _q_uuidFromHex(), ch, MaxStringUuidLength, QString::size(), text, and QString::truncate().

Referenced by QUuid::fromString(), and uuidFromString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uuidFromString() [3/3]

static Q_ALWAYS_INLINE QUuid uuidFromString ( QUtf8StringView  text)
staticnoexcept

Definition at line 470 of file quuid.cpp.

References QString::data(), QString::size(), text, and uuidFromString().

+ Here is the call graph for this function:

Variable Documentation

◆ QT_BEGIN_NAMESPACE

QT_BEGIN_NAMESPACE
related

Definition at line 17 of file quuid.cpp.