Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qqmljsmetatypes_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
4#ifndef QQMLJSMETATYPES_P_H
5#define QQMLJSMETATYPES_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 <private/qtqmlcompilerexports_p.h>
18
19#include <QtCore/qstring.h>
20#include <QtCore/qstringlist.h>
21#include <QtCore/qsharedpointer.h>
22#include <QtCore/qvariant.h>
23#include <QtCore/qhash.h>
24
25#include <QtQml/private/qqmljssourcelocation_p.h>
26#include <QtQml/private/qqmltranslation_p.h>
27
28#include "qqmlsaconstants.h"
29#include "qqmlsa.h"
30#include "qqmljsannotation_p.h"
31
32// MetaMethod and MetaProperty have both type names and actual QQmlJSScope types.
33// When parsing the information from the relevant QML or qmltypes files, we only
34// see the names and don't have a complete picture of the types, yet. In a second
35// pass we typically fill in the types. The types may have multiple exported names
36// and the the name property of MetaProperty and MetaMethod still carries some
37// significance regarding which name was chosen to refer to the type. In a third
38// pass we may further specify the type if the context provides additional information.
39// The parent of an Item, for example, is typically not just a QtObject, but rather
40// some other Item with custom properties.
41
43
44enum ScriptBindingValueType : unsigned int {
46 ScriptValue_Undefined // property int p: undefined
47};
48
50
52class QQmlJSScope;
54{
55 QStringList m_keys;
56 QList<int> m_values; // empty if values unknown.
57 QString m_name;
58 QString m_alias;
59 QString m_typeName;
61 bool m_isFlag = false;
62 bool m_scoped = true;
63
64public:
65 QQmlJSMetaEnum() = default;
66 explicit QQmlJSMetaEnum(QString name) : m_name(std::move(name)) {}
67
68 bool isValid() const { return !m_name.isEmpty(); }
69
70 QString name() const { return m_name; }
71 void setName(const QString &name) { m_name = name; }
72
73 QString alias() const { return m_alias; }
74 void setAlias(const QString &alias) { m_alias = alias; }
75
76 bool isFlag() const { return m_isFlag; }
77 void setIsFlag(bool isFlag) { m_isFlag = isFlag; }
78
79 bool isScoped() const { return m_scoped; }
80 void setScoped(bool v) { m_scoped = v; }
81
82 void addKey(const QString &key) { m_keys.append(key); }
83 QStringList keys() const { return m_keys; }
84
85 void addValue(int value) { m_values.append(value); }
86 QList<int> values() const { return m_values; }
87
88 bool hasValues() const { return !m_values.isEmpty(); }
89 int value(const QString &key) const { return m_values.value(m_keys.indexOf(key)); }
90 bool hasKey(const QString &key) const { return m_keys.indexOf(key) != -1; }
91
92 QString typeName() const { return m_typeName; }
93 void setTypeName(const QString &typeName) { m_typeName = typeName; }
94
95 QSharedPointer<const QQmlJSScope> type() const { return m_type; }
97
98 friend bool operator==(const QQmlJSMetaEnum &a, const QQmlJSMetaEnum &b)
99 {
100 return a.m_keys == b.m_keys
101 && a.m_values == b.m_values
102 && a.m_name == b.m_name
103 && a.m_alias == b.m_alias
104 && a.m_isFlag == b.m_isFlag
105 && a.m_type == b.m_type;
106 }
107
108 friend bool operator!=(const QQmlJSMetaEnum &a, const QQmlJSMetaEnum &b)
109 {
110 return !(a == b);
111 }
112
113 friend size_t qHash(const QQmlJSMetaEnum &e, size_t seed = 0)
114 {
115 return qHashMulti(seed, e.m_keys, e.m_values, e.m_name, e.m_alias, e.m_isFlag, e.m_type);
116 }
117};
118
120{
121public:
131 };
132
136 : m_name(name), m_typeName(typeName), m_type(type), m_typeQualifier(typeQualifier)
137 {
138 }
139
140 QString name() const { return m_name; }
141 void setName(const QString &name) { m_name = name; }
142 QString typeName() const { return m_typeName; }
143 void setTypeName(const QString &typeName) { m_typeName = typeName; }
146 Constness typeQualifier() const { return m_typeQualifier; }
148 bool isPointer() const { return m_isPointer; }
149 void setIsPointer(bool isPointer) { m_isPointer = isPointer; }
150 bool isList() const { return m_isList; }
151 void setIsList(bool isList) { m_isList = isList; }
152
154 {
155 return a.m_name == b.m_name && a.m_typeName == b.m_typeName
156 && a.m_type.toStrongRef().data() == b.m_type.toStrongRef().data()
157 && a.m_typeQualifier == b.m_typeQualifier;
158 }
159
161 {
162 return !(a == b);
163 }
164
165 friend size_t qHash(const QQmlJSMetaParameter &e, size_t seed = 0)
166 {
167 return qHashMulti(seed, e.m_name, e.m_typeName, e.m_type.toStrongRef().data(),
168 e.m_typeQualifier);
169 }
170
171private:
172 QString m_name;
173 QString m_typeName;
175 Constness m_typeQualifier = NonConst;
176 bool m_isPointer = false;
177 bool m_isList = false;
178};
179
181{
182public:
185
186public:
193 enum class RelativeFunctionIndex : int { Invalid = -1 };
194
201 enum class AbsoluteFunctionIndex : int { Invalid = -1 };
202
203 QQmlJSMetaMethod() = default;
205 : m_name(std::move(name)),
206 m_returnTypeName(std::move(returnType)),
207 m_methodType(MethodType::Method)
208 {}
209
210 QString methodName() const { return m_name; }
211 void setMethodName(const QString &name) { m_name = name; }
212
213 QString returnTypeName() const { return m_returnTypeName; }
215 void setReturnTypeName(const QString &type) { m_returnTypeName = type; }
217 {
218 m_returnType = type;
219 }
220
221 QList<QQmlJSMetaParameter> parameters() const { return m_parameters; }
222
224 {
226 for (const auto &p : m_parameters)
227 names.append(p.name());
228
229 return names;
230 }
231
233
234 void addParameter(const QQmlJSMetaParameter &p) { m_parameters.append(p); }
235
236 QQmlJSMetaMethodType methodType() const { return m_methodType; }
238
239 Access access() const { return m_methodAccess; }
240
241 int revision() const { return m_revision; }
242 void setRevision(int r) { m_revision = r; }
243
244 bool isCloned() const { return m_isCloned; }
245 void setIsCloned(bool isCloned) { m_isCloned= isCloned; }
246
247 bool isConstructor() const { return m_isConstructor; }
248 void setIsConstructor(bool isConstructor) { m_isConstructor = isConstructor; }
249
250 bool isJavaScriptFunction() const { return m_isJavaScriptFunction; }
252 {
253 m_isJavaScriptFunction = isJavaScriptFunction;
254 }
255
256 bool isImplicitQmlPropertyChangeSignal() const { return m_isImplicitQmlPropertyChangeSignal; }
257 void setIsImplicitQmlPropertyChangeSignal(bool isPropertyChangeSignal)
258 {
259 m_isImplicitQmlPropertyChangeSignal = isPropertyChangeSignal;
260 }
261
262 bool isValid() const { return !m_name.isEmpty(); }
263
264 const QVector<QQmlJSAnnotation>& annotations() const { return m_annotations; }
266
268 {
269 Q_ASSERT(!m_isConstructor);
270 m_relativeFunctionIndex = index;
271 }
272
274 {
275 Q_ASSERT(!m_isConstructor);
276 return m_relativeFunctionIndex;
277 }
278
280 {
281 Q_ASSERT(m_isConstructor);
282 m_relativeFunctionIndex = index;
283 }
284
286 {
287 Q_ASSERT(m_isConstructor);
288 return m_relativeFunctionIndex;
289 }
290
291 friend bool operator==(const QQmlJSMetaMethod &a, const QQmlJSMetaMethod &b)
292 {
293 return a.m_name == b.m_name && a.m_returnTypeName == b.m_returnTypeName
294 && a.m_returnType == b.m_returnType && a.m_parameters == b.m_parameters
295 && a.m_annotations == b.m_annotations && a.m_methodType == b.m_methodType
296 && a.m_methodAccess == b.m_methodAccess && a.m_revision == b.m_revision
297 && a.m_isConstructor == b.m_isConstructor;
298 }
299
300 friend bool operator!=(const QQmlJSMetaMethod &a, const QQmlJSMetaMethod &b)
301 {
302 return !(a == b);
303 }
304
305 friend size_t qHash(const QQmlJSMetaMethod &method, size_t seed = 0)
306 {
308
309 seed = combine(seed, method.m_name);
310 seed = combine(seed, method.m_returnTypeName);
311 seed = combine(seed, method.m_returnType.toStrongRef().data());
312 seed = combine(seed, method.m_annotations);
313 seed = combine(seed, method.m_methodType);
314 seed = combine(seed, method.m_methodAccess);
315 seed = combine(seed, method.m_revision);
316 seed = combine(seed, method.m_isConstructor);
317
318 for (const auto &type : method.m_parameters) {
319 seed = combine(seed, type);
320 }
321
322 return seed;
323 }
324
325private:
326 QString m_name;
327 QString m_returnTypeName;
329
330 QList<QQmlJSMetaParameter> m_parameters;
331 QList<QQmlJSAnnotation> m_annotations;
332
333 MethodType m_methodType = MethodType::Signal;
334 Access m_methodAccess = Public;
335 int m_revision = 0;
337 bool m_isCloned = false;
338 bool m_isConstructor = false;
339 bool m_isJavaScriptFunction = false;
340 bool m_isImplicitQmlPropertyChangeSignal = false;
341};
342
344{
345 QString m_propertyName;
346 QString m_typeName;
347 QString m_read;
348 QString m_write;
349 QString m_reset;
350 QString m_bindable;
351 QString m_notify;
352 QString m_privateClass;
353 QString m_aliasExpr;
355 QVector<QQmlJSAnnotation> m_annotations;
356 bool m_isList = false;
357 bool m_isWritable = false;
358 bool m_isPointer = false;
359 bool m_isFinal = false;
360 bool m_isConstant = false;
361 int m_revision = 0;
362 int m_index = -1; // relative property index within owning QQmlJSScope
363
364public:
366
367 void setPropertyName(const QString &propertyName) { m_propertyName = propertyName; }
368 QString propertyName() const { return m_propertyName; }
369
370 void setTypeName(const QString &typeName) { m_typeName = typeName; }
371 QString typeName() const { return m_typeName; }
372
373 void setRead(const QString &read) { m_read = read; }
374 QString read() const { return m_read; }
375
376 void setWrite(const QString &write) { m_write = write; }
377 QString write() const { return m_write; }
378
379 void setReset(const QString &reset) { m_reset = reset; }
380 QString reset() const { return m_reset; }
381
382 void setBindable(const QString &bindable) { m_bindable = bindable; }
383 QString bindable() const { return m_bindable; }
384
385 void setNotify(const QString &notify) { m_notify = notify; }
386 QString notify() const { return m_notify; }
387
388 void setPrivateClass(const QString &privateClass) { m_privateClass = privateClass; }
389 QString privateClass() const { return m_privateClass; }
390 bool isPrivate() const { return !m_privateClass.isEmpty(); } // exists for convenience
391
394
395 void setAnnotations(const QList<QQmlJSAnnotation> &annotation) { m_annotations = annotation; }
396 const QList<QQmlJSAnnotation> &annotations() const { return m_annotations; }
397
398 void setIsList(bool isList) { m_isList = isList; }
399 bool isList() const { return m_isList; }
400
401 void setIsWritable(bool isWritable) { m_isWritable = isWritable; }
402 bool isWritable() const { return m_isWritable; }
403
404 void setIsPointer(bool isPointer) { m_isPointer = isPointer; }
405 bool isPointer() const { return m_isPointer; }
406
407 void setAliasExpression(const QString &aliasString) { m_aliasExpr = aliasString; }
408 QString aliasExpression() const { return m_aliasExpr; }
409 bool isAlias() const { return !m_aliasExpr.isEmpty(); } // exists for convenience
410
411 void setIsFinal(bool isFinal) { m_isFinal = isFinal; }
412 bool isFinal() const { return m_isFinal; }
413
414 void setIsConstant(bool isConstant) { m_isConstant = isConstant; }
415 bool isConstant() const { return m_isConstant; }
416
417 void setRevision(int revision) { m_revision = revision; }
418 int revision() const { return m_revision; }
419
420 void setIndex(int index) { m_index = index; }
421 int index() const { return m_index; }
422
423 bool isValid() const { return !m_propertyName.isEmpty(); }
424
426 {
427 return a.m_index == b.m_index && a.m_propertyName == b.m_propertyName
428 && a.m_typeName == b.m_typeName && a.m_bindable == b.m_bindable
429 && a.m_type == b.m_type && a.m_isList == b.m_isList
430 && a.m_isWritable == b.m_isWritable && a.m_isPointer == b.m_isPointer
431 && a.m_aliasExpr == b.m_aliasExpr && a.m_revision == b.m_revision
432 && a.m_isFinal == b.m_isFinal;
433 }
434
436 {
437 return !(a == b);
438 }
439
440 friend size_t qHash(const QQmlJSMetaProperty &prop, size_t seed = 0)
441 {
442 return qHashMulti(seed, prop.m_propertyName, prop.m_typeName, prop.m_bindable,
443 prop.m_type.toStrongRef().data(), prop.m_isList, prop.m_isWritable,
444 prop.m_isPointer, prop.m_aliasExpr, prop.m_revision, prop.m_isFinal,
445 prop.m_index);
446 }
447};
448
458class Q_QMLCOMPILER_PRIVATE_EXPORT QQmlJSMetaPropertyBinding
459{
462
463 // needs to be kept in sync with the BindingType enum
464 struct Content {
465 using Invalid = std::monostate;
466 struct BoolLiteral {
467 bool value;
468 friend bool operator==(BoolLiteral a, BoolLiteral b) { return a.value == b.value; }
469 friend bool operator!=(BoolLiteral a, BoolLiteral b) { return !(a == b); }
470 };
473 QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
474 QT_WARNING_DISABLE_GCC("-Wfloat-equal")
475 friend bool operator==(NumberLiteral a, NumberLiteral b) { return a.value == b.value; }
476 friend bool operator!=(NumberLiteral a, NumberLiteral b) { return !(a == b); }
478
479 double value; // ### TODO: int?
480 };
482 friend bool operator==(StringLiteral a, StringLiteral b) { return a.value == b.value; }
483 friend bool operator!=(StringLiteral a, StringLiteral b) { return !(a == b); }
485 };
487 friend bool operator==(RegexpLiteral a, RegexpLiteral b) { return a.value == b.value; }
488 friend bool operator!=(RegexpLiteral a, RegexpLiteral b) { return !(a == b); }
490 };
491 struct Null {
492 friend bool operator==(Null , Null ) { return true; }
493 friend bool operator!=(Null a, Null b) { return !(a == b); }
494 };
497 {
498 return a.text == b.text && a.comment == b.comment && a.number == b.number && a.context == b.context;
499 }
500 friend bool operator!=(TranslationString a, TranslationString b) { return !(a == b); }
505 };
508 {
509 return a.id == b.id && a.number == b.number;
510 }
511 friend bool operator!=(TranslationById a, TranslationById b) { return !(a == b); }
514 };
515 struct Script {
516 friend bool operator==(Script a, Script b)
517 {
518 return a.index == b.index && a.kind == b.kind;
519 }
520 friend bool operator!=(Script a, Script b) { return !(a == b); }
523 ScriptBindingKind kind = ScriptBindingKind::Script_Invalid;
525 };
526 struct Object {
527 friend bool operator==(Object a, Object b) { return a.value == b.value && a.typeName == b.typeName; }
528 friend bool operator!=(Object a, Object b) { return !(a == b); }
531 };
532 struct Interceptor {
534 {
535 return a.value == b.value && a.typeName == b.typeName;
536 }
537 friend bool operator!=(Interceptor a, Interceptor b) { return !(a == b); }
540 };
541 struct ValueSource {
543 {
544 return a.value == b.value && a.typeName == b.typeName;
545 }
546 friend bool operator!=(ValueSource a, ValueSource b) { return !(a == b); }
549 };
551 /*
552 AttachedProperty binding is a grouping for a series of bindings
553 belonging to the same scope(QQmlJSScope::AttachedPropertyScope).
554 Thus, the attached property binding itself only exposes the
555 attaching type object. Such object is unique per the enclosing
556 scope, so attaching types attached to different QML scopes are
557 different (think of them as objects in C++ terms).
558
559 An attaching type object, being a QQmlJSScope, has bindings
560 itself. For instance:
561 ```
562 Type {
563 Keys.enabled: true
564 }
565 ```
566 tells us that "Type" has an AttachedProperty binding with
567 property name "Keys". The attaching object of that binding
568 (binding.attachingType()) has type "Keys" and a BoolLiteral
569 binding with property name "enabled".
570 */
572 {
573 return a.value == b.value;
574 }
575 friend bool operator!=(AttachedProperty a, AttachedProperty b) { return !(a == b); }
577 };
579 /* Given a group property declaration like
580 anchors.left: root.left
581 the QQmlJSMetaPropertyBinding will have name "anchors", and a m_bindingContent
582 of type GroupProperty, with groupScope pointing to the scope introudced by anchors
583 In that scope, there will be another QQmlJSMetaPropertyBinding, with name "left" and
584 m_bindingContent Script (for root.left).
585 There should never be more than one GroupProperty for the same name in the same
586 scope, though: If the scope also contains anchors.top: root.top that should reuse the
587 GroupProperty content (and add a top: root.top binding in it). There might however
588 still be an additional object or script binding ( anchors: {left: foo, right: bar };
589 anchors: root.someFunction() ) or another binding to the property in a "derived"
590 type.
591
592 ### TODO: Obtaining the effective binding result requires some resolving function
593 */
595 friend bool operator==(GroupProperty a, GroupProperty b) { return a.groupScope == b.groupScope; }
596 friend bool operator!=(GroupProperty a, GroupProperty b) { return !(a == b); }
597 };
598 using type = std::variant<Invalid, BoolLiteral, NumberLiteral, StringLiteral,
599 RegexpLiteral, Null, TranslationString,
600 TranslationById, Script, Object, Interceptor,
601 ValueSource, AttachedProperty, GroupProperty
602 >;
603 };
604 using BindingContent = Content::type;
605
606 QQmlJS::SourceLocation m_sourceLocation;
607 QString m_propertyName; // TODO: this is a debug-only information
608 BindingContent m_bindingContent;
609
610 void ensureSetBindingTypeOnce()
611 {
612 Q_ASSERT(bindingType() == BindingType::Invalid);
613 }
614
615 bool isLiteralBinding() const { return isLiteralBinding(bindingType()); }
616
617
618public:
620 {
621 return type == BindingType::BoolLiteral || type == BindingType::NumberLiteral
622 || type == BindingType::StringLiteral || type == BindingType::RegExpLiteral
623 || type == BindingType::Null; // special. we record it as literal
624 }
625
629 : m_sourceLocation(location), m_propertyName(propName)
630 {
631 }
633 const QQmlJSMetaProperty &prop)
634 : QQmlJSMetaPropertyBinding(location, prop.propertyName())
635 {
636 }
637
638 void setPropertyName(const QString &propertyName) { m_propertyName = propertyName; }
639 QString propertyName() const { return m_propertyName; }
640
641 const QQmlJS::SourceLocation &sourceLocation() const { return m_sourceLocation; }
642
643 BindingType bindingType() const { return BindingType(m_bindingContent.index()); }
644
645 bool isValid() const;
646
648 {
649 ensureSetBindingTypeOnce();
650 m_bindingContent = Content::StringLiteral { value.toString() };
651 }
652
653 void
656 {
657 ensureSetBindingTypeOnce();
658 m_bindingContent = Content::Script { value, kind, valueType };
659 }
660
662 {
663 ensureSetBindingTypeOnce();
664 m_bindingContent = Content::GroupProperty { groupScope };
665 }
666
668 {
669 ensureSetBindingTypeOnce();
670 m_bindingContent = Content::AttachedProperty { attachingScope };
671 }
672
674 {
675 ensureSetBindingTypeOnce();
676 m_bindingContent = Content::BoolLiteral { value };
677 }
678
680 {
681 ensureSetBindingTypeOnce();
682 m_bindingContent = Content::Null {};
683 }
684
686 {
687 ensureSetBindingTypeOnce();
688 m_bindingContent = Content::NumberLiteral { value };
689 }
690
692 {
693 ensureSetBindingTypeOnce();
694 m_bindingContent = Content::RegexpLiteral { value.toString() };
695 }
696
698 {
699 ensureSetBindingTypeOnce();
700 m_bindingContent =
701 Content::TranslationString{ text.toString(), comment.toString(), context.toString(), number };
702 }
703
705 {
706 ensureSetBindingTypeOnce();
707 m_bindingContent = Content::TranslationById{ id.toString(), number };
708 }
709
711 {
712 ensureSetBindingTypeOnce();
713 m_bindingContent = Content::Object { typeName, type };
714 }
715
717 {
718 ensureSetBindingTypeOnce();
719 m_bindingContent = Content::Interceptor { typeName, type };
720 }
721
723 {
724 ensureSetBindingTypeOnce();
725 m_bindingContent = Content::ValueSource { typeName, type };
726 }
727
728 QString literalTypeName() const;
729
730 // ### TODO: here and below: Introduce an allowConversion parameter, if yes, enable conversions e.g. bool -> number?
731 bool boolValue() const;
732
733 double numberValue() const;
734
735 QString stringValue() const;
736
737 QString regExpValue() const;
738
739 QQmlTranslation translationDataValue(QString qmlFileNameForContext = QStringLiteral("")) const;
740
741 QSharedPointer<const QQmlJSScope> literalType(const QQmlJSTypeResolver *resolver) const;
742
744 {
745 if (auto *script = std::get_if<Content::Script>(&m_bindingContent))
746 return script->index;
747 // warn
749 }
750
752 {
753 if (auto *script = std::get_if<Content::Script>(&m_bindingContent))
754 return script->kind;
755 // warn
756 return ScriptBindingKind::Script_Invalid;
757 }
758
760 {
761 if (auto *script = std::get_if<Content::Script>(&m_bindingContent))
762 return script->valueType;
763 // warn
765 }
766
768 {
769 if (auto *object = std::get_if<Content::Object>(&m_bindingContent))
770 return object->typeName;
771 // warn
772 return {};
773 }
775 {
776 if (auto *object = std::get_if<Content::Object>(&m_bindingContent))
777 return object->value.lock();
778 // warn
779 return {};
780 }
781
783 {
784 if (auto *interceptor = std::get_if<Content::Interceptor>(&m_bindingContent))
785 return interceptor->typeName;
786 // warn
787 return {};
788 }
790 {
791 if (auto *interceptor = std::get_if<Content::Interceptor>(&m_bindingContent))
792 return interceptor->value.lock();
793 // warn
794 return {};
795 }
796
798 {
799 if (auto *valueSource = std::get_if<Content::ValueSource>(&m_bindingContent))
800 return valueSource->typeName;
801 // warn
802 return {};
803 }
805 {
806 if (auto *valueSource = std::get_if<Content::ValueSource>(&m_bindingContent))
807 return valueSource->value.lock();
808 // warn
809 return {};
810 }
811
813 {
814 if (auto *group = std::get_if<Content::GroupProperty>(&m_bindingContent))
815 return group->groupScope.lock();
816 // warn
817 return {};
818 }
819
821 {
822 if (auto *attached = std::get_if<Content::AttachedProperty>(&m_bindingContent))
823 return attached->value.lock();
824 // warn
825 return {};
826 }
827
828 bool hasLiteral() const
829 {
830 // TODO: Assumption: if the type is literal, we must have one
831 return isLiteralBinding();
832 }
833 bool hasObject() const { return bindingType() == BindingType::Object; }
834 bool hasInterceptor() const
835 {
836 return bindingType() == BindingType::Interceptor;
837 }
838 bool hasValueSource() const
839 {
840 return bindingType() == BindingType::ValueSource;
841 }
842
844 {
845 return a.m_propertyName == b.m_propertyName
846 && a.m_bindingContent == b.m_bindingContent
847 && a.m_sourceLocation == b.m_sourceLocation;
848 }
849
851 {
852 return !(a == b);
853 }
854
855 friend size_t qHash(const QQmlJSMetaPropertyBinding &binding, size_t seed = 0)
856 {
857 // we don't need to care about the actual binding content when hashing
858 return qHashMulti(seed, binding.m_propertyName, binding.m_sourceLocation,
859 binding.bindingType());
860 }
861};
862
863struct Q_QMLCOMPILER_PRIVATE_EXPORT QQmlJSMetaSignalHandler
864{
867};
868
870
871#endif // QQMLJSMETATYPES_P_H
Definition main.cpp:8
\inmodule QtCore
Definition qlist.h:74
bool isEmpty() const noexcept
Definition qlist.h:390
T value(qsizetype i) const
Definition qlist.h:661
void append(parameter_type t)
Definition qlist.h:441
QString typeName() const
void setIsFlag(bool isFlag)
friend bool operator!=(const QQmlJSMetaEnum &a, const QQmlJSMetaEnum &b)
void setName(const QString &name)
QQmlJSMetaEnum()=default
friend size_t qHash(const QQmlJSMetaEnum &e, size_t seed=0)
friend bool operator==(const QQmlJSMetaEnum &a, const QQmlJSMetaEnum &b)
void setTypeName(const QString &typeName)
bool hasKey(const QString &key) const
void setType(const QSharedPointer< const QQmlJSScope > &type)
QSharedPointer< const QQmlJSScope > type() const
int value(const QString &key) const
void addValue(int value)
bool isScoped() const
QList< int > values() const
bool isFlag() const
QString alias() const
QStringList keys() const
bool isValid() const
void addKey(const QString &key)
void setScoped(bool v)
void setAlias(const QString &alias)
QString name() const
QQmlJSMetaEnum(QString name)
bool hasValues() const
friend bool operator!=(const QQmlJSMetaMethod &a, const QQmlJSMetaMethod &b)
bool isJavaScriptFunction() const
QStringList parameterNames() const
bool isConstructor() const
Access access() const
void setIsImplicitQmlPropertyChangeSignal(bool isPropertyChangeSignal)
void setIsConstructor(bool isConstructor)
void setReturnType(const QSharedPointer< const QQmlJSScope > &type)
QQmlJSMetaMethod()=default
RelativeFunctionIndex jsFunctionIndex() const
void setIsJavaScriptFunction(bool isJavaScriptFunction)
QString methodName() const
friend size_t qHash(const QQmlJSMetaMethod &method, size_t seed=0)
QQmlJSMetaMethodType MethodType
void setMethodName(const QString &name)
RelativeFunctionIndex constructorIndex() const
void setMethodType(MethodType methodType)
void setAnnotations(QVector< QQmlJSAnnotation > annotations)
const QVector< QQmlJSAnnotation > & annotations() const
bool isImplicitQmlPropertyChangeSignal() const
friend bool operator==(const QQmlJSMetaMethod &a, const QQmlJSMetaMethod &b)
void setJsFunctionIndex(RelativeFunctionIndex index)
QString returnTypeName() const
QQmlJSMetaMethod(QString name, QString returnType=QString())
QList< QQmlJSMetaParameter > parameters() const
void setIsCloned(bool isCloned)
void setParameters(const QList< QQmlJSMetaParameter > &parameters)
void setConstructorIndex(RelativeFunctionIndex index)
void addParameter(const QQmlJSMetaParameter &p)
void setReturnTypeName(const QString &type)
QSharedPointer< const QQmlJSScope > returnType() const
QQmlJSMetaMethodType methodType() const
void setIsPointer(bool isPointer)
QQmlJSMetaParameter(const QString &name, const QString &typeName, Constness typeQualifier=NonConst, QWeakPointer< const QQmlJSScope > type={})
void setType(QWeakPointer< const QQmlJSScope > type)
void setIsList(bool isList)
friend bool operator!=(const QQmlJSMetaParameter &a, const QQmlJSMetaParameter &b)
friend size_t qHash(const QQmlJSMetaParameter &e, size_t seed=0)
void setName(const QString &name)
void setTypeName(const QString &typeName)
void setTypeQualifier(Constness typeQualifier)
Constness typeQualifier() const
QString typeName() const
friend bool operator==(const QQmlJSMetaParameter &a, const QQmlJSMetaParameter &b)
QSharedPointer< const QQmlJSScope > type() const
void setStringLiteral(QAnyStringView value)
void setScriptBinding(QQmlJSMetaMethod::RelativeFunctionIndex value, ScriptBindingKind kind, ScriptBindingValueType valueType=ScriptBindingValueType::ScriptValue_Unknown)
void setRegexpLiteral(QAnyStringView value)
void setInterceptor(const QString &typeName, const QSharedPointer< const QQmlJSScope > &type)
QSharedPointer< const QQmlJSScope > interceptorType() const
QQmlJSMetaPropertyBinding(QQmlJS::SourceLocation location, const QString &propName)
void setTranslationId(QStringView id, int number)
QSharedPointer< const QQmlJSScope > objectType() const
QQmlJSMetaPropertyBinding(QQmlJS::SourceLocation location, const QQmlJSMetaProperty &prop)
friend bool operator==(const QQmlJSMetaPropertyBinding &a, const QQmlJSMetaPropertyBinding &b)
static bool isLiteralBinding(BindingType type)
QString interceptorTypeName() const
void setObject(const QString &typeName, const QSharedPointer< const QQmlJSScope > &type)
void setGroupBinding(const QSharedPointer< const QQmlJSScope > &groupScope)
ScriptBindingKind scriptKind() const
void setPropertyName(const QString &propertyName)
QSharedPointer< const QQmlJSScope > groupType() const
ScriptBindingValueType scriptValueType() const
BindingType bindingType() const
const QQmlJS::SourceLocation & sourceLocation() const
QSharedPointer< const QQmlJSScope > valueSourceType() const
friend bool operator!=(const QQmlJSMetaPropertyBinding &a, const QQmlJSMetaPropertyBinding &b)
void setNumberLiteral(double value)
QQmlJSMetaPropertyBinding(QQmlJS::SourceLocation location)
QQmlJSMetaMethod::RelativeFunctionIndex scriptIndex() const
void setAttachedBinding(const QSharedPointer< const QQmlJSScope > &attachingScope)
void setTranslation(QStringView text, QStringView comment, QStringView context, int number)
QSharedPointer< const QQmlJSScope > attachingType() const
QString valueSourceTypeName() const
void setValueSource(const QString &typeName, const QSharedPointer< const QQmlJSScope > &type)
friend size_t qHash(const QQmlJSMetaPropertyBinding &binding, size_t seed=0)
friend bool operator!=(const QQmlJSMetaProperty &a, const QQmlJSMetaProperty &b)
QString notify() const
QString aliasExpression() const
friend bool operator==(const QQmlJSMetaProperty &a, const QQmlJSMetaProperty &b)
void setPropertyName(const QString &propertyName)
void setAnnotations(const QList< QQmlJSAnnotation > &annotation)
void setIsList(bool isList)
QString bindable() const
QSharedPointer< const QQmlJSScope > type() const
void setPrivateClass(const QString &privateClass)
void setRead(const QString &read)
friend size_t qHash(const QQmlJSMetaProperty &prop, size_t seed=0)
void setBindable(const QString &bindable)
void setWrite(const QString &write)
QString reset() const
void setRevision(int revision)
void setIsFinal(bool isFinal)
void setIsConstant(bool isConstant)
QString typeName() const
QString write() const
const QList< QQmlJSAnnotation > & annotations() const
void setTypeName(const QString &typeName)
QQmlJSMetaProperty()=default
void setReset(const QString &reset)
QString privateClass() const
void setIsWritable(bool isWritable)
void setAliasExpression(const QString &aliasString)
void setIndex(int index)
void setNotify(const QString &notify)
void setType(const QSharedPointer< const QQmlJSScope > &type)
QString propertyName() const
void setIsPointer(bool isPointer)
Tracks the types for the QmlCompiler.
\inmodule QtCore
T * data() const noexcept
Returns the value of the pointer referenced by this object.
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:76
QString toString() const
Returns a deep copy of this string view's data as a QString.
Definition qstring.h:1014
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
\inmodule QtCore
QSharedPointer< T > toStrongRef() const
Promotes this weak reference to a strong one and returns a QSharedPointer object holding that referen...
QString text
double e
MethodType
Definition qqmlsa.h:55
Combined button and popup list for selecting options.
static void * context
#define QT_WARNING_POP
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_PUSH
#define QT_WARNING_DISABLE_CLANG(text)
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
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
@ Invalid
const char * typeName
GLint location
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLuint64 key
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint index
[2]
GLboolean r
[2]
GLenum type
GLboolean GLuint group
GLuint name
GLboolean reset
GLuint GLuint * names
GLfloat GLfloat p
[1]
QQmlSA::MethodType QQmlJSMetaMethodType
ScriptBindingValueType
@ ScriptValue_Unknown
@ ScriptValue_Undefined
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
BindingType
#define QStringLiteral(str)
friend bool operator!=(AttachedProperty a, AttachedProperty b)
friend bool operator==(AttachedProperty a, AttachedProperty b)
friend bool operator==(BoolLiteral a, BoolLiteral b)
friend bool operator!=(BoolLiteral a, BoolLiteral b)
friend bool operator!=(GroupProperty a, GroupProperty b)
friend bool operator==(GroupProperty a, GroupProperty b)
friend bool operator==(Interceptor a, Interceptor b)
friend bool operator!=(Interceptor a, Interceptor b)
friend bool operator!=(NumberLiteral a, NumberLiteral b)
QWeakPointer< const QQmlJSScope > value
friend bool operator!=(Object a, Object b)
friend bool operator==(Object a, Object b)
friend bool operator!=(RegexpLiteral a, RegexpLiteral b)
friend bool operator==(RegexpLiteral a, RegexpLiteral b)
friend bool operator==(Script a, Script b)
friend bool operator!=(Script a, Script b)
friend bool operator==(StringLiteral a, StringLiteral b)
friend bool operator!=(StringLiteral a, StringLiteral b)
friend bool operator!=(TranslationById a, TranslationById b)
friend bool operator==(TranslationById a, TranslationById b)
friend bool operator==(TranslationString a, TranslationString b)
friend bool operator!=(TranslationString a, TranslationString b)
friend bool operator!=(ValueSource a, ValueSource b)
friend bool operator==(ValueSource a, ValueSource b)