Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qv4objectiterator_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QV4OBJECTITERATOR_H
4#define QV4OBJECTITERATOR_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 "qv4global_p.h"
18#include "qv4object_p.h"
19
21
22namespace QV4 {
23
24struct Q_QML_EXPORT ObjectIterator
25{
26 enum Flags {
27 NoFlags = 0,
28 EnumerableOnly = 0x1,
29 WithSymbols = 0x2
30 };
31
34 OwnPropertyKeyIterator *iterator = nullptr;
36
38 {
39 engine = scope.engine;
40 object = static_cast<Object *>(scope.alloc());
41 this->flags = flags;
42 object->setM(o ? o->m() : nullptr);
43 if (o)
44 iterator = object->ownPropertyKeys(object);
45 }
47 {
48 delete iterator;
49 }
50
51 PropertyKey next(Property *pd = nullptr, PropertyAttributes *attributes = nullptr);
52 ReturnedValue nextPropertyName(Value *value);
53 ReturnedValue nextPropertyNameAsString(Value *value);
54 ReturnedValue nextPropertyNameAsString();
55};
56
57namespace Heap {
58
59#define ForInIteratorObjectMembers(class, Member) \
60 Member(class, Pointer, Object *, object) \
61 Member(class, Pointer, Object *, current) \
62 Member(class, Pointer, Object *, target) \
63 Member(class, NoMark, OwnPropertyKeyIterator *, iterator)
64
66 void init(QV4::Object *o);
67 Value workArea[2];
68
69 static void markObjects(Heap::Base *that, MarkStack *markStack);
70 void destroy();
71};
72
73}
74
76{
77 V4_PROTOTYPE(iteratorPrototype)
79
80 static ReturnedValue method_next(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc);
81};
82
85 Q_MANAGED_TYPE(ForInIterator)
86 V4_PROTOTYPE(forInIteratorPrototype)
88
90};
91
92inline
93void Heap::ForInIteratorObject::init(QV4::Object *o)
94{
95 Object::init();
96 if (!o)
97 return;
98 object.set(o->engine(), o->d());
99 current.set(o->engine(), o->d());
100 Scope scope(o);
101 ScopedObject obj(scope);
102 iterator = o->ownPropertyKeys(obj.getRef());
103 target.set(o->engine(), obj->d());
104}
105
106
107}
108
110
111#endif
short next
Definition keywords.cpp:445
Combined button and popup list for selecting options.
quint64 ReturnedValue
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean b
GLenum target
GLbitfield flags
GLhandleARB obj
[2]
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
unsigned int uint
Definition qtypes.h:34
#define V4_NEEDS_DESTROY
#define Q_MANAGED_TYPE(type)
#define DECLARE_HEAP_OBJECT(name, base)
#define V4_PROTOTYPE(p)
#define V4_OBJECT2(DataClass, superClass)
QJSEngine engine
[0]
V4_NEEDS_DESTROY PropertyKey nextProperty() const
void init(ExecutionEngine *engine)
static ReturnedValue method_next(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
ExecutionEngine * engine() const
ExecutionEngine * engine
ObjectIterator(Scope &scope, const Object *o, uint flags)
Value * alloc(qint64 nValues) const =delete
ExecutionEngine * engine