QFactoryLoader: remove the porting hack to complete the port to CBOR

Change-Id: I3eb1bd30e0124f89a052fffd16a6f632c62bcef5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Thiago Macieira 2021-09-21 15:16:52 -07:00
parent bcbc36b8bf
commit c0a8cfe167
2 changed files with 5 additions and 20 deletions

View File

@ -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
{

View File

@ -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<const char *>(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<int, QString> keyMap() const;
int indexOf(const QString &needle) const;
// this is a temporary gimmick to convert other Qt modules
struct TemporaryHolder {
QList<QPluginParsedMetaData> metaData;
TemporaryHolder(QList<QPluginParsedMetaData> &&md) : metaData(std::move(md)) {}
operator QList<QPluginParsedMetaData>() const { return std::move(metaData); }
Q_DECL_DEPRECATED_X("Update caller to use QList<QPluginParsedMetaData>()")
operator QList<QJsonObject>() const
{
QList<QJsonObject> result;
result.reserve(metaData.size());
for (const QPluginParsedMetaData &pmd : metaData)
result.append(pmd.toJson());
return result;
}
};
using MetaDataList = TemporaryHolder;
using MetaDataList = QList<QPluginParsedMetaData>;
MetaDataList metaData() const;
QObject *instance(int index) const;