6#include <QtQml/qqmlinfo.h>
8#include <private/qqmllist_p.h>
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>
47 return object->arrayData();
54 Heap::ArrayData *arrayData =
object.arrayData();
58 object.scope.engine->throwRangeError(
QLatin1String(
"Too many elements."));
63 arrayData->vtable()->put(
70 return object.arrayData()->length();
83 object.arrayData()->vtable()->truncate(
object.
object, 0);
89 object.arrayData()->vtable()->put(
96 Heap::ArrayData *arrayData =
object.arrayData();
99 arrayData->vtable()->truncate(
object.
object,
length - 1);
108 *
property() = QQmlListProperty<QObject>(
117 m_object.init(
object);
118 m_propertyType = propertyType.
iface();
127 m_object.init(
object);
128 m_propertyType = propertyType.
iface();
141 if (!
object || propId == -1)
179 if (
id.isArrayIndex()) {
182 ?
w->d()->property()->count(
w->d()->property())
201 QQmlListProperty<QObject> *
property =
static_cast<const QmlListWrapper *
>(
m)->
d()->property();
203 return property->count ?
property->count(
property) : 0;
213 QQmlListProperty<QObject> *prop =
w->d()->property();
215 if (
id.isArrayIndex()) {
216 if (!prop->count || !prop->replace)
220 const int count = prop->count(prop);
224 if (
value.isNull()) {
225 prop->replace(prop,
index,
nullptr);
253 quint32 count =
w->d()->property()->count ?
w->d()->property()->count(
w->d()->property()) : 0;
254 if (arrayIndex <
count) {
261 w->engine(),
w->d()->property()->at(
w->d()->property(),
index));
264 }
else if (memberIndex == 0) {
266 return o->engine()->id_length()->propertyKey();
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);
303 QQmlListProperty<QObject> *
property =
w->d()->property();
320 return result->asReturnedValue();
333 QQmlListProperty<QObject> *
property =
w->d()->property();
339 for (
int i = 0;
i < argc; ++
i) {
349 for (
int i = 0;
i < argc; ++
i) {
350 if (argv[
i].isNull())
351 property->append(
property,
nullptr);
353 property->append(
property, argv[
i].as<QV4::QObjectWrapper>()->
object());
356 const auto actualLength =
property->count(
property);
357 if (actualLength !=
length + argc)
373 QQmlListProperty<QObject> *
property =
w->d()->property();
394 return result->asReturnedValue();
407 QQmlListProperty<QObject> *
property =
w->d()->property();
424 }
else if (argc > 1){
425 itemCount = argc - 2;
430 if (itemCount > deleteCount
431 &&
len > std::numeric_limits<qsizetype>::max() - itemCount + deleteCount) {
442 const auto arg = argv[
i + 2];
448 newArray->arrayReserve(deleteCount);
454 newArray->setArrayLengthUnchecked(deleteCount);
463 if (itemCount < deleteCount) {
468 }
else if (itemCount > deleteCount) {
469 for (
qsizetype k = 0; k < itemCount - deleteCount; ++k)
478 const auto arg = argv[
i + 2];
485 return newArray->asReturnedValue();
499 QQmlListProperty<QObject> *
property =
w->d()->property();
513 for (
int i = 0;
i < argc; ++
i) {
514 const auto arg = argv[
i];
519 for (
int i = 0;
i < argc; ++
i)
527 for (
int i = 0;
i < argc; ++
i) {
535template<
typename Iterate>
545 if (argv[0].isNull()) {
546 searchValue =
nullptr;
548 Scoped<QObjectWrapper>
wrapper(scope, argv[0]);
550 searchValue =
wrapper->object();
563 QQmlListProperty<QObject> *
property =
w->d()->property();
578 b, thisObject, argv, argc,
608 b, thisObject, argv, argc,
649 QQmlListProperty<QObject> *
property =
w->d()->property();
661 if (!comparefn->isUndefined() && !comparefn->isFunctionObject())
685 QQmlListProperty<QObject> *
property =
w->d()->property();
707 QQmlListProperty<QObject> *
property =
w->d()->property();
714 if (newLength == 0 &&
property->clear) {
static QQmlListReference init(const QQmlListProperty< QObject > &, QMetaType)
The QQmlListReference class allows the manipulation of QQmlListProperty properties.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
ObjectType::Data * allocate(Args &&... args)
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 >
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)
static QV4::ReturnedValue method_get_length(const FunctionObject *b, const Value *thisObject, const Value *, int)
bool hasExceptionOrIsInterrupted(ExecutionEngine *engine)
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)
constexpr const T & qMax(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
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)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
static bool lessThan(const QChar *a, int l, const char *c)
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)
Heap::ArrayData * arrayData() const
ListWrapperObject(QQmlListProperty< QObject > *p)
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)
static V4_NEEDS_DESTROY ReturnedValue create(ExecutionEngine *engine, QObject *object, int propId, QMetaType propType)
QQmlListReference toListReference() const
QVariant toVariant() const
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()
uint asArrayLength(bool *ok) const
Heap::Object * toObject(ExecutionEngine *e) const
PropertyKey next(const Object *o, Property *pd=nullptr, PropertyAttributes *attrs=nullptr) override
~QmlListWrapperOwnPropertyKeyIterator() override=default