Provide a feature for CBOR stream I/O
We need to turn it off in bootstrap code. Change-Id: I826e49fbc5f6128e56f84b58d29358dd7b0b9dc5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
821c2eb131
commit
85ed676dff
@ -1086,6 +1086,14 @@ Mozilla License) is included. The data is then also used in QNetworkCookieJar::v
|
||||
"win32_system_libs": {
|
||||
"label": "Windows System Libraries",
|
||||
"condition": "config.win32 && libs.advapi32 && libs.gdi32 && libs.kernel32 && libs.netapi32 && libs.ole32 && libs.shell32 && libs.uuid && libs.user32 && libs.winmm && libs.ws2_32"
|
||||
},
|
||||
"cborstream": {
|
||||
"label": "CBOR stream I/O",
|
||||
"purpose": "Provides support for reading and writing the CBOR binary format.
|
||||
|
||||
Note that this is required for plugin loading. Qt GUI needs QPA plugins for basic operation.",
|
||||
"section": "Utilities",
|
||||
"output": [ "publicFeature" ]
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -74,6 +74,7 @@
|
||||
#else
|
||||
# define QT_FEATURE_alloca_malloc_h -1
|
||||
#endif
|
||||
#define QT_FEATURE_cborstream -1
|
||||
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
|
||||
#define QT_FEATURE_cxx11_random (QT_HAS_INCLUDE(<random>) ? 1 : -1)
|
||||
#define QT_NO_DATASTREAM
|
||||
|
@ -47,6 +47,8 @@
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qstringview.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(cborstream);
|
||||
|
||||
// See qcborcommon.h for why we check
|
||||
#if defined(QT_X11_DEFINES_FOUND)
|
||||
# undef True
|
||||
|
@ -42,7 +42,10 @@
|
||||
#include "qdatastream.h"
|
||||
#include "qcborarray.h"
|
||||
#include "qcbormap.h"
|
||||
|
||||
#if QT_CONFIG(cborstream)
|
||||
#include "qcborstream.h"
|
||||
#endif
|
||||
|
||||
#include <qendian.h>
|
||||
#include <qlocale.h>
|
||||
@ -758,6 +761,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace QtCbor;
|
||||
|
||||
#if QT_CONFIG(cborstream)
|
||||
// in qcborstream.cpp
|
||||
extern void qt_cbor_stream_set_error(QCborStreamReaderPrivate *d, QCborError error);
|
||||
|
||||
@ -799,6 +803,7 @@ static void writeDoubleToCbor(QCborStreamWriter &writer, double d, QCborValue::E
|
||||
|
||||
writer.append(d);
|
||||
}
|
||||
#endif // QT_CONFIG(cborstream)
|
||||
|
||||
static inline int typeOrder(Element e1, Element e2)
|
||||
{
|
||||
@ -1221,6 +1226,7 @@ int QCborMap::compare(const QCborMap &other) const noexcept
|
||||
return compareContainer(d.data(), other.d.data());
|
||||
}
|
||||
|
||||
#if QT_CONFIG(cborstream)
|
||||
static void encodeToCbor(QCborStreamWriter &writer, const QCborContainerPrivate *d, qsizetype idx,
|
||||
QCborValue::EncodingOptions opt)
|
||||
{
|
||||
@ -1632,6 +1638,7 @@ void QCborContainerPrivate::decodeFromCbor(QCborStreamReader &reader)
|
||||
if (reader.lastError() == QCborError::NoError)
|
||||
reader.leaveContainer();
|
||||
}
|
||||
#endif // QT_CONFIG(cborstream)
|
||||
|
||||
/*!
|
||||
Creates a QCborValue with byte array value \a ba. The value can later be
|
||||
@ -2330,6 +2337,7 @@ QCborValueRef QCborValue::operator[](qint64 key)
|
||||
return { container, index };
|
||||
}
|
||||
|
||||
#if QT_CONFIG(cborstream)
|
||||
/*!
|
||||
Decodes one item from the CBOR stream found in \a reader and returns the
|
||||
equivalent representation. This function is recursive: if the item is a map
|
||||
@ -2567,6 +2575,7 @@ void QCborValueRef::toCbor(QCborStreamWriter &writer, QCborValue::EncodingOption
|
||||
{
|
||||
concrete().toCbor(writer, opt);
|
||||
}
|
||||
#endif // QT_CONFIG(cborstream)
|
||||
|
||||
void QCborValueRef::assign(QCborValueRef that, const QCborValue &other)
|
||||
{
|
||||
|
@ -285,6 +285,7 @@ public:
|
||||
static QCborValue fromJsonValue(const QJsonValue &v);
|
||||
QJsonValue toJsonValue() const;
|
||||
|
||||
#if QT_CONFIG(cborstream)
|
||||
static QCborValue fromCbor(QCborStreamReader &reader);
|
||||
static QCborValue fromCbor(const QByteArray &ba, QCborParserError *error = nullptr);
|
||||
static QCborValue fromCbor(const char *data, qsizetype len, QCborParserError *error = nullptr)
|
||||
@ -293,6 +294,7 @@ public:
|
||||
{ return fromCbor(QByteArray(reinterpret_cast<const char *>(data), int(len)), error); }
|
||||
QByteArray toCbor(EncodingOptions opt = NoTransformation);
|
||||
void toCbor(QCborStreamWriter &writer, EncodingOptions opt = NoTransformation);
|
||||
#endif
|
||||
|
||||
QString toDiagnosticNotation(DiagnosticNotationOptions opts = Compact) const;
|
||||
|
||||
@ -435,9 +437,11 @@ public:
|
||||
QVariant toVariant() const { return concrete().toVariant(); }
|
||||
QJsonValue toJsonValue() const;
|
||||
|
||||
#if QT_CONFIG(cborstream)
|
||||
QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation)
|
||||
{ return concrete().toCbor(opt); }
|
||||
void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
|
||||
#endif
|
||||
|
||||
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact)
|
||||
{ return concrete().toDiagnosticNotation(opt); }
|
||||
|
@ -6,7 +6,6 @@ HEADERS += \
|
||||
serialization/qcbormap.h \
|
||||
serialization/qcborvalue.h \
|
||||
serialization/qcborvalue_p.h \
|
||||
serialization/qcborstream.h \
|
||||
serialization/qdatastream.h \
|
||||
serialization/qdatastream_p.h \
|
||||
serialization/qjson_p.h \
|
||||
@ -23,7 +22,6 @@ HEADERS += \
|
||||
serialization/qxmlutils_p.h
|
||||
|
||||
SOURCES += \
|
||||
serialization/qcborstream.cpp \
|
||||
serialization/qcbordiagnostic.cpp \
|
||||
serialization/qcborvalue.cpp \
|
||||
serialization/qdatastream.cpp \
|
||||
@ -39,6 +37,14 @@ SOURCES += \
|
||||
serialization/qxmlstream.cpp \
|
||||
serialization/qxmlutils.cpp
|
||||
|
||||
qtConfig(cborstream): {
|
||||
SOURCES += \
|
||||
serialization/qcborstream.cpp
|
||||
|
||||
HEADERS += \
|
||||
serialization/qcborstream.h
|
||||
}
|
||||
|
||||
false: SOURCES += \
|
||||
serialization/qcborarray.cpp \
|
||||
serialization/qcbormap.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user