Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmllistwrapper.cpp
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
4#include "qqmllistwrapper_p.h"
5
6#include <QtQml/qqmlinfo.h>
7
8#include <private/qqmllist_p.h>
9
10#include <private/qv4arrayiterator_p.h>
11#include <private/qv4arrayobject_p.h>
12#include <private/qv4functionobject_p.h>
13#include <private/qv4objectiterator_p.h>
14#include <private/qv4objectproto_p.h>
15#include <private/qv4qobjectwrapper_p.h>
16#include <private/qv4symbol_p.h>
17
19
20using namespace QV4;
21using namespace Qt::StringLiterals;
22
24
26{
27 QV4::Scope scope(d->internalClass->engine);
28 QV4::ScopedObject o(scope, d);
29 o->setArrayType(Heap::ArrayData::Custom);
30}
31
33{
34 Object::init();
35 m_object.init();
36 m_propertyType = propertyType.iface();
37 m_ownData = new QObjectList;
38 *property() = QQmlListProperty<QObject>(nullptr, m_ownData);
40}
41
42void Heap::QmlListWrapper::init(QObject *object, int propertyId, QMetaType propertyType)
43{
44 Object::init();
45 m_object.init(object);
46 m_propertyType = propertyType.iface();
47 m_ownData = nullptr;
48 void *args[] = { property(), nullptr };
51}
52
54 QObject *object, const QQmlListProperty<QObject> &list, QMetaType propertyType)
55{
56 Object::init();
57 m_object.init(object);
58 m_propertyType = propertyType.iface();
59 m_ownData = nullptr;
60 *property() = list;
62}
63
65{
66 m_object.destroy();
67 delete m_ownData;
68 Object::destroy();
69}
70
72 ExecutionEngine *engine, QObject *object, int propId, QMetaType propType)
73{
74 if (!object || propId == -1)
75 return Encode::null();
76 return engine->memoryManager->allocate<QmlListWrapper>(object, propId, propType)
78}
79
82{
83 return engine->memoryManager->allocate<QmlListWrapper>(prop.object, prop, propType)
85}
86
88{
90}
91
93{
94 if (!d()->object())
95 return QVariant();
96
97 return QVariant::fromValue(toListReference());
98}
99
101{
102 const Heap::QmlListWrapper *wrapper = d();
103 return QQmlListReferencePrivate::init(*wrapper->property(), wrapper->propertyType());
104}
105
106ReturnedValue QmlListWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
107{
108 Q_ASSERT(m->as<QmlListWrapper>());
109 const QmlListWrapper *w = static_cast<const QmlListWrapper *>(m);
110 QV4::ExecutionEngine *v4 = w->engine();
111
112 if (id.isArrayIndex()) {
113 const uint index = id.asArrayIndex();
114 const quint32 count = w->d()->property()->count
115 ? w->d()->property()->count(w->d()->property())
116 : 0;
117 if (index < count && w->d()->property()->at) {
118 if (hasProperty)
119 *hasProperty = true;
120 return QV4::QObjectWrapper::wrap(v4, w->d()->property()->at(w->d()->property(), index));
121 }
122
123 if (hasProperty)
124 *hasProperty = false;
126 }
127
128 return Object::virtualGet(m, id, receiver, hasProperty);
129}
130
132{
133 Q_ASSERT(m->as<QmlListWrapper>());
134 const QmlListWrapper *w = static_cast<const QmlListWrapper *>(m);
135 return w->toListReference().size();
136}
137
139{
140 Q_ASSERT(m->as<QmlListWrapper>());
141
142 const auto *w = static_cast<const QmlListWrapper *>(m);
143 QV4::ExecutionEngine *v4 = w->engine();
144
145 QQmlListProperty<QObject> *prop = w->d()->property();
146
147 if (id.isArrayIndex()) {
148 if (!prop->count || !prop->replace)
149 return false;
150
151 const uint index = id.asArrayIndex();
152 const int count = prop->count(prop);
153 if (count < 0 || index >= uint(count))
154 return false;
155
156 if (value.isNull()) {
157 prop->replace(prop, index, nullptr);
158 return true;
159 }
160
161 QV4::Scope scope(v4);
162 QV4::ScopedObject so(scope, value.toObject(scope.engine));
163 if (auto *wrapper = so->as<QV4::QObjectWrapper>()) {
164 prop->replace(prop, index, wrapper->object());
165 return true;
166 }
167
168 return false;
169 }
170
171 return Object::virtualPut(m, id, value, receiver);
172}
173
175{
177 PropertyKey next(const Object *o, Property *pd = nullptr, PropertyAttributes *attrs = nullptr) override;
178
179};
180
182{
183 const QmlListWrapper *w = static_cast<const QmlListWrapper *>(o);
184
185 quint32 count = w->d()->property()->count ? w->d()->property()->count(w->d()->property()) : 0;
186 if (arrayIndex < count) {
187 uint index = arrayIndex;
188 ++arrayIndex;
189 if (attrs)
191 if (pd) {
193 w->engine(), w->d()->property()->at(w->d()->property(), index));
194 }
196 } else if (memberIndex == 0) {
197 ++memberIndex;
198 return o->engine()->id_length()->propertyKey();
199 }
200
201 // You cannot add any own properties via the regular JavaScript interfaces.
202 return PropertyKey::invalid();
203}
204
206{
207 *target = *m;
209}
210
212{
213 defineDefaultProperty(QStringLiteral("pop"), method_pop, 0);
214 defineDefaultProperty(QStringLiteral("push"), method_push, 1);
215 defineDefaultProperty(QStringLiteral("shift"), method_shift, 0);
216 defineDefaultProperty(QStringLiteral("splice"), method_splice, 2);
217 defineDefaultProperty(QStringLiteral("unshift"), method_unshift, 1);
218 defineDefaultProperty(QStringLiteral("indexOf"), method_indexOf, 1);
219 defineDefaultProperty(QStringLiteral("lastIndexOf"), method_lastIndexOf, 1);
220 defineDefaultProperty(QStringLiteral("sort"), method_sort, 1);
221 defineAccessorProperty(QStringLiteral("length"), method_get_length, method_set_length);
222}
223
225{
226 Scope scope(b);
227 ScopedObject instance(scope, thisObject->toObject(scope.engine));
228 if (!instance)
230
231 QmlListWrapper *w = instance->as<QmlListWrapper>();
232 if (!w)
234
235 QQmlListProperty<QObject> *property = w->d()->property();
236
237 if (!property->count)
238 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
239 const qsizetype len = property->count(property);
240 if (!len)
242
243 if (!property->at)
244 return scope.engine->throwTypeError(u"List doesn't define an At function"_s);
246 scope, QV4::QObjectWrapper::wrap(scope.engine, property->at(property, len - 1)));
247
248 if (!property->removeLast)
249 return scope.engine->throwTypeError(u"List doesn't define a RemoveLast function"_s);
250 property->removeLast(property);
251
252 return result->asReturnedValue();
253}
254
255ReturnedValue PropertyListPrototype::method_push(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
256{
257 Scope scope(b);
258 ScopedObject instance(scope, thisObject->toObject(scope.engine));
259 if (!instance)
261 QmlListWrapper *w = instance->as<QmlListWrapper>();
262 if (!w)
264
265 QQmlListProperty<QObject> *property = w->d()->property();
266 if (!property->append)
267 return scope.engine->throwTypeError(u"List doesn't define an Append function"_s);
268 if (!property->count)
269 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
270
271 for (int i = 0; i < argc; ++i) {
272 const Value &arg = argv[i];
273 if (!arg.isNull() && !arg.as<QObjectWrapper>())
275 }
276
277 const qsizetype length = property->count(property);
278 if (!qIsAtMostUintLimit(length, std::numeric_limits<uint>::max() - argc))
279 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
280
281 for (int i = 0; i < argc; ++i) {
282 if (argv[i].isNull())
283 property->append(property, nullptr);
284 else
285 property->append(property, argv[i].as<QV4::QObjectWrapper>()->object());
286 }
287
288 const auto actualLength = property->count(property);
289 if (actualLength != length + argc)
290 qmlWarning(property->object) << "List didn't append all objects";
291
292 return Encode(uint(actualLength));
293}
294
296{
297 Scope scope(b);
298 ScopedObject instance(scope, thisObject->toObject(scope.engine));
299 if (!instance)
301 QmlListWrapper *w = instance->as<QmlListWrapper>();
302 if (!w)
304
305 QQmlListProperty<QObject> *property = w->d()->property();
306
307 if (!property->count)
308 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
309 const qsizetype len = property->count(property);
310 if (!len)
312
313 if (!property->at)
314 return scope.engine->throwTypeError(u"List doesn't define an At function"_s);
316
317 if (!property->replace)
318 return scope.engine->throwTypeError(u"List doesn't define a Replace function"_s);
319 if (!property->removeLast)
320 return scope.engine->throwTypeError(u"List doesn't define a RemoveLast function"_s);
321
322 for (qsizetype i = 1; i < len; ++i)
323 property->replace(property, i - 1, property->at(property, i));
324 property->removeLast(property);
325
326 return result->asReturnedValue();
327}
328
329ReturnedValue PropertyListPrototype::method_splice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
330{
331 Scope scope(b);
332 ScopedObject instance(scope, thisObject->toObject(scope.engine));
333 if (!instance)
335 QmlListWrapper *w = instance->as<QmlListWrapper>();
336 if (!w)
338
339 QQmlListProperty<QObject> *property = w->d()->property();
340
341 if (!property->count)
342 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
343 const qsizetype len = property->count(property);
344
345 const double rs = (argc ? argv[0] : Value::undefinedValue()).toInteger();
347 if (rs < 0)
348 start = static_cast<qsizetype>(qMax(0., len + rs));
349 else
350 start = static_cast<qsizetype>(qMin(rs, static_cast<double>(len)));
351
352 qsizetype deleteCount = 0;
353 qsizetype itemCount = 0;
354 if (argc == 1) {
355 deleteCount = len - start;
356 } else if (argc > 1){
357 itemCount = argc - 2;
358 double dc = argv[1].toInteger();
359 deleteCount = static_cast<qsizetype>(qMin(qMax(dc, 0.), double(len - start)));
360 }
361
362 if (itemCount > deleteCount
363 && len > std::numeric_limits<qsizetype>::max() - itemCount + deleteCount) {
364 return scope.engine->throwTypeError();
365 }
366
367 if (!qIsAtMostUintLimit(deleteCount, std::numeric_limits<uint>::max() - 1))
368 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
369
370 if (!property->at)
371 return scope.engine->throwTypeError(u"List doesn't define an At function"_s);
372
373 for (qsizetype i = 0; i < itemCount; ++i) {
374 const auto arg = argv[i + 2];
375 if (!arg.isNull() && !arg.as<QObjectWrapper>())
377 }
378
379 ScopedArrayObject newArray(scope, scope.engine->newArrayObject());
380 newArray->arrayReserve(deleteCount);
381 ScopedValue v(scope);
382 for (qsizetype i = 0; i < deleteCount; ++i) {
383 newArray->arrayPut(
385 }
386 newArray->setArrayLengthUnchecked(deleteCount);
387
388 if (!property->replace)
389 return scope.engine->throwTypeError(u"List doesn't define a Replace function"_s);
390 if (!property->removeLast)
391 return scope.engine->throwTypeError(u"List doesn't define a RemoveLast function"_s);
392 if (!property->append)
393 return scope.engine->throwTypeError(u"List doesn't define an Append function"_s);
394
395 if (itemCount < deleteCount) {
396 for (qsizetype k = start; k < len - deleteCount; ++k)
397 property->replace(property, k + itemCount, property->at(property, k + deleteCount));
398 for (qsizetype k = len; k > len - deleteCount + itemCount; --k)
399 property->removeLast(property);
400 } else if (itemCount > deleteCount) {
401 for (qsizetype k = 0; k < itemCount - deleteCount; ++k)
402 property->append(property, nullptr);
403 for (qsizetype k = len - deleteCount; k > start; --k) {
404 property->replace(
405 property, k + itemCount - 1, property->at(property, k + deleteCount - 1));
406 }
407 }
408
409 for (qsizetype i = 0; i < itemCount; ++i) {
410 const auto arg = argv[i + 2];
411 if (arg.isNull())
412 property->replace(property, start + i, nullptr);
413 else
414 property->replace(property, start + i, arg.as<QObjectWrapper>()->object());
415 }
416
417 return newArray->asReturnedValue();
418}
419
420ReturnedValue PropertyListPrototype::method_unshift(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
421{
422 Scope scope(b);
423 ScopedObject instance(scope, thisObject->toObject(scope.engine));
424 if (!instance)
426
427 QmlListWrapper *w = instance->as<QmlListWrapper>();
428 if (!w)
430
431 QQmlListProperty<QObject> *property = w->d()->property();
432
433 if (!property->count)
434 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
435 const qsizetype len = property->count(property);
436
437 if (std::numeric_limits<qsizetype>::max() - len < argc || !qIsAtMostUintLimit(len + argc))
438 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
439
440 if (!property->append)
441 return scope.engine->throwTypeError(u"List doesn't define an Append function"_s);
442 if (!property->replace)
443 return scope.engine->throwTypeError(u"List doesn't define a Replace function"_s);
444
445 for (int i = 0; i < argc; ++i) {
446 const auto arg = argv[i];
447 if (!arg.isNull() && !arg.as<QObjectWrapper>())
449 }
450
451 for (int i = 0; i < argc; ++i)
452 property->append(property, nullptr);
453 if (property->count(property) != argc + len)
454 return scope.engine->throwTypeError(u"List doesn't append null objects"_s);
455
456 for (qsizetype k = len; k > 0; --k)
457 property->replace(property, k + argc - 1, property->at(property, k - 1));
458
459 for (int i = 0; i < argc; ++i) {
460 const auto *wrapper = argv[i].as<QObjectWrapper>();
461 property->replace(property, i, wrapper ? wrapper->object() : nullptr);
462 }
463
464 return Encode(uint(len + argc));
465}
466
467template<typename Iterate>
468ReturnedValue firstOrLastIndexOf(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc, Iterate iterate)
469{
470 Scope scope(b);
471
472 // Undefined cannot be encoded as QObject*. In particular it's not nullptr.
473 if (argc == 0)
475
476 QObject *searchValue;
477 if (argv[0].isNull()) {
478 searchValue = nullptr;
479 } else {
480 Scoped<QObjectWrapper> wrapper(scope, argv[0]);
481 if (wrapper)
482 searchValue = wrapper->object();
483 else
485 }
486
487 ScopedObject instance(scope, thisObject->toObject(scope.engine));
488 if (!instance)
490
491 QmlListWrapper *w = instance->as<QmlListWrapper>();
492 if (!w)
494
495 QQmlListProperty<QObject> *property = w->d()->property();
496
497 if (!property->count)
498 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
499 const qsizetype len = property->count(property);
500 if (!len)
501 return Encode(-1);
502
503
504 return iterate(scope.engine, property, len, searchValue);
505}
506
507ReturnedValue PropertyListPrototype::method_indexOf(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
508{
509 return firstOrLastIndexOf(
510 b, thisObject, argv, argc,
512 qsizetype len, QObject *searchValue) -> ReturnedValue {
513 qsizetype fromIndex = 0;
514 if (argc >= 2) {
515 double f = argv[1].toInteger();
517 return Encode::undefined();
518 if (f >= len)
519 return Encode(-1);
520 if (f < 0)
521 f = qMax(len + f, 0.);
522 fromIndex = qsizetype(f);
523 }
524
525 for (qsizetype i = fromIndex; i < len; ++i) {
526 if (property->at(property, i) == searchValue) {
528 return Encode(uint(i));
529 return engine->throwRangeError(QString::fromLatin1("List length out of range."));
530 }
531 }
532
533 return Encode(-1);
534 });
535}
536
538{
539 return firstOrLastIndexOf(
540 b, thisObject, argv, argc,
542 qsizetype len, QObject *searchValue) -> ReturnedValue {
543 qsizetype fromIndex = len - 1;
544 if (argc >= 2) {
545 double f = argv[1].toInteger();
547 return Encode::undefined();
548 if (f > 0)
549 f = qMin(f, (double)(len - 1));
550 else if (f < 0) {
551 f = len + f;
552 if (f < 0)
553 return Encode(-1);
554 }
555 fromIndex = qsizetype(f);
556 }
557
558 for (qsizetype i = fromIndex; i >= 0; --i) {
559 if (property->at(property, i) == searchValue) {
561 return Encode(uint(i));
562 return engine->throwRangeError(QString::fromLatin1("List length out of range."));
563 }
564 }
565
566 return Encode(-1);
567 });
568}
569
570ReturnedValue PropertyListPrototype::method_sort(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
571{
572 Scope scope(b);
573 ScopedObject instance(scope, thisObject->toObject(scope.engine));
574 if (!instance)
576
577 QmlListWrapper *w = instance->as<QmlListWrapper>();
578 if (!w)
580
581 QQmlListProperty<QObject> *property = w->d()->property();
582
583 if (!property->count)
584 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
585 if (property->count(property) == 0)
586 return thisObject->asReturnedValue();
587 if (!property->at)
588 return scope.engine->throwTypeError(u"List doesn't define an At function"_s);
589 if (!property->replace)
590 return scope.engine->throwTypeError(u"List doesn't define a Replace function"_s);
591
592 ScopedValue comparefn(scope, argc ? argv[0] : Value::undefinedValue());
593 if (!comparefn->isUndefined() && !comparefn->isFunctionObject())
595
596 const ArrayElementLessThan lessThan(scope.engine, comparefn);
600 return lessThan(o1, o2);
601 });
602
603 return thisObject->asReturnedValue();
604}
605
607{
608 Scope scope(b);
609 ScopedObject instance(scope, thisObject->toObject(scope.engine));
610 if (!instance)
612
613 const QmlListWrapper *w = instance->as<QmlListWrapper>();
614 if (!w)
616
617 QQmlListProperty<QObject> *property = w->d()->property();
618 if (!property->count)
619 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
620
621 qsizetype count = property->count(property);
623 return Encode(uint(count));
624
625 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
626}
627
628ReturnedValue PropertyListPrototype::method_set_length(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
629{
630 QV4::Scope scope(b);
631 ScopedObject instance(scope, thisObject->toObject(scope.engine));
632 if (!instance)
634
635 const QmlListWrapper *w = instance->as<QmlListWrapper>();
636 if (!w)
638
639 QQmlListProperty<QObject> *property = w->d()->property();
640
641 bool ok = false;
642 const uint newLength = argc ? argv[0].asArrayLength(&ok) : 0;
643 if (!ok)
644 return scope.engine->throwRangeError(QString::fromLatin1("Invalid list length."));
645
646 if (newLength == 0 && property->clear) {
647 property->clear(property);
648 return true;
649 }
650
651 if (!property->count)
652 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
653
654 qsizetype count = property->count(property);
656 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
657
658 if (newLength < uint(count)) {
659 if (!property->removeLast)
660 return scope.engine->throwTypeError(u"List doesn't define a RemoveLast function"_s);
661
662 for (uint i = count; i > newLength; --i)
663 property->removeLast(property);
664
665 return true;
666 }
667
668 if (!property->append)
669 return scope.engine->throwTypeError(u"List doesn't define an Append function"_s);
670
671 for (uint i = count; i < newLength; ++i)
672 property->append(property, nullptr);
673
674 count = property->count(property);
676 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
677
678 if (uint(count) != newLength)
679 return scope.engine->throwTypeError(u"List doesn't append null objects"_s);
680
681 return true;
682
683}
684
\inmodule QtCore
Definition qmetatype.h:320
const QtPrivate::QMetaTypeInterface * iface() const
Definition qmetatype.h:750
\inmodule QtCore
Definition qobject.h:90
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
QObject * object
Definition qqmllist.h:81
CountFunction count
Definition qqmllist.h:85
ReplaceFunction replace
Definition qqmllist.h:88
static QQmlListReference init(const QQmlListProperty< QObject > &, QMetaType)
Definition qqmllist.cpp:25
The QQmlListReference class allows the manipulation of QQmlListProperty properties.
Definition qqmllist.h:183
qsizetype size() const
Definition qqmllist.h:220
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5710
ObjectType::Data * allocate(Args &&... args)
Definition qv4mm_p.h:199
\inmodule QtCore
Definition qvariant.h:64
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:531
short next
Definition keywords.cpp:445
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
void sortHelper(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan)
static QV4::ReturnedValue method_set_length(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
quint64 ReturnedValue
static QV4::ReturnedValue method_get_length(const FunctionObject *b, const Value *thisObject, const Value *, int)
bool hasExceptionOrIsInterrupted(ExecutionEngine *engine)
@ Attr_Data
static struct AttrInfo attrs[]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
QList< QObject * > QObjectList
Definition qobject.h:44
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
const GLfloat * m
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint index
[2]
GLuint GLuint end
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLfloat GLfloat f
GLenum target
GLuint start
GLenum GLsizei len
GLuint64EXT * result
[6]
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static void setCustomArrayData(Heap::QmlListWrapper *d)
ReturnedValue firstOrLastIndexOf(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc, Iterate iterate)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
SSL_CTX int(*) void arg)
#define QStringLiteral(str)
unsigned int quint32
Definition qtypes.h:45
ptrdiff_t qsizetype
Definition qtypes.h:70
unsigned int uint
Definition qtypes.h:29
long long qint64
Definition qtypes.h:55
static bool lessThan(const QChar *a, int l, const char *c)
Definition qurlidna.cpp:321
QT_BEGIN_NAMESPACE bool qIsAtMostUintLimit(qsizetype length, uint limit=std::numeric_limits< uint >::max())
#define THROW_TYPE_ERROR()
#define RETURN_UNDEFINED()
#define DEFINE_OBJECT_VTABLE(classname)
const char property[13]
Definition qwizard.cpp:101
QList< int > list
[14]
QAction * at
QJSValueList args
QJSEngine engine
[0]
static int metacall(QObject *, Call, int, void **)
static constexpr ReturnedValue undefined()
static constexpr ReturnedValue null()
MemoryManager * memoryManager
ReturnedValue throwRangeError(const Value &value)
Heap::ArrayObject * newArrayObject(int count=0)
ReturnedValue throwTypeError()
const QQmlListProperty< QObject > * property() const
void init(QMetaType propertyType)
QMetaType propertyType() const
ExecutionEngine * engine() const
bool hasProperty(PropertyKey id) const
static PropertyKey invalid()
static PropertyKey fromArrayIndex(uint idx)
static ReturnedValue method_push(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_splice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_sort(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_set_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_pop(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_unshift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_indexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_lastIndexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_shift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)
QObject * object() const
static V4_NEEDS_DESTROY ReturnedValue create(ExecutionEngine *engine, QObject *object, int propId, QMetaType propType)
QQmlListReference toListReference() const
QVariant toVariant() const
ExecutionEngine * engine
QML_NEARLY_ALWAYS_INLINE ReturnedValue asReturnedValue() const
constexpr ReturnedValue asReturnedValue() const
bool isUndefined() const
static constexpr VTable::OwnPropertyKeys virtualOwnPropertyKeys
static constexpr VTable::Get virtualGet
static constexpr VTable::GetLength virtualGetLength
static constexpr VTable::Put virtualPut
bool isFunctionObject() const
Definition qv4value_p.h:309
static constexpr Value undefinedValue()
Definition qv4value_p.h:191
uint asArrayLength(bool *ok) const
Definition qv4value.cpp:275
const T * as() const
Definition qv4value_p.h:132
double toInteger() const
Definition qv4value_p.h:391
Heap::Object * toObject(ExecutionEngine *e) const
Definition qv4value_p.h:122
PropertyKey next(const Object *o, Property *pd=nullptr, PropertyAttributes *attrs=nullptr) override
~QmlListWrapperOwnPropertyKeyIterator() override=default
void wrapper()