| 1 | // Copyright (C) 2017 Crimson AS <info@crimson.no> |
| 2 | // Copyright (C) 2018 The Qt Company Ltd. |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 4 | |
| 5 | #ifndef QV4ARRAYITERATOR_P_H |
| 6 | #define QV4ARRAYITERATOR_P_H |
| 7 | |
| 8 | // |
| 9 | // W A R N I N G |
| 10 | // ------------- |
| 11 | // |
| 12 | // This file is not part of the Qt API. It exists purely as an |
| 13 | // implementation detail. This header file may change from version to |
| 14 | // version without notice, or even be removed. |
| 15 | // |
| 16 | // We mean it. |
| 17 | // |
| 18 | |
| 19 | #include "qv4object_p.h" |
| 20 | #include "qv4iterator_p.h" |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | |
| 25 | namespace QV4 { |
| 26 | |
| 27 | namespace Heap { |
| 28 | |
| 29 | #define ArrayIteratorObjectMembers(class, Member) \ |
| 30 | Member(class, Pointer, Object *, iteratedObject) \ |
| 31 | Member(class, NoMark, IteratorKind, iterationKind) \ |
| 32 | Member(class, NoMark, quint32, nextIndex) |
| 33 | |
| 34 | DECLARE_HEAP_OBJECT(ArrayIteratorObject, Object) { |
| 35 | DECLARE_MARKOBJECTS(ArrayIteratorObject) |
| 36 | void init(Object *obj, QV4::ExecutionEngine *engine) |
| 37 | { |
| 38 | Object::init(); |
| 39 | this->iteratedObject.set(e: engine, newVal: obj); |
| 40 | this->nextIndex = 0; |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | } |
| 45 | |
| 46 | struct ArrayIteratorPrototype : Object |
| 47 | { |
| 48 | V4_PROTOTYPE(iteratorPrototype) |
| 49 | void init(ExecutionEngine *engine); |
| 50 | |
| 51 | static ReturnedValue method_next(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); |
| 52 | }; |
| 53 | |
| 54 | struct ArrayIteratorObject : Object |
| 55 | { |
| 56 | V4_OBJECT2(ArrayIteratorObject, Object) |
| 57 | Q_MANAGED_TYPE(ArrayIteratorObject) |
| 58 | V4_PROTOTYPE(arrayIteratorPrototype) |
| 59 | |
| 60 | void init(ExecutionEngine *engine); |
| 61 | }; |
| 62 | |
| 63 | |
| 64 | } |
| 65 | |
| 66 | QT_END_NAMESPACE |
| 67 | |
| 68 | #endif // QV4ARRAYITERATOR_P_H |
| 69 | |
| 70 | |