| 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 <QtCore/qcbormap.h> |
| 19 | #include <QtCore/qversionnumber.h> |
| 20 | |
| 21 | #include <cstdlib> |
| 22 | |
| 23 | #include "qmetatypesjsonprocessor_p.h" |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QmlTypeRegistrar |
| 28 | { |
| 29 | QString m_module; |
| 30 | QString m_targetNamespace; |
| 31 | QTypeRevision m_moduleVersion; |
| 32 | QList<quint8> m_pastMajorVersions; |
| 33 | QList<QString> m_includes; |
| 34 | bool m_followForeignVersioning = false; |
| 35 | QVector<MetaType> m_types; |
| 36 | QVector<MetaType> m_foreignTypes; |
| 37 | QList<QAnyStringView> m_referencedTypes; |
| 38 | QList<UsingDeclaration> m_usingDeclarations; |
| 39 | |
| 40 | MetaType findType(QAnyStringView name) const; |
| 41 | MetaType findTypeForeign(QAnyStringView name) const; |
| 42 | |
| 43 | public: |
| 44 | void write(QTextStream &os, QAnyStringView outFileName) const; |
| 45 | bool generatePluginTypes(const QString &pluginTypesFile, bool generatingJSRoot = false); |
| 46 | void setModuleNameAndNamespace(const QString &module, const QString &targetNamespace); |
| 47 | void setModuleVersions(QTypeRevision moduleVersion, const QList<quint8> &pastMajorVersions, |
| 48 | bool followForeignVersioning); |
| 49 | void setIncludes(const QList<QString> &includes); |
| 50 | void setTypes(const QVector<MetaType> &types, const QVector<MetaType> &foreignTypes); |
| 51 | void setReferencedTypes(const QList<QAnyStringView> &referencedTypes); |
| 52 | void setUsingDeclarations(const QList<UsingDeclaration> &usingDeclarations); |
| 53 | |
| 54 | static bool argumentsFromCommandLineAndFile(QStringList &allArguments, |
| 55 | const QStringList &arguments); |
| 56 | static int ( |
| 57 | const QString &baseName, const QString &nameSpace, |
| 58 | const MetaTypesJsonProcessor &processor); |
| 59 | }; |
| 60 | |
| 61 | QT_END_NAMESPACE |
| 62 | #endif // QMLTYPEREGISTRAR_P_H |
| 63 | |