Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmltypescreator_p.h
Go to the documentation of this file.
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// Qt-Security score:significant
4
5#ifndef QMLTYPESCREATOR_P_H
6#define QMLTYPESCREATOR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
21
22#include <QtCore/qhash.h>
23#include <QtCore/qstring.h>
24#include <QtCore/qset.h>
25
27
29{
30public:
32
33 bool generate(const QString &outFileName);
34
35 void setOwnTypes(QList<MetaType> ownTypes) { m_ownTypes = std::move(ownTypes); }
36 void setForeignTypes(QList<MetaType> foreignTypes) { m_foreignTypes = std::move(foreignTypes); }
37 void setReferencedTypes(QList<QAnyStringView> referencedTypes) { m_referencedTypes = std::move(referencedTypes); }
38 void setModule(QByteArray module) { m_module = std::move(module); }
39 void setVersion(QTypeRevision version) { m_version = version; }
40 void setUsingDeclarations(QList<UsingDeclaration> usingDeclarations) { m_usingDeclarations = std::move(usingDeclarations);}
41 void setGeneratingJSRoot(bool jsroot) { m_generatingJSRoot = jsroot; }
42 void setForeignTypeMetaObjectHashes(const QHash<QAnyStringView, QAnyStringView> &foreignHashes)
43 {
44 m_foreignTypeMetaObjectHashes = foreignHashes;
45 }
46
47private:
48 void writeComponent(const QmlTypesClassDescription &collector);
49 void writeClassProperties(const QmlTypesClassDescription &collector);
50 void writeType(QAnyStringView type);
51 void writeProperties(const Property::Container &properties);
52 void writeMethods(const Method::Container &methods, QLatin1StringView type);
53 void writeEnums(const Enum::Container &enums);
54 void writeComponents();
55 void writeRootMethods(const MetaType &classDef);
56
57 QByteArray m_output;
58 QQmlJSStreamWriter m_qml;
59 QList<MetaType> m_ownTypes;
60 QList<MetaType> m_foreignTypes;
61 QList<QAnyStringView> m_referencedTypes;
62 QList<UsingDeclaration> m_usingDeclarations;
63 QByteArray m_module;
64 QTypeRevision m_version = QTypeRevision::zero();
65 QHash<QAnyStringView, QAnyStringView> m_foreignTypeMetaObjectHashes;
66 bool m_generatingJSRoot = false;
67};
68
69QT_END_NAMESPACE
70
71#endif // QMLTYPESCREATOR_P_H
MetaType()=default
bool generatePluginTypes(const QString &pluginTypesFile, bool generatingJSRoot=false)
void setModuleNameAndNamespace(const QString &module, const QString &targetNamespace)
static bool argumentsFromCommandLineAndFile(QStringList &allArguments, const QStringList &arguments)
void setIncludes(const QList< QString > &includes)
static int runExtract(const QString &baseName, const QString &nameSpace, const MetaTypesJsonProcessor &processor)
void setTypes(const QList< MetaType > &types, const QList< MetaType > &foreignTypes)
void write(QTextStream &os, QAnyStringView outFileName) const
void setModuleVersions(QTypeRevision moduleVersion, const QList< quint8 > &pastMajorVersions, bool followForeignVersioning)
void setUsingDeclarations(const QList< UsingDeclaration > &usingDeclarations)
void setForeignTypeMetaObjectHashes(const QHash< QAnyStringView, QAnyStringView > &foreignHashes)
void setReferencedTypes(const QList< QAnyStringView > &referencedTypes)
void setGeneratingJSRoot(bool jsroot)
void setUsingDeclarations(QList< UsingDeclaration > usingDeclarations)
void setForeignTypeMetaObjectHashes(const QHash< QAnyStringView, QAnyStringView > &foreignHashes)
void setForeignTypes(QList< MetaType > foreignTypes)
bool generate(const QString &outFileName)
void setModule(QByteArray module)
void setOwnTypes(QList< MetaType > ownTypes)
void setVersion(QTypeRevision version)
void setReferencedTypes(QList< QAnyStringView > referencedTypes)
Combined button and popup list for selecting options.
static QString registrationVarName(const QString &module)
bool operator<(const ExclusiveVersionRange &x, const ExclusiveVersionRange &y)
True if x was removed before y was introduced.
QString conflictingVersionToString(const ExclusiveVersionRange &r)
bool operator==(const ExclusiveVersionRange &x, const ExclusiveVersionRange &y)
True when x and y share a common version.