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
qqmljstypedescriptionreader_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 QQMLJSTYPEDESCRIPTIONREADER_P_H
6#define QQMLJSTYPEDESCRIPTIONREADER_P_H
7
8#include <qtqmlcompilerexports.h>
9
10//
11// W A R N I N G
12// -------------
13//
14// This file is not part of the Qt API. It exists purely as an
15// implementation detail. This header file may change from version to
16// version without notice, or even be removed.
17//
18// We mean it.
19
20#include "qqmljsscope_p.h"
21
22#include <QtQml/private/qqmljsastfwd_p.h>
23
24// for Q_DECLARE_TR_FUNCTIONS
25#include <QtCore/qcoreapplication.h>
26
28
29class QTypeRevision;
30
31class Q_QMLCOMPILER_EXPORT QQmlJSTypeDescriptionReader
32{
33 Q_DECLARE_TR_FUNCTIONS(QQmlJSTypeDescriptionReader)
34public:
35 explicit QQmlJSTypeDescriptionReader(QString fileName, QString data)
36 : m_fileName(std::move(fileName)), m_source(std::move(data)) {}
37
38 Q_DISABLE_COPY_MOVE(QQmlJSTypeDescriptionReader)
39
40 bool operator()(QList<QQmlJSExportedScope> *objects, QStringList *dependencies);
41
42 QString errorMessage() const { return m_errorMessage; }
43 QString warningMessage() const { return m_warningMessage; }
44
45private:
46 void readDocument(QQmlJS::AST::UiProgram *ast);
47 void readModule(QQmlJS::AST::UiObjectDefinition *ast);
48 void readDependencies(QQmlJS::AST::UiScriptBinding *ast);
49 void readComponent(QQmlJS::AST::UiObjectDefinition *ast);
50 void readSignalOrMethod(QQmlJS::AST::UiObjectDefinition *ast, bool isMethod,
51 const QQmlJSScope::Ptr &scope);
52 void readProperty(QQmlJS::AST::UiObjectDefinition *ast, const QQmlJSScope::Ptr &scope);
53 void readEnum(QQmlJS::AST::UiObjectDefinition *ast, const QQmlJSScope::Ptr &scope);
54 void readParameter(QQmlJS::AST::UiObjectDefinition *ast, QQmlJSMetaMethod *metaMethod);
55
56 QString readStringBinding(QQmlJS::AST::UiScriptBinding *ast);
57 bool readBoolBinding(QQmlJS::AST::UiScriptBinding *ast);
58 double readNumericBinding(QQmlJS::AST::UiScriptBinding *ast);
59 QTypeRevision readNumericVersionBinding(QQmlJS::AST::UiScriptBinding *ast);
60 int readIntBinding(QQmlJS::AST::UiScriptBinding *ast);
61 QList<QQmlJSScope::Export> readExports(QQmlJS::AST::UiScriptBinding *ast);
62 void readAliases(QQmlJS::AST::UiScriptBinding *ast, const QQmlJSScope::Ptr &scope);
63 void readInterfaces(QQmlJS::AST::UiScriptBinding *ast, const QQmlJSScope::Ptr &scope);
64 void checkMetaObjectRevisions(
65 QQmlJS::AST::UiScriptBinding *ast, QList<QQmlJSScope::Export> *exports);
66
67 QStringList readStringList(QQmlJS::AST::UiScriptBinding *ast);
68 void readDeferredNames(QQmlJS::AST::UiScriptBinding *ast, const QQmlJSScope::Ptr &scope);
69 void readImmediateNames(QQmlJS::AST::UiScriptBinding *ast, const QQmlJSScope::Ptr &scope);
70 void readEnumValues(QQmlJS::AST::UiScriptBinding *ast, QQmlJSMetaEnum *metaEnum);
71
72 void addError(const QQmlJS::SourceLocation &loc, const QString &message);
73 void addWarning(const QQmlJS::SourceLocation &loc, const QString &message);
74
75 QQmlJS::AST::ArrayPattern *getArray(QQmlJS::AST::UiScriptBinding *ast);
76
77 QString m_fileName;
78 QString m_source;
79 QString m_errorMessage;
80 QString m_warningMessage;
81 QList<QQmlJSExportedScope> *m_objects = nullptr;
82 QStringList *m_dependencies = nullptr;
83 int m_currentCtorIndex = 0;
84 int m_currentMethodIndex = 0;
85};
86
87QT_END_NAMESPACE
88
89#endif // QQMLJSTYPEDESCRIPTIONREADER_P_H
friend bool operator==(const Import &a, const Import &b)
QString prefix() const
bool isValid() const
QTypeRevision version() const
QString name() const
bool isDependency() const
Import()=default
bool isFile() const
friend size_t qHash(const Import &key, size_t seed=0) noexcept
Import(QString prefix, QString name, QTypeRevision version, bool isFile, bool isDependency)
\inmodule QtCore
Combined button and popup list for selecting options.
static QStringList aliases(const QQmlJSScope::ConstPtr &scope)
static const QLatin1String JsrootDotQmltypes
static bool isVersionAllowed(const QQmlJSScope::Export &exportEntry, const QQmlJS::Import &importDescription)
static bool isComposite(const QQmlJSScope::ConstPtr &scope)
static QString resolvePreferredPath(const QString &qmldirPath, const QString &prefer, QQmlJSResourceFileMapper *mapper)
static const QString prefixedName(const QString &prefix, const QString &name)
static const QLatin1String SlashQmldir
static QString internalName(const QQmlJSScope::ConstPtr &scope)
static const QLatin1String PluginsDotQmltypes
QQmlJSImporterFlag
@ UseOptionalImports
@ PreferQmlFilesFromSourceFolder
@ TolerateFileSelectors