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
qqmltypewrapper_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QV8TYPEWRAPPER_P_H
5#define QV8TYPEWRAPPER_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/qglobal.h>
19#include <QtCore/qpointer.h>
20
21#include <private/qv4value_p.h>
22#include <private/qv4functionobject_p.h>
23#include <private/qv4qmetaobjectwrapper_p.h>
24
26
28class QQmlType;
29class QQmlTypePrivate;
30struct QQmlImportRef;
31
32namespace QV4 {
33
34namespace Heap {
35
37
43
44 enum Kind : quint8 {
45 Type = 0x0,
46 Namespace = 0x2,
47 KindMask = 0x2
48 };
49
52
53 void destroy();
54
55 const QMetaObject *metaObject() const { return type().metaObject(); }
56 QMetaType metaType() const { return type().typeId(); }
57
58 QQmlType type() const;
60 Kind kind() const { return Kind(flags & KindMask); }
61
64 {
65 Q_ASSERT(kind() == Type);
66 if (!t.constructors && metaObject) {
69 }
70 return t.constructors;
71 }
72 void warnIfUncreatable() const;
73
75 const QV4::String *name, QQmlEnginePrivate *enginePrivate) const;
76
77 QV4QPointer<QObject> object;
78
79 union {
80 struct {
83 } t;
84 struct {
87 } n;
88 };
89
91};
92
94
96 void init() { Object::init(); }
97 void destroy();
100 QQmlType type() const;
101};
102
103}
104
105struct Q_QML_EXPORT QQmlTypeWrapper : FunctionObject
106{
108 V4_PROTOTYPE(typeWrapperPrototype)
110
111 bool isSingleton() const;
112 const QMetaObject *metaObject() const;
113 QObject *object() const;
114 QObject *singletonObject() const;
115
116 QVariant toVariant() const;
117
118 static void initProto(ExecutionEngine *v4);
119
121 Heap::QQmlTypeWrapper::TypeNameMode = Heap::QQmlTypeWrapper::IncludeEnums);
122 static ReturnedValue create(ExecutionEngine *, QObject *, const QQmlRefPointer<QQmlTypeNameCache> &, const QQmlImportRef *,
123 Heap::QQmlTypeWrapper::TypeNameMode = Heap::QQmlTypeWrapper::IncludeEnums);
124
125 static ReturnedValue virtualResolveLookupGetter(const Object *object, ExecutionEngine *engine, Lookup *lookup);
126 static bool virtualResolveLookupSetter(Object *object, ExecutionEngine *engine, Lookup *lookup, const Value &value);
127 static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
128 static int virtualMetacall(Object *object, QMetaObject::Call call, int index, void **a);
129
130 static ReturnedValue lookupSingletonProperty(Lookup *l, ExecutionEngine *engine, const Value &base);
131 static ReturnedValue lookupSingletonMethod(Lookup *l, ExecutionEngine *engine, const Value &base);
132 static ReturnedValue lookupEnumValue(Lookup *l, ExecutionEngine *engine, const Value &base);
133 static ReturnedValue lookupScopedEnum(Lookup *l, ExecutionEngine *engine, const Value &base);
134
135protected:
136 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
137 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
138 static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
139 static bool virtualIsEqualTo(Managed *that, Managed *o);
140 static ReturnedValue virtualInstanceOf(const Object *typeObject, const Value &var);
141
142private:
143 static ReturnedValue method_hasInstance(
144 const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
145 static ReturnedValue method_toString(
146 const FunctionObject *b, const Value *thisObject, const Value *, int);
147};
148
150{
152
154 const FunctionObject *f, const Value *argv, int argc, const Value *)
155 {
156 Q_ASSERT(f->as<QQmlTypeWrapper>());
158 static_cast<const QQmlTypeWrapper *>(f)->d(), argv, argc);
159 }
160};
161
162struct Q_QML_EXPORT QQmlScopedEnumWrapper : Object
163{
166
167 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
168};
169
170}
171
173
174#endif // QV8TYPEWRAPPER_P_H
175
\inmodule QtCore
Definition qmetatype.h:342
\inmodule QtCore
Definition qobject.h:103
QMetaType typeId() const
Definition qqmltype.cpp:668
const QMetaObject * metaObject() const
Definition qqmltype.cpp:683
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
quint64 ReturnedValue
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean b
const GLfloat * m
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint index
[2]
GLuint object
[3]
GLfloat GLfloat f
GLenum type
GLenum target
GLbitfield flags
GLuint name
GLdouble GLdouble t
Definition qopenglext.h:243
GLfloat GLfloat p
[1]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
unsigned char quint8
Definition qtypes.h:46
static const uint base
Definition qurlidna.cpp:20
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, JSToQVariantConversionBehavior conversionBehavior, V4ObjectSet *visitedObjects)
#define V4_NEEDS_DESTROY
#define V4_PROTOTYPE(p)
#define V4_OBJECT2(DataClass, superClass)
obj metaObject() -> className()
view create()
QJSEngine engine
[0]
\inmodule QtCore
static const QQmlPropertyData * createConstructors(const QMetaObject *metaObject, QMetaType metaType)
const QQmlTypePrivate * typePrivate
struct QV4::Heap::QQmlTypeWrapper::@673::@676 n
const QQmlPropertyData * constructors
QQmlTypeNameCache * typeNamespace
const QMetaObject * metaObject() const
const QQmlTypePrivate * typePrivate
void init(TypeNameMode m, QObject *o, const QQmlTypePrivate *type)
const QQmlImportRef * importNamespace
struct QV4::Heap::QQmlTypeWrapper::@673::@675 t
QQmlTypeNameCache::Result queryNamespace(const QV4::String *name, QQmlEnginePrivate *enginePrivate) const
QV4QPointer< QObject > object
TypeNameMode typeNameMode() const
const QQmlPropertyData * ensureConstructorsCache(const QMetaObject *metaObject, QMetaType metaType)
static ReturnedValue construct(HeapObject *d, const Value *argv, int argc)
static constexpr VTable::CallAsConstructor virtualCallAsConstructor
Definition moc.h:23