| 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 | |
| 4 | #ifndef QV4STRINGITERATOR_P_H |
| 5 | #define QV4STRINGITERATOR_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 "qv4string_p.h" |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | |
| 24 | namespace QV4 { |
| 25 | |
| 26 | namespace Heap { |
| 27 | |
| 28 | #define StringIteratorObjectMembers(class, Member) \ |
| 29 | Member(class, Pointer, String *, iteratedString) \ |
| 30 | Member(class, NoMark, quint32, nextIndex) |
| 31 | |
| 32 | DECLARE_HEAP_OBJECT(StringIteratorObject, Object) { |
| 33 | DECLARE_MARKOBJECTS(StringIteratorObject) |
| 34 | void init(String *str, QV4::ExecutionEngine *engine) |
| 35 | { |
| 36 | Object::init(); |
| 37 | this->iteratedString.set(e: engine, newVal: str); |
| 38 | this->nextIndex = 0; |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | } |
| 43 | |
| 44 | struct StringIteratorPrototype : 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 StringIteratorObject : Object |
| 53 | { |
| 54 | V4_OBJECT2(StringIteratorObject, Object) |
| 55 | Q_MANAGED_TYPE(StringIteratorObject) |
| 56 | V4_PROTOTYPE(stringIteratorPrototype) |
| 57 | |
| 58 | void init(ExecutionEngine *engine); |
| 59 | }; |
| 60 | |
| 61 | |
| 62 | } |
| 63 | |
| 64 | QT_END_NAMESPACE |
| 65 | |
| 66 | #endif // QV4ARRAYITERATOR_P_H |
| 67 | |
| 68 | |