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
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->arrayCreate();
30}
31
33{
36
37 ListWrapperObject(QQmlListProperty<QObject> *p)
38 : scope(static_cast<Heap::QmlListWrapper *>(p->data)->internalClass->engine)
39 , object(scope, static_cast<Heap::QmlListWrapper *>(p->data))
40 {
41 Q_ASSERT(object);
42 Q_ASSERT(object->arrayData());
43 }
44
45 Heap::ArrayData *arrayData() const
46 {
47 return object->arrayData();
48 }
49};
50
51static void appendWrapped(QQmlListProperty<QObject> *p, QObject *o)
52{
54 Heap::ArrayData *arrayData = object.arrayData();
55
56 const uint length = arrayData->length();
57 if (Q_UNLIKELY(length == std::numeric_limits<uint>::max())) {
58 object.scope.engine->throwRangeError(QLatin1String("Too many elements."));
59 return;
60 }
61
62 ArrayData::realloc(object.object, Heap::ArrayData::Simple, length + 1, false);
63 arrayData->vtable()->put(
64 object.object, length, QV4::QObjectWrapper::wrap(object.scope.engine, o));
65}
66
67static qsizetype countWrapped(QQmlListProperty<QObject> *p)
68{
70 return object.arrayData()->length();
71}
72
73static QObject *atWrapped(QQmlListProperty<QObject> *p, qsizetype i)
74{
76 QV4::Scoped<QObjectWrapper> result(object.scope, object.arrayData()->get(i));
77 return result ? result->object() : nullptr;
78}
79
80static void clearWrapped(QQmlListProperty<QObject> *p)
81{
83 object.arrayData()->vtable()->truncate(object.object, 0);
84}
85
86static void replaceWrapped(QQmlListProperty<QObject> *p, qsizetype i, QObject *o)
87{
89 object.arrayData()->vtable()->put(
90 object.object, i, QV4::QObjectWrapper::wrap(object.scope.engine, o));
91}
92
93static void removeLastWrapped(QQmlListProperty<QObject> *p)
94{
96 Heap::ArrayData *arrayData = object.arrayData();
97 const uint length = arrayData->length();
98 if (length > 0)
99 arrayData->vtable()->truncate(object.object, length - 1);
100}
101
103{
104 Object::init();
105 m_object.init();
106 m_propertyType = propertyType.iface();
107 setArrayData(this);
108 *property() = QQmlListProperty<QObject>(
109 nullptr, this,
112}
113
114void Heap::QmlListWrapper::init(QObject *object, int propertyId, QMetaType propertyType)
115{
116 Object::init();
117 m_object.init(object);
118 m_propertyType = propertyType.iface();
119 void *args[] = { property(), nullptr };
121}
122
124 QObject *object, const QQmlListProperty<QObject> &list, QMetaType propertyType)
125{
126 Object::init();
127 m_object.init(object);
128 m_propertyType = propertyType.iface();
129 *property() = list;
130}
131
133{
134 m_object.destroy();
135 Object::destroy();
136}
137
139 ExecutionEngine *engine, QObject *object, int propId, QMetaType propType)
140{
141 if (!object || propId == -1)
142 return Encode::null();
143 return engine->memoryManager->allocate<QmlListWrapper>(object, propId, propType)
144 ->asReturnedValue();
145}
146
148 ExecutionEngine *engine, const QQmlListProperty<QObject> &prop, QMetaType propType)
149{
150 return engine->memoryManager->allocate<QmlListWrapper>(prop.object, prop, propType)
151 ->asReturnedValue();
152}
153
158
160{
161 if (!d()->object())
162 return QVariant();
163
164 return QVariant::fromValue(toListReference());
165}
166
168{
169 const Heap::QmlListWrapper *wrapper = d();
170 return QQmlListReferencePrivate::init(*wrapper->property(), wrapper->propertyType());
171}
172
173ReturnedValue QmlListWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
174{
175 Q_ASSERT(m->as<QmlListWrapper>());
176 const QmlListWrapper *w = static_cast<const QmlListWrapper *>(m);
177 QV4::ExecutionEngine *v4 = w->engine();
178
179 if (id.isArrayIndex()) {
180 const uint index = id.asArrayIndex();
181 const quint32 count = w->d()->property()->count
182 ? w->d()->property()->count(w->d()->property())
183 : 0;
184 if (index < count && w->d()->property()->at) {
185 if (hasProperty)
186 *hasProperty = true;
187 return QV4::QObjectWrapper::wrap(v4, w->d()->property()->at(w->d()->property(), index));
188 }
189
190 if (hasProperty)
191 *hasProperty = false;
192 return Value::undefinedValue().asReturnedValue();
193 }
194
195 return Object::virtualGet(m, id, receiver, hasProperty);
196}
197
199{
200 Q_ASSERT(m->as<QmlListWrapper>());
201 QQmlListProperty<QObject> *property = static_cast<const QmlListWrapper *>(m)->d()->property();
203 return property->count ? property->count(property) : 0;
204}
205
207{
208 Q_ASSERT(m->as<QmlListWrapper>());
209
210 const auto *w = static_cast<const QmlListWrapper *>(m);
211 QV4::ExecutionEngine *v4 = w->engine();
212
213 QQmlListProperty<QObject> *prop = w->d()->property();
214
215 if (id.isArrayIndex()) {
216 if (!prop->count || !prop->replace)
217 return false;
218
219 const uint index = id.asArrayIndex();
220 const int count = prop->count(prop);
221 if (count < 0 || index >= uint(count))
222 return false;
223
224 if (value.isNull()) {
225 prop->replace(prop, index, nullptr);
226 return true;
227 }
228
229 QV4::Scope scope(v4);
230 QV4::ScopedObject so(scope, value.toObject(scope.engine));
231 if (auto *wrapper = so->as<QV4::QObjectWrapper>()) {
232 prop->replace(prop, index, wrapper->object());
233 return true;
234 }
235
236 return false;
237 }
238
239 return Object::virtualPut(m, id, value, receiver);
240}
241
248
250{
251 const QmlListWrapper *w = static_cast<const QmlListWrapper *>(o);
252
253 quint32 count = w->d()->property()->count ? w->d()->property()->count(w->d()->property()) : 0;
254 if (arrayIndex < count) {
255 uint index = arrayIndex;
256 ++arrayIndex;
257 if (attrs)
259 if (pd) {
261 w->engine(), w->d()->property()->at(w->d()->property(), index));
262 }
264 } else if (memberIndex == 0) {
265 ++memberIndex;
266 return o->engine()->id_length()->propertyKey();
267 }
268
269 // You cannot add any own properties via the regular JavaScript interfaces.
270 return PropertyKey::invalid();
271}
272
278
280{
281 defineDefaultProperty(QStringLiteral("pop"), method_pop, 0);
282 defineDefaultProperty(QStringLiteral("push"), method_push, 1);
283 defineDefaultProperty(QStringLiteral("shift"), method_shift, 0);
284 defineDefaultProperty(QStringLiteral("splice"), method_splice, 2);
285 defineDefaultProperty(QStringLiteral("unshift"), method_unshift, 1);
286 defineDefaultProperty(QStringLiteral("indexOf"), method_indexOf, 1);
287 defineDefaultProperty(QStringLiteral("lastIndexOf"), method_lastIndexOf, 1);
288 defineDefaultProperty(QStringLiteral("sort"), method_sort, 1);
289 defineAccessorProperty(QStringLiteral("length"), method_get_length, method_set_length);
290}
291
293{
294 Scope scope(b);
295 ScopedObject instance(scope, thisObject->toObject(scope.engine));
296 if (!instance)
298
299 QmlListWrapper *w = instance->as<QmlListWrapper>();
300 if (!w)
302
303 QQmlListProperty<QObject> *property = w->d()->property();
304
305 if (!property->count)
306 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
307 const qsizetype len = property->count(property);
308 if (!len)
310
311 if (!property->at)
312 return scope.engine->throwTypeError(u"List doesn't define an At function"_s);
314 scope, QV4::QObjectWrapper::wrap(scope.engine, property->at(property, len - 1)));
315
316 if (!property->removeLast)
317 return scope.engine->throwTypeError(u"List doesn't define a RemoveLast function"_s);
318 property->removeLast(property);
319
320 return result->asReturnedValue();
321}
322
323ReturnedValue PropertyListPrototype::method_push(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
324{
325 Scope scope(b);
326 ScopedObject instance(scope, thisObject->toObject(scope.engine));
327 if (!instance)
329 QmlListWrapper *w = instance->as<QmlListWrapper>();
330 if (!w)
332
333 QQmlListProperty<QObject> *property = w->d()->property();
334 if (!property->append)
335 return scope.engine->throwTypeError(u"List doesn't define an Append function"_s);
336 if (!property->count)
337 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
338
339 for (int i = 0; i < argc; ++i) {
340 const Value &arg = argv[i];
341 if (!arg.isNull() && !arg.as<QObjectWrapper>())
343 }
344
345 const qsizetype length = property->count(property);
346 if (!qIsAtMostUintLimit(length, std::numeric_limits<uint>::max() - argc))
347 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
348
349 for (int i = 0; i < argc; ++i) {
350 if (argv[i].isNull())
351 property->append(property, nullptr);
352 else
353 property->append(property, argv[i].as<QV4::QObjectWrapper>()->object());
354 }
355
356 const auto actualLength = property->count(property);
357 if (actualLength != length + argc)
358 qmlWarning(property->object) << "List didn't append all objects";
359
360 return Encode(uint(actualLength));
361}
362
364{
365 Scope scope(b);
366 ScopedObject instance(scope, thisObject->toObject(scope.engine));
367 if (!instance)
369 QmlListWrapper *w = instance->as<QmlListWrapper>();
370 if (!w)
372
373 QQmlListProperty<QObject> *property = w->d()->property();
374
375 if (!property->count)
376 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
377 const qsizetype len = property->count(property);
378 if (!len)
380
381 if (!property->at)
382 return scope.engine->throwTypeError(u"List doesn't define an At function"_s);
384
385 if (!property->replace)
386 return scope.engine->throwTypeError(u"List doesn't define a Replace function"_s);
387 if (!property->removeLast)
388 return scope.engine->throwTypeError(u"List doesn't define a RemoveLast function"_s);
389
390 for (qsizetype i = 1; i < len; ++i)
391 property->replace(property, i - 1, property->at(property, i));
392 property->removeLast(property);
393
394 return result->asReturnedValue();
395}
396
397ReturnedValue PropertyListPrototype::method_splice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
398{
399 Scope scope(b);
400 ScopedObject instance(scope, thisObject->toObject(scope.engine));
401 if (!instance)
403 QmlListWrapper *w = instance->as<QmlListWrapper>();
404 if (!w)
406
407 QQmlListProperty<QObject> *property = w->d()->property();
408
409 if (!property->count)
410 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
411 const qsizetype len = property->count(property);
412
413 const double rs = (argc ? argv[0] : Value::undefinedValue()).toInteger();
415 if (rs < 0)
416 start = static_cast<qsizetype>(qMax(0., len + rs));
417 else
418 start = static_cast<qsizetype>(qMin(rs, static_cast<double>(len)));
419
420 qsizetype deleteCount = 0;
421 qsizetype itemCount = 0;
422 if (argc == 1) {
423 deleteCount = len - start;
424 } else if (argc > 1){
425 itemCount = argc - 2;
426 double dc = argv[1].toInteger();
427 deleteCount = static_cast<qsizetype>(qMin(qMax(dc, 0.), double(len - start)));
428 }
429
430 if (itemCount > deleteCount
431 && len > std::numeric_limits<qsizetype>::max() - itemCount + deleteCount) {
432 return scope.engine->throwTypeError();
433 }
434
435 if (!qIsAtMostUintLimit(deleteCount, std::numeric_limits<uint>::max() - 1))
436 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
437
438 if (!property->at)
439 return scope.engine->throwTypeError(u"List doesn't define an At function"_s);
440
441 for (qsizetype i = 0; i < itemCount; ++i) {
442 const auto arg = argv[i + 2];
443 if (!arg.isNull() && !arg.as<QObjectWrapper>())
445 }
446
447 ScopedArrayObject newArray(scope, scope.engine->newArrayObject());
448 newArray->arrayReserve(deleteCount);
449 ScopedValue v(scope);
450 for (qsizetype i = 0; i < deleteCount; ++i) {
451 newArray->arrayPut(
453 }
454 newArray->setArrayLengthUnchecked(deleteCount);
455
456 if (!property->replace)
457 return scope.engine->throwTypeError(u"List doesn't define a Replace function"_s);
458 if (!property->removeLast)
459 return scope.engine->throwTypeError(u"List doesn't define a RemoveLast function"_s);
460 if (!property->append)
461 return scope.engine->throwTypeError(u"List doesn't define an Append function"_s);
462
463 if (itemCount < deleteCount) {
464 for (qsizetype k = start; k < len - deleteCount; ++k)
465 property->replace(property, k + itemCount, property->at(property, k + deleteCount));
466 for (qsizetype k = len; k > len - deleteCount + itemCount; --k)
467 property->removeLast(property);
468 } else if (itemCount > deleteCount) {
469 for (qsizetype k = 0; k < itemCount - deleteCount; ++k)
470 property->append(property, nullptr);
471 for (qsizetype k = len - deleteCount; k > start; --k) {
472 property->replace(
473 property, k + itemCount - 1, property->at(property, k + deleteCount - 1));
474 }
475 }
476
477 for (qsizetype i = 0; i < itemCount; ++i) {
478 const auto arg = argv[i + 2];
479 if (arg.isNull())
480 property->replace(property, start + i, nullptr);
481 else
482 property->replace(property, start + i, arg.as<QObjectWrapper>()->object());
483 }
484
485 return newArray->asReturnedValue();
486}
487
488ReturnedValue PropertyListPrototype::method_unshift(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
489{
490 Scope scope(b);
491 ScopedObject instance(scope, thisObject->toObject(scope.engine));
492 if (!instance)
494
495 QmlListWrapper *w = instance->as<QmlListWrapper>();
496 if (!w)
498
499 QQmlListProperty<QObject> *property = w->d()->property();
500
501 if (!property->count)
502 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
503 const qsizetype len = property->count(property);
504
505 if (std::numeric_limits<qsizetype>::max() - len < argc || !qIsAtMostUintLimit(len + argc))
506 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
507
508 if (!property->append)
509 return scope.engine->throwTypeError(u"List doesn't define an Append function"_s);
510 if (!property->replace)
511 return scope.engine->throwTypeError(u"List doesn't define a Replace function"_s);
512
513 for (int i = 0; i < argc; ++i) {
514 const auto arg = argv[i];
515 if (!arg.isNull() && !arg.as<QObjectWrapper>())
517 }
518
519 for (int i = 0; i < argc; ++i)
520 property->append(property, nullptr);
521 if (property->count(property) != argc + len)
522 return scope.engine->throwTypeError(u"List doesn't append null objects"_s);
523
524 for (qsizetype k = len; k > 0; --k)
525 property->replace(property, k + argc - 1, property->at(property, k - 1));
526
527 for (int i = 0; i < argc; ++i) {
528 const auto *wrapper = argv[i].as<QObjectWrapper>();
529 property->replace(property, i, wrapper ? wrapper->object() : nullptr);
530 }
531
532 return Encode(uint(len + argc));
533}
534
535template<typename Iterate>
536ReturnedValue firstOrLastIndexOf(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc, Iterate iterate)
537{
538 Scope scope(b);
539
540 // Undefined cannot be encoded as QObject*. In particular it's not nullptr.
541 if (argc == 0)
543
544 QObject *searchValue;
545 if (argv[0].isNull()) {
546 searchValue = nullptr;
547 } else {
548 Scoped<QObjectWrapper> wrapper(scope, argv[0]);
549 if (wrapper)
550 searchValue = wrapper->object();
551 else
553 }
554
555 ScopedObject instance(scope, thisObject->toObject(scope.engine));
556 if (!instance)
558
559 QmlListWrapper *w = instance->as<QmlListWrapper>();
560 if (!w)
562
563 QQmlListProperty<QObject> *property = w->d()->property();
564
565 if (!property->count)
566 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
567 const qsizetype len = property->count(property);
568 if (!len)
569 return Encode(-1);
570
571
572 return iterate(scope.engine, property, len, searchValue);
573}
574
575ReturnedValue PropertyListPrototype::method_indexOf(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
576{
577 return firstOrLastIndexOf(
578 b, thisObject, argv, argc,
579 [argc, argv](ExecutionEngine *engine, QQmlListProperty<QObject> *property,
580 qsizetype len, QObject *searchValue) -> ReturnedValue {
581 qsizetype fromIndex = 0;
582 if (argc >= 2) {
583 double f = argv[1].toInteger();
585 return Encode::undefined();
586 if (f >= len)
587 return Encode(-1);
588 if (f < 0)
589 f = qMax(len + f, 0.);
590 fromIndex = qsizetype(f);
591 }
592
593 for (qsizetype i = fromIndex; i < len; ++i) {
594 if (property->at(property, i) == searchValue) {
596 return Encode(uint(i));
597 return engine->throwRangeError(QString::fromLatin1("List length out of range."));
598 }
599 }
600
601 return Encode(-1);
602 });
603}
604
606{
607 return firstOrLastIndexOf(
608 b, thisObject, argv, argc,
609 [argc, argv](ExecutionEngine *engine, QQmlListProperty<QObject> *property,
610 qsizetype len, QObject *searchValue) -> ReturnedValue {
611 qsizetype fromIndex = len - 1;
612 if (argc >= 2) {
613 double f = argv[1].toInteger();
615 return Encode::undefined();
616 if (f > 0)
617 f = qMin(f, (double)(len - 1));
618 else if (f < 0) {
619 f = len + f;
620 if (f < 0)
621 return Encode(-1);
622 }
623 fromIndex = qsizetype(f);
624 }
625
626 for (qsizetype i = fromIndex; i >= 0; --i) {
627 if (property->at(property, i) == searchValue) {
629 return Encode(uint(i));
630 return engine->throwRangeError(QString::fromLatin1("List length out of range."));
631 }
632 }
633
634 return Encode(-1);
635 });
636}
637
638ReturnedValue PropertyListPrototype::method_sort(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
639{
640 Scope scope(b);
641 ScopedObject instance(scope, thisObject->toObject(scope.engine));
642 if (!instance)
644
645 QmlListWrapper *w = instance->as<QmlListWrapper>();
646 if (!w)
648
649 QQmlListProperty<QObject> *property = w->d()->property();
650
651 if (!property->count)
652 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
653 if (property->count(property) == 0)
654 return thisObject->asReturnedValue();
655 if (!property->at)
656 return scope.engine->throwTypeError(u"List doesn't define an At function"_s);
657 if (!property->replace)
658 return scope.engine->throwTypeError(u"List doesn't define a Replace function"_s);
659
660 ScopedValue comparefn(scope, argc ? argv[0] : Value::undefinedValue());
661 if (!comparefn->isUndefined() && !comparefn->isFunctionObject())
663
664 const ArrayElementLessThan lessThan(scope.engine, comparefn);
666 Scoped<QObjectWrapper> o1(scope, QObjectWrapper::wrap(scope.engine, a));
667 Scoped<QObjectWrapper> o2(scope, QObjectWrapper::wrap(scope.engine, b));
668 return lessThan(o1, o2);
669 });
670
671 return thisObject->asReturnedValue();
672}
673
675{
676 Scope scope(b);
677 ScopedObject instance(scope, thisObject->toObject(scope.engine));
678 if (!instance)
680
681 const QmlListWrapper *w = instance->as<QmlListWrapper>();
682 if (!w)
684
685 QQmlListProperty<QObject> *property = w->d()->property();
686 if (!property->count)
687 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
688
689 qsizetype count = property->count(property);
691 return Encode(uint(count));
692
693 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
694}
695
696ReturnedValue PropertyListPrototype::method_set_length(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
697{
698 QV4::Scope scope(b);
699 ScopedObject instance(scope, thisObject->toObject(scope.engine));
700 if (!instance)
702
703 const QmlListWrapper *w = instance->as<QmlListWrapper>();
704 if (!w)
706
707 QQmlListProperty<QObject> *property = w->d()->property();
708
709 bool ok = false;
710 const uint newLength = argc ? argv[0].asArrayLength(&ok) : 0;
711 if (!ok)
712 return scope.engine->throwRangeError(QString::fromLatin1("Invalid list length."));
713
714 if (newLength == 0 && property->clear) {
715 property->clear(property);
716 return true;
717 }
718
719 if (!property->count)
720 return scope.engine->throwTypeError(u"List doesn't define a Count function"_s);
721
722 qsizetype count = property->count(property);
724 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
725
726 if (newLength < uint(count)) {
727 if (!property->removeLast)
728 return scope.engine->throwTypeError(u"List doesn't define a RemoveLast function"_s);
729
730 for (uint i = count; i > newLength; --i)
731 property->removeLast(property);
732
733 return true;
734 }
735
736 if (!property->append)
737 return scope.engine->throwTypeError(u"List doesn't define an Append function"_s);
738
739 for (uint i = count; i < newLength; ++i)
740 property->append(property, nullptr);
741
742 count = property->count(property);
744 return scope.engine->throwRangeError(QString::fromLatin1("List length out of range."));
745
746 if (uint(count) != newLength)
747 return scope.engine->throwTypeError(u"List doesn't append null objects"_s);
748
749 return true;
750
751}
752
\inmodule QtCore
Definition qmetatype.h:341
const QtPrivate::QMetaTypeInterface * iface() const
Definition qmetatype.h:771
\inmodule QtCore
Definition qobject.h:103
static QQmlListReference init(const QQmlListProperty< QObject > &, QMetaType)
Definition qqmllist.cpp:25
The QQmlListReference class allows the manipulation of QQmlListProperty properties.
Definition qqmllist.h:183
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5871
ObjectType::Data * allocate(Args &&... args)
Definition qv4mm_p.h:298
\inmodule QtCore
Definition qvariant.h:65
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:536
short next
Definition keywords.cpp:445
Combined button and popup list for selecting options.
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
#define Q_UNLIKELY(x)
static QDBusError::ErrorType get(const char *name)
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
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
GLuint object
[3]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum target
GLuint start
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
GLenum GLsizei len
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static void appendWrapped(QQmlListProperty< QObject > *p, QObject *o)
static QObject * atWrapped(QQmlListProperty< QObject > *p, qsizetype i)
static void clearWrapped(QQmlListProperty< QObject > *p)
static void removeLastWrapped(QQmlListProperty< QObject > *p)
static qsizetype countWrapped(QQmlListProperty< QObject > *p)
static void replaceWrapped(QQmlListProperty< QObject > *p, qsizetype i, QObject *o)
ReturnedValue firstOrLastIndexOf(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc, Iterate iterate)
static void setArrayData(Heap::QmlListWrapper *d)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
SSL_CTX int void * arg
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define QStringLiteral(str)
unsigned int quint32
Definition qtypes.h:50
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned int uint
Definition qtypes.h:34
long long qint64
Definition qtypes.h:60
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]
Heap::ArrayData * arrayData() const
ListWrapperObject(QQmlListProperty< QObject > *p)
QV4::ScopedObject object
static int metacall(QObject *, Call, int, void **)
static void realloc(Object *o, Type newType, uint alloc, bool enforceAttributes)
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
void setArrayData(ArrayData *a)
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
constexpr ReturnedValue asReturnedValue() const
static constexpr VTable::OwnPropertyKeys virtualOwnPropertyKeys
static constexpr VTable::Get virtualGet
static constexpr VTable::GetLength virtualGetLength
static constexpr VTable::Put virtualPut
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:394
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()