05fc3aef53
Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
// Copyright (C) 2018 Intel Corporation.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef CONVERTER_H
|
|
#define CONVERTER_H
|
|
|
|
#include <QIODevice>
|
|
#include <QPair>
|
|
#include <QVariant>
|
|
#include <QVariantMap>
|
|
#include <QList>
|
|
|
|
class VariantOrderedMap : public QList<QPair<QVariant, QVariant>>
|
|
{
|
|
public:
|
|
VariantOrderedMap() = default;
|
|
VariantOrderedMap(const QVariantMap &map)
|
|
{
|
|
reserve(map.size());
|
|
for (auto it = map.begin(); it != map.end(); ++it)
|
|
append({it.key(), it.value()});
|
|
}
|
|
};
|
|
using Map = VariantOrderedMap;
|
|
Q_DECLARE_METATYPE(Map)
|
|
|
|
class Converter
|
|
{
|
|
protected:
|
|
Converter();
|
|
|
|
public:
|
|
static Converter *null;
|
|
|
|
enum Direction {
|
|
In = 1, Out = 2, InOut = 3
|
|
};
|
|
|
|
enum Option {
|
|
SupportsArbitraryMapKeys = 0x01
|
|
};
|
|
Q_DECLARE_FLAGS(Options, Option)
|
|
|
|
virtual ~Converter() = 0;
|
|
|
|
virtual QString name() = 0;
|
|
virtual Direction directions() = 0;
|
|
virtual Options outputOptions() = 0;
|
|
virtual const char *optionsHelp() = 0;
|
|
virtual bool probeFile(QIODevice *f) = 0;
|
|
virtual QVariant loadFile(QIODevice *f, Converter *&outputConverter) = 0;
|
|
virtual void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) = 0;
|
|
};
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Converter::Options)
|
|
|
|
#endif // CONVERTER_H
|