1// Copyright (C) 2018 Crimson AS <info@crimson.no>
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 QV4MAPOBJECT_P_H
5#define QV4MAPOBJECT_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 "qv4object_p.h"
19#include "qv4functionobject_p.h"
20
21QT_BEGIN_NAMESPACE
22
23namespace QV4 {
24
25class ESTable;
26
27namespace Heap {
28
29struct WeakMapCtor : FunctionObject {
30 void init(QV4::ExecutionContext *scope);
31};
32
33struct MapCtor : WeakMapCtor {
34 void init(QV4::ExecutionContext *scope);
35};
36
37struct MapObject : Object {
38 static void markObjects(Heap::Base *that, MarkStack *markStack);
39 void init();
40 void destroy();
41 void removeUnmarkedKeys();
42
43 MapObject *nextWeakMap;
44 ESTable *esTable;
45 bool isWeakMap;
46};
47
48}
49
50struct WeakMapCtor: FunctionObject
51{
52 V4_OBJECT2(WeakMapCtor, FunctionObject)
53
54 static ReturnedValue construct(const FunctionObject *f, const Value *argv, int argc, const Value *, bool weakMap);
55
56 static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *);
57 static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc);
58};
59
60struct MapCtor : WeakMapCtor
61{
62 V4_OBJECT2(MapCtor, WeakMapCtor)
63
64 static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *);
65};
66
67struct MapObject : Object
68{
69 V4_OBJECT2(MapObject, Object)
70 V4_PROTOTYPE(mapPrototype)
71 V4_NEEDS_DESTROY
72};
73
74struct WeakMapPrototype : Object
75{
76 void init(ExecutionEngine *engine, Object *ctor);
77
78 static ReturnedValue method_delete(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
79 static ReturnedValue method_get(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
80 static ReturnedValue method_has(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
81 static ReturnedValue method_set(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
82};
83
84struct MapPrototype : WeakMapPrototype
85{
86 void init(ExecutionEngine *engine, Object *ctor);
87
88 static ReturnedValue method_clear(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
89 static ReturnedValue method_delete(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
90 static ReturnedValue method_entries(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
91 static ReturnedValue method_forEach(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
92 static ReturnedValue method_get(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
93 static ReturnedValue method_has(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
94 static ReturnedValue method_keys(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
95 static ReturnedValue method_set(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
96 static ReturnedValue method_get_size(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
97 static ReturnedValue method_values(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
98};
99
100
101} // namespace QV4
102
103
104QT_END_NAMESPACE
105
106#endif // QV4MAPOBJECT_P_H
107
108

source code of qtdeclarative/src/qml/jsruntime/qv4mapobject_p.h