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
qv4proxy_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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#ifndef QV4PROXY_P_H
4#define QV4PROXY_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include "qv4object_p.h"
19
21
22namespace QV4 {
23
24namespace Heap {
25
26#define ProxyObjectMembers(class, Member)
27 Member(class, Pointer, Object *, target)
28 Member(class, Pointer, Object *, handler)
29
31 DECLARE_MARKOBJECTS(ProxyObject)
32
33 void init(const QV4::Object *target, const QV4::Object *handler);
34};
35
37 void init(const QV4::FunctionObject *target, const QV4::Object *handler);
38};
39
41
42#define ProxyMembers(class, Member)
43 Member(class, Pointer, Symbol *, revokableProxySymbol)
44
45DECLARE_HEAP_OBJECT(Proxy, FunctionObject) {
46 DECLARE_MARKOBJECTS(Proxy)
47
48 void init(ExecutionEngine *engine);
49};
50
51}
52
53/*
54 * The inheritance from FunctionObject is a hack. Regular proxy objects are no function objects.
55 * But this helps implement the proxy for function objects, where we need this and thus gives us
56 * all the virtual methods from ProxyObject without having to duplicate them.
57 *
58 * But it does require a few hacks to make sure we don't recognize regular proxy objects as function
59 * objects in the runtime.
60 */
62 V4_OBJECT2(ProxyObject, Object)
64 V4_INTERNALCLASS(ProxyObject)
65
66 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
67 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
68 static bool virtualDeleteProperty(Managed *m, PropertyKey id);
69 static bool virtualHasProperty(const Managed *m, PropertyKey id);
70 static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
71 static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs);
72 static bool virtualIsExtensible(const Managed *m);
73 static bool virtualPreventExtensions(Managed *);
74 static Heap::Object *virtualGetPrototypeOf(const Managed *);
75 static bool virtualSetPrototypeOf(Managed *, const Object *);
76 static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *iteratorTarget);
77};
78
80 V4_OBJECT2(ProxyFunctionObject, FunctionObject)
82 V4_INTERNALCLASS(ProxyFunctionObject)
83
84 static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc);
85};
86
92
94{
95 V4_OBJECT2(Proxy, FunctionObject)
96
97 static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *);
98 static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
99
100 static ReturnedValue method_revocable(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
101
102 static ReturnedValue method_revoke(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
103};
104
105}
106
107QT_END_NAMESPACE
108
109#endif // QV4ECMAOBJECTS_P_H
Combined button and popup list for selecting options.
DECLARE_HEAP_OBJECT(RegExpCtor, FunctionObject)
Definition qjsvalue.h:23
#define Q_MANAGED_TYPE(type)
#define V4_INTERNALCLASS(c)
DEFINE_OBJECT_VTABLE(Proxy)
DEFINE_OBJECT_VTABLE(ProxyObject)
DEFINE_OBJECT_VTABLE(ProxyConstructorObject)
static bool removeAllOccurrences(ArrayObject *target, ReturnedValue val)
Definition qv4proxy.cpp:522
DEFINE_OBJECT_VTABLE(ProxyFunctionObject)
PropertyKey next(const Object *o, Property *pd=nullptr, PropertyAttributes *attrs=nullptr) override
Definition qv4proxy.cpp:502
ProxyObjectOwnPropertyKeyIterator(ArrayObject *keys)
Definition qv4proxy.cpp:496
~ProxyObjectOwnPropertyKeyIterator() override=default
void init(const QV4::FunctionObject *target, const QV4::Object *handler)
Definition qv4proxy.cpp:26
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
Definition qv4proxy.cpp:677
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver)
Definition qv4proxy.cpp:79
static bool virtualIsExtensible(const Managed *m)
Definition qv4proxy.cpp:329
static bool virtualHasProperty(const Managed *m, PropertyKey id)
Definition qv4proxy.cpp:157
static bool virtualPreventExtensions(Managed *)
Definition qv4proxy.cpp:363
static Heap::Object * virtualGetPrototypeOf(const Managed *)
Definition qv4proxy.cpp:397
static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs)
Definition qv4proxy.cpp:272
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
Definition qv4proxy.cpp:35
static bool virtualSetPrototypeOf(Managed *, const Object *)
Definition qv4proxy.cpp:442
static OwnPropertyKeyIterator * virtualOwnPropertyKeys(const Object *m, Value *iteratorTarget)
Definition qv4proxy.cpp:535
static bool virtualDeleteProperty(Managed *m, PropertyKey id)
Definition qv4proxy.cpp:120
static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
Definition qv4proxy.cpp:196
static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
Definition qv4proxy.cpp:748
static ReturnedValue method_revocable(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
Definition qv4proxy.cpp:753
static ReturnedValue method_revoke(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
Definition qv4proxy.cpp:776