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
qjsoncbor.cpp File Reference

(cdbc76360ae4c12b25923a7cb392355a6485fc70)

#include "qcborvalue.h"
#include "qcborvalue_p.h"
#include "qcborarray.h"
#include "qcbormap.h"
#include "qjsonarray.h"
#include "qjsonobject.h"
#include "qjsondocument.h"
#include "qjson_p.h"
#include <qmap.h>
#include <qhash.h>
#include <private/qnumeric_p.h>
#include <quuid.h>
+ Include dependency graph for qjsoncbor.cpp:

Go to the source code of this file.

Enumerations

enum class  ConversionMode { FromRaw , FromVariantToJson }
 

Functions

static QJsonValue fpToJson (double v)
 
static QString simpleTypeString (QCborValue::Type t)
 
static QString encodeByteArray (const QCborContainerPrivate *d, qsizetype idx, QCborTag encoding)
 
static QString makeString (const QCborContainerPrivate *d, qsizetype idx, ConversionMode mode=ConversionMode::FromRaw)
 
static QString maybeEncodeTag (const QCborContainerPrivate *d)
 
static QString encodeTag (const QCborContainerPrivate *d)
 
QJsonValue qt_convertToJson (QCborContainerPrivate *d, qsizetype idx, ConversionMode mode=ConversionMode::FromRaw)
 
static QJsonValue convertExtendedTypeToJson (QCborContainerPrivate *d)
 
static QJsonArray convertToJsonArray (QCborContainerPrivate *d, ConversionMode mode=ConversionMode::FromRaw)
 
static QJsonObject convertToJsonObject (QCborContainerPrivate *d, ConversionMode mode=ConversionMode::FromRaw)
 
static void appendVariant (QCborContainerPrivate *d, const QVariant &variant)
 

Enumeration Type Documentation

◆ ConversionMode

enum class ConversionMode
strong
Enumerator
FromRaw 
FromVariantToJson 

Definition at line 25 of file qjsoncbor.cpp.

Function Documentation

◆ appendVariant()

static void appendVariant ( QCborContainerPrivate * d,
const QVariant & variant )
static

Definition at line 639 of file qjsoncbor.cpp.

References QByteArray::append(), ba, QCborValue::ByteArray, QByteArray::constData(), d, QCborValue::fromVariant(), QMetaType::id(), QVariant::metaType(), QByteArray::size(), QVariant::toByteArray(), QVariant::toString(), and variant.

Referenced by QCborMap::fromVariantHash(), QCborArray::fromVariantList(), and QCborMap::fromVariantMap().

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

◆ convertExtendedTypeToJson()

static QJsonValue convertExtendedTypeToJson ( QCborContainerPrivate * d)
static

Definition at line 172 of file qjsoncbor.cpp.

References d, DateTimeString, ExpectedBase16, ExpectedBase64, ExpectedBase64url, QUrl::fromEncoded(), QUrl::FullyEncoded, maybeEncodeTag(), Q_FALLTHROUGH, qt_convertToJson(), QCborValue::String, tag, Url, and Uuid.

Referenced by qt_convertToJson().

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

◆ convertToJsonArray()

static QJsonArray convertToJsonArray ( QCborContainerPrivate * d,
ConversionMode mode = ConversionMode::FromRaw )
static

Definition at line 204 of file qjsoncbor.cpp.

References QJsonArray::append(), d, and qt_convertToJson().

Referenced by qt_convertToJson(), QCborArray::toJsonArray(), and QJsonPrivate::Variant::toJsonArray().

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

◆ convertToJsonObject()

static QJsonObject convertToJsonObject ( QCborContainerPrivate * d,
ConversionMode mode = ConversionMode::FromRaw )
static

Definition at line 217 of file qjsoncbor.cpp.

References d, makeString(), o, and qt_convertToJson().

Referenced by qt_convertToJson(), QCborMap::toJsonObject(), and QJsonPrivate::Variant::toJsonObject().

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

◆ encodeByteArray()

static QString encodeByteArray ( const QCborContainerPrivate * d,
qsizetype idx,
QCborTag encoding )
static

Definition at line 44 of file qjsoncbor.cpp.

References QByteArray::Base64UrlEncoding, d, ExpectedBase16, ExpectedBase64, QString::fromLatin1(), QByteArray::fromRawData(), and QByteArray::OmitTrailingEquals.

Referenced by makeString(), and maybeEncodeTag().

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

◆ encodeTag()

static QString encodeTag ( const QCborContainerPrivate * d)
static

Definition at line 96 of file qjsoncbor.cpp.

References d, makeString(), and maybeEncodeTag().

Referenced by makeString().

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

◆ fpToJson()

static QJsonValue fpToJson ( double v)
static

Definition at line 27 of file qjsoncbor.cpp.

References qt_is_finite().

Referenced by qt_convertToJson(), and QCborValue::toJsonValue().

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

◆ makeString()

static Q_NEVER_INLINE QString makeString ( const QCborContainerPrivate * d,
qsizetype idx,
ConversionMode mode = ConversionMode::FromRaw )
static

Definition at line 110 of file qjsoncbor.cpp.

References QCborValue::Array, QCborValue::ByteArray, QCborValue::Compact, d, QCborValue::DateTime, QCborValue::Double, encodeByteArray(), encodeTag(), ExpectedBase64url, QCborValue::False, FromVariantToJson, QCborValue::Integer, QCborValue::Invalid, QCborValue::Map, QCborValue::Null, QString::number(), qFatal, QStringLiteral, QCborValue::RegularExpression, QCborValue::SimpleType, simpleTypeString(), QCborValue::String, QCborValue::Tag, QCborValue::True, QCborValue::Undefined, QCborValue::Url, and QCborValue::Uuid.

Referenced by convertToJsonObject(), encodeTag(), maybeEncodeTag(), qt_convertToJson(), QCborMap::toVariantHash(), and QCborMap::toVariantMap().

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

◆ maybeEncodeTag()

static QString maybeEncodeTag ( const QCborContainerPrivate * d)
static

Definition at line 64 of file qjsoncbor.cpp.

References QCborValue::ByteArray, d, DateTimeString, encodeByteArray(), ExpectedBase16, ExpectedBase64, ExpectedBase64url, QUuid::fromRfc4122(), makeString(), QCborValue::String, tag, QtCbor::Element::type, Url, Uuid, and QUuid::WithoutBraces.

Referenced by convertExtendedTypeToJson(), and encodeTag().

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

◆ qt_convertToJson()

◆ simpleTypeString()

static QString simpleTypeString ( QCborValue::Type t)
static

Definition at line 32 of file qjsoncbor.cpp.

References QString::fromLatin1(), qWarning, and QCborValue::SimpleType.

Referenced by makeString(), and QCborValue::toJsonValue().

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