Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qcborvalue.cpp File Reference

(a7b9ec7f6f465ce0d90edfe7154a4837b1fb9c00)

#include "qcborvalue.h"
#include "qcborvalue_p.h"
#include "qdatastream.h"
#include "qcborarray.h"
#include "qcbormap.h"
#include <qendian.h>
#include <qlocale.h>
#include <qdatetime.h>
#include <qtimezone.h>
#include <private/qnumeric_p.h>
#include <private/qsimd_p.h>
#include <new>
#include "qcborarray.cpp"
#include "qcbormap.cpp"
#include "moc_qcborvalue.cpp"
+ Include dependency graph for qcborvalue.cpp:

Go to the source code of this file.

Functions

static QCborContainerPrivateassignContainer (QCborContainerPrivate *&d, QCborContainerPrivate *x)
 
static QCborValue::Type convertToExtendedType (QCborContainerPrivate *d)
 
static int typeOrder (QCborValue::Type e1, QCborValue::Type e2)
 
void qt_to_latin1_unchecked (uchar *dst, const char16_t *uc, qsizetype len)
 
static auto nextUtf32Character (const char16_t *&ptr, const char16_t *end) noexcept
 
static qsizetype stringLengthInUtf8 (const char16_t *ptr, const char16_t *end) noexcept
 
static int compareStringsInUtf8 (QStringView lhs, QStringView rhs, Comparison mode) noexcept
 
static int compareStringsInUtf8 (QUtf8StringView lhs, QStringView rhs, Comparison mode) noexcept
 
static int compareStringsInUtf8 (QStringView lhs, QUtf8StringView rhs, Comparison mode) noexcept
 
static int compareContainer (const QCborContainerPrivate *c1, const QCborContainerPrivate *c2, Comparison mode) noexcept
 
static int compareElementNoData (const Element &e1, const Element &e2) noexcept
 
static int compareElementRecursive (const QCborContainerPrivate *c1, const Element &e1, const QCborContainerPrivate *c2, const Element &e2, Comparison mode) noexcept
 
bool comparesEqual (const QCborValue &lhs, const QCborValue &rhs) noexcept
 
bool comparesEqual (const QCborArray &lhs, const QCborArray &rhs) noexcept
 
bool comparesEqual (const QCborMap &lhs, const QCborMap &rhs) noexcept
 
static bool shouldArrayRemainArray (qint64 key, QCborValue::Type t, QCborContainerPrivate *container)
 
static void convertArrayToMap (QCborContainerPrivate *&array)
 
static QCborContainerPrivatemaybeGrow (QCborContainerPrivate *container, qsizetype index)
 
size_t qHash (const QCborValue &value, size_t seed)
 
Q_CORE_EXPORT const char * qt_cbor_simpletype_id (QCborSimpleType st)
 
Q_CORE_EXPORT const char * qt_cbor_tag_id (QCborTag tag)
 
static QDebug debugContents (QDebug &dbg, const QCborValue &v)
 
QDebug operator<< (QDebug dbg, const QCborValue &v)
 
QDebug operator<< (QDebug dbg, QCborSimpleType st)
 
QDebug operator<< (QDebug dbg, QCborTag tag)
 
QDebug operator<< (QDebug dbg, QCborKnownTags tag)
 
QDataStreamoperator>> (QDataStream &stream, QCborValue &value)
 

Variables

static QT_BEGIN_NAMESPACE constexpr quint64 MaxAcceptableMemoryUse = (sizeof(void*) == 4 ? 256 : 1024) * 1024 * 1024
 
static Q_DECL_UNUSED constexpr int MaximumRecursionDepth = 1024
 
static Q_DECL_UNUSED constexpr quint64 MaximumPreallocatedElementCount
 

Function Documentation

◆ assignContainer()

static QCborContainerPrivate * assignContainer ( QCborContainerPrivate *& d,
QCborContainerPrivate * x )
static

Definition at line 753 of file qcborvalue.cpp.

References d.

Referenced by convertArrayToMap(), QCborContainerPrivate::findOrAddMapKey(), QCborContainerPrivate::findOrAddMapKey(), maybeGrow(), and QCborValue::operator=().

+ Here is the caller graph for this function:

◆ compareContainer()

static int compareContainer ( const QCborContainerPrivate * c1,
const QCborContainerPrivate * c2,
Comparison mode )
staticnoexcept

Definition at line 1315 of file qcborvalue.cpp.

References c2, compareElementRecursive(), and i.

Referenced by QCborArray::compare(), QCborMap::compare(), and compareElementRecursive().

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

◆ compareElementNoData()

static int compareElementNoData ( const Element & e1,
const Element & e2 )
staticnoexcept

Definition at line 1217 of file qcborvalue.cpp.

References QCborValue::Double, QCborValue::Integer, Q_ASSERT, and QCborValue::Tag.

Referenced by compareElementRecursive().

+ Here is the caller graph for this function:

◆ compareElementRecursive()

static int compareElementRecursive ( const QCborContainerPrivate * c1,
const Element & e1,
const QCborContainerPrivate * c2,
const Element & e2,
Comparison mode )
staticnoexcept

