1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef QMLTYPEREGISTRAR_P_H
5#define QMLTYPEREGISTRAR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QJsonObject>
19#include <QTypeRevision>
20
21#include <cstdlib>
22
23#include "qmetatypesjsonprocessor_p.h"
24
25QT_BEGIN_NAMESPACE
26
27class QmlTypeRegistrar
28{
29 QString m_module;
30 QString m_targetNamespace;
31 QTypeRevision m_moduleVersion;
32 QList<quint8> m_pastMajorVersions;
33 QStringList m_includes;
34 bool m_followForeignVersioning = false;
35 QVector<QJsonObject> m_types;
36 QVector<QJsonObject> m_foreignTypes;
37 QStringList m_referencedTypes;
38
39 QJsonValue findType(const QString &name) const;
40 QJsonValue findTypeForeign(const QString &name) const;
41
42public:
43 void write(QTextStream &os);
44 bool generatePluginTypes(const QString &pluginTypesFile);
45 void setModuleNameAndNamespace(const QString &module, const QString &targetNamespace);
46 void setModuleVersions(QTypeRevision moduleVersion, const QList<quint8> &pastMajorVersions,
47 bool followForeignVersioning);
48 void setIncludes(const QList<QString> &includes);
49 void setTypes(const QVector<QJsonObject> &types, const QVector<QJsonObject> &foreignTypes);
50 void setReferencedTypes(const QStringList &referencedTypes);
51
52 static bool argumentsFromCommandLineAndFile(QStringList &allArguments,
53 const QStringList &arguments);
54 static int runExtract(const QString &baseName, const MetaTypesJsonProcessor &processor);
55};
56
57QT_END_NAMESPACE
58#endif // QMLTYPEREGISTRAR_P_H
59

source code of qtdeclarative/src/qmltyperegistrar/qqmltyperegistrar_p.h