From c0a8cfe1677f55daec4bc8626aced41c7ebeb1c4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 21 Sep 2021 15:16:52 -0700 Subject: [PATCH] QFactoryLoader: remove the porting hack to complete the port to CBOR Change-Id: I3eb1bd30e0124f89a052fffd16a6f632c62bcef5 Reviewed-by: Lars Knoll --- src/corelib/plugin/qfactoryloader.cpp | 2 ++ src/corelib/plugin/qfactoryloader_p.h | 23 +++-------------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index a315daa199..b62112b72a 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -105,6 +105,7 @@ bool QPluginParsedMetaData::parse(QByteArrayView raw) return true; } +#if QT_CONFIG(library) QJsonObject QPluginParsedMetaData::toJson() const { // convert from the internal CBOR representation to an external JSON one @@ -126,6 +127,7 @@ QJsonObject QPluginParsedMetaData::toJson() const } return o; } +#endif class QFactoryLoaderPrivate : public QObjectPrivate { diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h index 2cfbcfaa65..f7033d144f 100644 --- a/src/corelib/plugin/qfactoryloader_p.h +++ b/src/corelib/plugin/qfactoryloader_p.h @@ -58,14 +58,13 @@ #include "QtCore/private/qplugin_p.h" #include "QtCore/qcbormap.h" #include "QtCore/qcborvalue.h" -#include "QtCore/qjsonobject.h" #include "QtCore/qmap.h" #include "QtCore/qobject.h" #include "QtCore/qplugin.h" QT_BEGIN_NAMESPACE -class QJsonDocument; +class QJsonObject; class QLibraryPrivate; class QPluginParsedMetaData @@ -87,7 +86,7 @@ public: bool parse(QPluginMetaData metaData) { return parse(QByteArrayView(reinterpret_cast(metaData.data), metaData.size)); } - Q_CORE_EXPORT QJsonObject toJson() const; + QJsonObject toJson() const; // only for QLibrary & QPluginLoader // if data is not a map, toMap() returns empty, so shall these functions QCborMap toCbor() const { return data.toMap(); } @@ -119,23 +118,7 @@ public: QMultiMap keyMap() const; int indexOf(const QString &needle) const; - // this is a temporary gimmick to convert other Qt modules - struct TemporaryHolder { - QList metaData; - TemporaryHolder(QList &&md) : metaData(std::move(md)) {} - operator QList() const { return std::move(metaData); } - - Q_DECL_DEPRECATED_X("Update caller to use QList()") - operator QList() const - { - QList result; - result.reserve(metaData.size()); - for (const QPluginParsedMetaData &pmd : metaData) - result.append(pmd.toJson()); - return result; - } - }; - using MetaDataList = TemporaryHolder; + using MetaDataList = QList; MetaDataList metaData() const; QObject *instance(int index) const;