Definition at line 1260 of file qcborvalue.cpp.

References c2, compareContainer(), compareElementNoData(), compareStringsInUtf8(), Q_ASSERT, and typeOrder().

Referenced by QCborValue::compare(), compareContainer(), QCborContainerPrivate::compareElement_helper(), QCborValueConstRef::comparesEqual_helper(), QCborValueConstRef::comparesEqual_helper(), QCborValueConstRef::compareThreeWay_helper(), and QCborValueConstRef::compareThreeWay_helper().

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

◆ comparesEqual() [1/3]

bool comparesEqual ( const QCborArray & lhs,
const QCborArray & rhs )
noexcept

Definition at line 1499 of file qcborvalue.cpp.

◆ comparesEqual() [2/3]

bool comparesEqual ( const QCborMap & lhs,
const QCborMap & rhs )
noexcept

Definition at line 1525 of file qcborvalue.cpp.

◆ comparesEqual() [3/3]

bool comparesEqual ( const QCborValue & lhs,
const QCborValue & rhs )
noexcept

Definition at line 1368 of file qcborvalue.cpp.

◆ compareStringsInUtf8() [1/3]

static int compareStringsInUtf8 ( QStringView lhs,
QStringView rhs,
Comparison mode )
staticnoexcept

Definition at line 1128 of file qcborvalue.cpp.

References nextUtf32Character(), r1, r2, and stringLengthInUtf8().

Referenced by compareElementRecursive(), and compareStringsInUtf8().

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

◆ compareStringsInUtf8() [2/3]

static int compareStringsInUtf8 ( QStringView lhs,
QUtf8StringView rhs,
Comparison mode )
staticnoexcept

Definition at line 1209 of file qcborvalue.cpp.

References compareStringsInUtf8().

+ Here is the call graph for this function:

◆ compareStringsInUtf8() [3/3]

static int compareStringsInUtf8 ( QUtf8StringView lhs,
QStringView rhs,
Comparison mode )
staticnoexcept

Definition at line 1162 of file qcborvalue.cpp.

References ptr(), Q_UNUSED, and stringLengthInUtf8().

+ Here is the call graph for this function:

◆ convertArrayToMap()

static void convertArrayToMap ( QCborContainerPrivate *& array)
static

Definition at line 2444 of file qcborvalue.cpp.

References assignContainer(), QMap< Key, T >::begin(), QCborContainerPrivate::detach(), i, QCborValue::Integer, QCborValue::Invalid, map, Q_ASSERT, Q_LIKELY, and qWarning.

Referenced by QCborContainerPrivate::findOrAddMapKey(), and QCborContainerPrivate::findOrAddMapKey().

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

◆ convertToExtendedType()

static QCborValue::Type convertToExtendedType ( QCborContainerPrivate * d)
static

Definition at line 764 of file qcborvalue.cpp.

References QCborValue::ByteArray, d, QCborValue::DateTime, DateTimeString, QUrl::DecodeReserved, QCborValue::Double, encoded, QDateTime::fromMSecsSinceEpoch(), QCborValue::Integer, QString::isEmpty(), Qt::ISODateWithMs, QUrl::isValid(), ok, qMin(), qMulOverflow(), RegularExpression, QCborValue::RegularExpression, QByteArray::size(), QString::size(), QUrl::StrictMode, QCborValue::String, QCborValue::Tag, tag, text, QString::toLatin1(), QUrl::toString(), QString::toUtf8(), UnixTime_t, url, Url, QCborValue::Url, QTimeZone::UTC, Uuid, and QCborValue::Uuid.

Referenced by QCborValue::QCborValue().

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

◆ debugContents()

static QDebug debugContents ( QDebug & dbg,
const QCborValue & v )
static

Definition at line 3260 of file qcborvalue.cpp.

References QCborValue::Array, QCborValue::ByteArray, QCborValue::DateTime, Qt::dec(), QCborValue::Double, QCborValue::False, Qt::hex(), i, QCborValue::Integer, QCborValue::Invalid, QCborValue::Map, QCborValue::Null, qt_cbor_tag_id(), QCborValue::RegularExpression, QCborValue::SimpleType, QCborValue::String, QCborValue::Tag, tag, QCborValue::True, QCborValue::Undefined, QCborValue::Url, and QCborValue::Uuid.

Referenced by operator<<().

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

◆ maybeGrow()

static QCborContainerPrivate * maybeGrow ( QCborContainerPrivate * container,
qsizetype index )
static

Definition at line 2473 of file qcborvalue.cpp.

References assignContainer(), QCborContainerPrivate::grow(), Q_ASSERT, and Undefined.

Referenced by QCborValue::operator[]().

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

◆ nextUtf32Character()

static auto nextUtf32Character ( const char16_t *& ptr,
const char16_t * end )
staticnoexcept

Definition at line 1099 of file qcborvalue.cpp.

References ptr(), Q_ASSERT, and R.

Referenced by compareStringsInUtf8(), and stringLengthInUtf8().

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

