Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qcborvalue.cpp File Reference
#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/qbytearray_p.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 (Element e1, Element e2)
 
void qt_to_latin1_unchecked (uchar *dst, const char16_t *uc, qsizetype len)
 
static int compareContainer (const QCborContainerPrivate *c1, const QCborContainerPrivate *c2)
 
static int compareElementNoData (const Element &e1, const Element &e2)
 
static int compareElementRecursive (const QCborContainerPrivate *c1, const Element &e1, const QCborContainerPrivate *c2, const Element &e2)
 
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 752 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 
)
static

Definition at line 1193 of file qcborvalue.cpp.

References QList< T >::at(), c2, QCborContainerPrivate::compareElement_helper(), QCborContainerPrivate::elements, i, and QList< T >::size().

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 
)
static

Definition at line 1069 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 
)
static

Definition at line 1112 of file qcborvalue.cpp.

References QtCbor::ByteData::asLatin1(), QtCbor::ByteData::asStringView(), QtCbor::ByteData::byte(), QCborContainerPrivate::byteData(), c2, compareContainer(), compareElementNoData(), QtPrivate::compareStrings(), QtCbor::Element::container, e, QtCbor::Element::flags, QtCbor::Element::IsContainer, QtCbor::ByteData::len, Q_ASSERT, s2, QtCbor::Element::StringIsAscii, QtCbor::Element::StringIsUtf16, and typeOrder().

Referenced by QCborValue::compare(), and QCborContainerPrivate::compareElement_helper().

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

◆ convertArrayToMap()

static void convertArrayToMap ( QCborContainerPrivate *&  array)
static

Definition at line 2229 of file qcborvalue.cpp.

References assignContainer(), QMap< Key, T >::begin(), QCborContainerPrivate::detach(), i, QCborValue::Integer, QCborValue::Invalid, QtCbor::Element::IsContainer, 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 763 of file qcborvalue.cpp.

References QCborValue::ByteArray, d, QCborValue::DateTime, DateTimeString, QUrl::DecodeReserved, QCborValue::Double, e, encoded, QDateTime::fromMSecsSinceEpoch(), QtCbor::Element::HasByteData, QCborValue::Integer, QString::isEmpty(), Qt::ISODateWithMs, QUrl::isValid(), QDateTime::isValid(), ok, qMin(), qMulOverflow(), RegularExpression, QCborValue::RegularExpression, QString::size(), QByteArray::size(), QUrl::StrictMode, QCborValue::String, QtCbor::Element::StringIsAscii, QtCbor::Element::StringIsUtf16, QCborValue::Tag, tag, text, 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 2981 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 2264 of file qcborvalue.cpp.

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

Referenced by QCborValue::operator[]().

+ 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 3041 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 3071 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 3048 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 3058 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 3091 of file qcborvalue.cpp.

References QDataStream::ReadCorruptData.

◆ qHash()

size_t qHash ( const QCborValue value,
size_t  seed 
)

Definition at line 2854 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 2907 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 2922 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 1198 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 2211 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:

◆ typeOrder()

static int typeOrder ( Element  e1,
Element  e2 
)
inlinestatic

Definition at line 906 of file qcborvalue.cpp.

References e, and 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 31 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 42 of file qcborvalue.cpp.

◆ MaximumRecursionDepth

Q_DECL_UNUSED constexpr int MaximumRecursionDepth = 1024
staticconstexpr

Definition at line 41 of file qcborvalue.cpp.