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 QV4MAPITERATOR_P_H |
5 | #define QV4MAPITERATOR_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 "qv4iterator_p.h" |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | namespace QV4 { |
24 | |
25 | namespace Heap { |
26 | |
27 | #define MapIteratorObjectMembers(class, Member) \ |
28 | Member(class, Pointer, Object *, iteratedMap) \ |
29 | Member(class, NoMark, IteratorKind, iterationKind) \ |
30 | Member(class, NoMark, quint32, mapNextIndex) |
31 | |
32 | DECLARE_HEAP_OBJECT(MapIteratorObject, Object) { |
33 | DECLARE_MARKOBJECTS(MapIteratorObject) |
34 | void init(Object *obj, QV4::ExecutionEngine *engine) |
35 | { |
36 | Object::init(); |
37 | this->iteratedMap.set(e: engine, newVal: obj); |
38 | this->mapNextIndex = 0; |
39 | } |
40 | }; |
41 | |
42 | } |
43 | |
44 | struct MapIteratorPrototype : Object |
45 | { |
46 | V4_PROTOTYPE(iteratorPrototype) |
47 | void init(ExecutionEngine *engine); |
48 | |
49 | static ReturnedValue method_next(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); |
50 | }; |
51 | |
52 | struct MapIteratorObject : Object |
53 | { |
54 | V4_OBJECT2(MapIteratorObject, Object) |
55 | Q_MANAGED_TYPE(MapIteratorObject) |
56 | V4_PROTOTYPE(mapIteratorPrototype) |
57 | |
58 | void init(ExecutionEngine *engine); |
59 | }; |
60 | |
61 | |
62 | } |
63 | |
64 | QT_END_NAMESPACE |
65 | |
66 | #endif // QV4MAPITERATOR_P_H |
67 | |
68 | |
69 | |