◆ operator<<() [1/4]

QDebug operator<< ( QDebug dbg,
const QCborValue & v )

Definition at line 3320 of file qcborvalue.cpp.

References debugContents().

+ Here is the call graph for this function:

◆ operator<<() [2/4]

QDebug operator<< ( QDebug dbg,
QCborKnownTags tag )

Definition at line 3350 of file qcborvalue.cpp.

References qt_cbor_tag_id(), and tag.

+ Here is the call graph for this function:

◆ operator<<() [3/4]

QDebug operator<< ( QDebug dbg,
QCborSimpleType st )

Definition at line 3327 of file qcborvalue.cpp.

References qt_cbor_simpletype_id().

+ Here is the call graph for this function:

◆ operator<<() [4/4]

QDebug operator<< ( QDebug dbg,
QCborTag tag )

Definition at line 3337 of file qcborvalue.cpp.

References qt_cbor_tag_id(), and tag.

+ Here is the call graph for this function:

◆ operator>>()

QDataStream & operator>> ( QDataStream & stream,
QCborValue & value )

Definition at line 3370 of file qcborvalue.cpp.

◆ qHash()

size_t qHash ( const QCborValue & value,
size_t seed )

Definition at line 3133 of file qcborvalue.cpp.

References QCborValue::Array, QCborValue::ByteArray, QCborValue::DateTime, QCborValue::Double, QCborValue::False, hash, QCborValue::Integer, QCborValue::Invalid, QCborValue::Map, QCborValue::Null, Q_ASSERT, qHash(), QCborValue::RegularExpression, seed, QCborValue::SimpleType, QCborValue::String, QCborValue::Tag, QCborValue::True, QCborValue::Undefined, QCborValue::Url, and QCborValue::Uuid.

Referenced by qHash().

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

◆ qt_cbor_simpletype_id()

Q_CORE_EXPORT const char * qt_cbor_simpletype_id ( QCborSimpleType st)

Definition at line 3186 of file qcborvalue.cpp.

References False, Null, True, and Undefined.

Referenced by operator<<().

+ Here is the caller graph for this function:

◆ qt_cbor_tag_id()

Q_CORE_EXPORT const char * qt_cbor_tag_id ( QCborTag tag)

Definition at line 3201 of file qcborvalue.cpp.

References Base64, Base64url, Bigfloat, COSE_Encrypt, COSE_Encrypt0, COSE_Mac, COSE_Mac0, COSE_Sign, COSE_Sign1, DateTimeString, Decimal, EncodedCbor, ExpectedBase16, ExpectedBase64, ExpectedBase64url, MimeMessage, NegativeBignum, PositiveBignum, RegularExpression, Signature, tag, UnixTime_t, Url, and Uuid.

Referenced by debugContents(), operator<<(), and operator<<().

+ Here is the caller graph for this function:

◆ qt_to_latin1_unchecked()

void qt_to_latin1_unchecked ( uchar * dst,
const char16_t * uc,
qsizetype len )

Definition at line 1188 of file qstring.cpp.

Referenced by QCborContainerPrivate::appendAsciiString(), QtPrivate::count(), and QtPrivate::findString().

+ Here is the caller graph for this function:

◆ shouldArrayRemainArray()

static bool shouldArrayRemainArray ( qint64 key,
QCborValue::Type t,
QCborContainerPrivate * container )
static

Definition at line 2426 of file qcborvalue.cpp.

References QCborValue::Array, QCborContainerPrivate::elements, and QList< T >::size().

Referenced by QCborValue::operator[]().

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

◆ stringLengthInUtf8()

static qsizetype stringLengthInUtf8 ( const char16_t * ptr,
const char16_t * end )
staticnoexcept

Definition at line 1120 of file qcborvalue.cpp.

References nextUtf32Character(), and ptr().

Referenced by compareStringsInUtf8(), and compareStringsInUtf8().

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

◆ typeOrder()

static int typeOrder ( QCborValue::Type e1,
QCborValue::Type e2 )
inlinestatic

Definition at line 907 of file qcborvalue.cpp.

References QCborValue::Tag.

Referenced by compareElementRecursive().

+ Here is the caller graph for this function:

Variable Documentation

◆ MaxAcceptableMemoryUse

QT_BEGIN_NAMESPACE constexpr quint64 MaxAcceptableMemoryUse = (sizeof(void*) == 4 ? 256 : 1024) * 1024 * 1024
staticconstexpr

Definition at line 30 of file qcborvalue.cpp.

◆ MaximumPreallocatedElementCount

Q_DECL_UNUSED constexpr quint64 MaximumPreallocatedElementCount
staticconstexpr
Initial value:
=
static Q_DECL_UNUSED constexpr int MaximumRecursionDepth
static QT_BEGIN_NAMESPACE constexpr quint64 MaxAcceptableMemoryUse

Definition at line 41 of file qcborvalue.cpp.

◆ MaximumRecursionDepth

Q_DECL_UNUSED constexpr int MaximumRecursionDepth = 1024
staticconstexpr

Definition at line 40 of file qcborvalue.cpp.