Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmlsa_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 QQMLSA_P_H
5#define QQMLSA_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#include <qtqmlcompilerexports.h>
18
19#include <private/qqmljslogger_p.h>
20#include <QtCore/qset.h>
21#include "qqmljsmetatypes_p.h"
22
23#include <map>
24#include <unordered_map>
25#include <vector>
26#include <memory>
27
29
33
34namespace QQmlSA {
35
36class Bindings;
37class GenericPassPrivate;
38class PassManager;
39
41
42enum class Flag {
43 Creatable = 0x1,
44 Composite = 0x2,
45 Singleton = 0x4,
46 Script = 0x8,
47 CustomParser = 0x10,
48 Array = 0x20,
49 InlineComponent = 0x40,
51 HasBaseTypeError = 0x100,
53 IsListProperty = 0x400,
54};
55
63
65{
67 std::shared_ptr<QQmlSA::PropertyPass> pass;
68 bool allowInheritance = true;
69};
70
72{
73 friend class QT_PREPEND_NAMESPACE(QQmlJSMetaPropertyBinding);
74 Q_DECLARE_PUBLIC(QQmlSA::Binding::Bindings)
75
76public:
80 ~BindingsPrivate() = default;
81
84
86 createBindings(const QMultiHash<QString, QQmlJSMetaPropertyBinding> &);
90
91private:
92 QMultiHash<QString, Binding> m_bindings;
94};
95
97{
98 friend class QT_PREPEND_NAMESPACE(QQmlJSMetaPropertyBinding);
99 Q_DECLARE_PUBLIC(Binding)
100
101public:
102 explicit BindingPrivate(Binding *);
104
106 static QQmlJSMetaPropertyBinding binding(QQmlSA::Binding &binding);
107 static const QQmlJSMetaPropertyBinding binding(const QQmlSA::Binding &binding);
108
109private:
111 Binding *q_ptr;
112};
113
115{
116 friend class QT_PREPEND_NAMESPACE(QQmlJSMetaMethod);
117 Q_DECLARE_PUBLIC(Method)
118
119public:
120 explicit MethodPrivate(Method *);
122
123 QString methodName() const;
124 QQmlSA::SourceLocation sourceLocation() const;
125 MethodType methodType() const;
126
127 static QQmlSA::Method createMethod(const QQmlJSMetaMethod &);
128 static QQmlJSMetaMethod method(const QQmlSA::Method &);
129
130private:
131 QQmlJSMetaMethod m_method;
132 Method *q_ptr;
133};
134
136{
137 friend class QT_PREPEND_NAMESPACE(QQmlJSMetaMethod);
138 Q_DECLARE_PUBLIC(QQmlSA::Method::Methods)
139
140public:
144 ~MethodsPrivate() = default;
145
148
149 static QQmlSA::Method::Methods createMethods(const QMultiHash<QString, QQmlJSMetaMethod> &);
150
151private:
152 QMultiHash<QString, Method> m_methods;
154};
155
157{
158 friend class QT_PREPEND_NAMESPACE(QQmlJSMetaProperty);
159 Q_DECLARE_PUBLIC(QQmlSA::Property)
160
161public:
162 explicit PropertyPrivate(Property *);
165 ~PropertyPrivate() = default;
166
167 QString typeName() const;
168 bool isValid() const;
169 bool isReadonly() const;
170 QQmlSA::Element type() const;
171
173 static QQmlSA::Property createProperty(const QQmlJSMetaProperty &);
174
175private:
176 QQmlJSMetaProperty m_property;
177 QQmlSA::Property *q_ptr;
178};
179
180class Q_QMLCOMPILER_EXPORT PassManagerPrivate
181{
182 friend class QT_PREPEND_NAMESPACE(QQmlJSScope);
183
184public:
185 Q_DISABLE_COPY_MOVE(PassManagerPrivate)
186
187 friend class GenericPass;
189 : m_visitor(visitor), m_typeResolver(resolver)
190 {
191 }
192
193 static PassManagerPrivate *get(PassManager *manager) { return manager->d_func(); }
194 static const PassManagerPrivate *get(const PassManager *manager) { return manager->d_func(); }
196 {
198 result->d_ptr = std::make_unique<PassManagerPrivate>(visitor, resolver);
199 return result;
200 }
201 static void deletePassManager(PassManager *q) { delete q; }
202
203 void registerElementPass(std::unique_ptr<ElementPass> pass);
204 bool registerPropertyPass(std::shared_ptr<PropertyPass> pass, QAnyStringView moduleName,
206 QAnyStringView propertyName = QAnyStringView(),
207 bool allowInheritance = true);
208 void analyze(const Element &root);
209
211
212 static QQmlJSImportVisitor *visitor(const QQmlSA::PassManager &);
213 static QQmlJSTypeResolver *resolver(const QQmlSA::PassManager &);
214
215
216 QSet<PropertyPass *> findPropertyUsePasses(const QQmlSA::Element &element,
217 const QString &propertyName);
218
219 void analyzeWrite(const QQmlSA::Element &element, QString propertyName,
220 const QQmlSA::Element &value, const QQmlSA::Element &writeScope,
222 void analyzeRead(const QQmlSA::Element &element, QString propertyName,
224 void analyzeBinding(const QQmlSA::Element &element, const QQmlSA::Element &value,
226
227 void addBindingSourceLocations(const QQmlSA::Element &element,
228 const QQmlSA::Element &scope = QQmlSA::Element(),
229 const QString prefix = QString(), bool isAttached = false);
230
231 std::vector<std::shared_ptr<ElementPass>> m_elementPasses;
232 std::multimap<QString, PropertyPassInfo> m_propertyPasses;
233 std::unordered_map<quint32, BindingInfo> m_bindingsByLocation;
236};
237
239{
240 Q_DECLARE_PUBLIC(FixSuggestion)
241 friend class QT_PREPEND_NAMESPACE(QQmlJSFixSuggestion);
242
243public:
245 FixSuggestionPrivate(FixSuggestion *, const QString &fixDescription,
246 const QQmlSA::SourceLocation &location, const QString &replacement);
250
251 QString fixDescription() const;
253 QString replacement() const;
254
255 void setFileName(const QString &);
256 QString fileName() const;
257
258 void setHint(const QString &);
259 QString hint() const;
260
261 void setAutoApplicable(bool autoApplicable = true);
262 bool isAutoApplicable() const;
263
264 static QQmlJSFixSuggestion &fixSuggestion(QQmlSA::FixSuggestion &);
265 static const QQmlJSFixSuggestion &fixSuggestion(const QQmlSA::FixSuggestion &);
266
267private:
268 QQmlJSFixSuggestion m_fixSuggestion;
269 QQmlSA::FixSuggestion *q_ptr;
270};
271
272} // namespace QQmlSA
273
275
276#endif
\inmodule QtCore
\inmodule QtCore
Definition qhash.h:1840
\inmodule QtQmlCompiler
Definition qqmlsa.h:57
\inmodule QtQmlCompiler
Definition qqmlsa.h:52
\inmodule QtQmlCompiler
Definition qqmlsa.h:193
\inmodule QtQmlCompiler
Definition qqmlsa.h:386
\inmodule QtQmlCompiler
Definition qqmlsa.h:272
\inmodule QtQmlCompiler
Definition qqmlsa.h:116
\inmodule QtQmlCompiler
Definition qqmlsa.h:111
static const PassManagerPrivate * get(const PassManager *manager)
Definition qqmlsa_p.h:194
bool hasImportedModule(QAnyStringView name) const
QQmlJSImportVisitor * m_visitor
Definition qqmlsa_p.h:234
std::multimap< QString, PropertyPassInfo > m_propertyPasses
Definition qqmlsa_p.h:232
static void deletePassManager(PassManager *q)
Definition qqmlsa_p.h:201
std::vector< std::shared_ptr< ElementPass > > m_elementPasses
Definition qqmlsa_p.h:231
static PassManagerPrivate * get(PassManager *manager)
Definition qqmlsa_p.h:193
static PassManager * createPassManager(QQmlJSImportVisitor *visitor, QQmlJSTypeResolver *resolver)
Definition qqmlsa_p.h:195
QQmlJSTypeResolver * m_typeResolver
Definition qqmlsa_p.h:235
std::unordered_map< quint32, BindingInfo > m_bindingsByLocation
Definition qqmlsa_p.h:233
\inmodule QtQmlCompiler
Definition qqmlsa.h:303
\inmodule QtQmlCompiler
Definition qqmlsa.h:160
\inmodule QtQmlCompiler
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtQmlCompiler
MethodType
Definition qqmlsa.h:49
AccessSemantics
Definition qqmlsa_p.h:40
@ WrappedInImplicitComponent
Combined button and popup list for selecting options.
std::pair< T1, T2 > QPair
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
static QString methodName(const QDBusIntrospection::Method &method)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
const char * typeName
GLint location
GLenum type
GLuint name
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLuint64EXT * result
[6]
static QQmlAnyBinding createBinding(const QQmlProperty &prop, const QV4::CompiledData::Binding *binding, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &compilationUnit, const QQmlRefPointer< QQmlContextData > &contextData, QObject *scopeObject)
Definition qqmlbind.cpp:710
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
const char property[13]
Definition qwizard.cpp:101
#define explicit
file setFileName("readme.txt")
QNetworkAccessManager manager
QQmlSA::Binding binding
Definition qqmlsa_p.h:59
QString fullPropertyName
Definition qqmlsa_p.h:58
QQmlSA::Element bindingScope
Definition qqmlsa_p.h:60
std::shared_ptr< QQmlSA::PropertyPass > pass
Definition qqmlsa_p.h:67
QStringList properties
Definition qqmlsa_p.h:66