Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmllistwrapper_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// Qt-Security score:significant
4
5#ifndef QQMLLISTWRAPPER_P_H
6#define QQMLLISTWRAPPER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qglobal.h>
20#include <QtCore/qpointer.h>
21
22#include <QtQml/qqmllist.h>
23
24#include <private/qv4value_p.h>
25#include <private/qv4object_p.h>
26
28
30
31class QQmlProperty;
32
33namespace QV4 {
34
35namespace Heap {
36
38{
39 void init(QMetaType propertyType);
40 void init(QObject *object, int propertyId, QMetaType propertyType);
41 void init(QObject *object, const QQmlListProperty<QObject> &list, QMetaType propertyType);
42 void destroy();
43
44 QObject *object() const { return m_object.data(); }
45 QMetaType propertyType() const { return QMetaType(m_propertyType); }
46 QMetaType elementType() const { return QQmlMetaType::listValueType(propertyType()); }
47
49 {
50 return reinterpret_cast<const QQmlListProperty<QObject>*>(m_propertyData);
51 }
52
54 {
55 return reinterpret_cast<QQmlListProperty<QObject>*>(m_propertyData);
56 }
57
58private:
59 void *m_propertyData[sizeof(QQmlListProperty<QObject>)/sizeof(void*)];
60
61 QV4QPointer<QObject> m_object;
62
63 // interface instead of QMetaType to keep class a POD
64 const QtPrivate::QMetaTypeInterface *m_propertyType;
65};
66
67}
68
69struct Q_QML_EXPORT QmlListWrapper : Object
70{
75
77 static ReturnedValue create(ExecutionEngine *engine, const QQmlListProperty<QObject> &prop, QMetaType propType);
78 static ReturnedValue create(ExecutionEngine *engine, QMetaType propType);
79 static ReturnedValue createOwned(ExecutionEngine *engine, const QQmlProperty &prop);
80
81 QVariant toVariant() const;
83
84 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
85 static qint64 virtualGetLength(const Managed *m);
86 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
87 static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
88};
89
91{
92 V4_PROTOTYPE(arrayPrototype)
93
94 void init();
95
96 static ReturnedValue method_pop(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
97 static ReturnedValue method_push(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
98 static ReturnedValue method_shift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
99 static ReturnedValue method_splice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
100 static ReturnedValue method_unshift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
101 static ReturnedValue method_indexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
102 static ReturnedValue method_lastIndexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
103 static ReturnedValue method_sort(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
104 static ReturnedValue method_get_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
105 static ReturnedValue method_set_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
106};
107
108}
109
110QT_END_NAMESPACE
111
112#endif
Combined button and popup list for selecting options.
Definition qjsvalue.h:24
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQIORing)
static void appendWrapped(QQmlListProperty< QObject > *p, QObject *o)
static QObject * atWrapped(QQmlListProperty< QObject > *p, qsizetype i)
static void clearWrapped(QQmlListProperty< QObject > *p)
DEFINE_OBJECT_VTABLE(QmlListWrapper)
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)
void init(QObject *object, int propertyId, QMetaType propertyType)
QMetaType elementType() const
QQmlListProperty< QObject > * property()
const QQmlListProperty< QObject > * property() const
void init(QMetaType propertyType)
QMetaType propertyType() const
void init(QObject *object, const QQmlListProperty< QObject > &list, QMetaType propertyType)
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 qint64 virtualGetLength(const Managed *m)
static OwnPropertyKeyIterator * virtualOwnPropertyKeys(const Object *m, Value *target)
static ReturnedValue create(ExecutionEngine *engine, const QQmlListProperty< QObject > &prop, QMetaType propType)
QQmlListReference toListReference() const
static ReturnedValue create(ExecutionEngine *engine, QMetaType propType)
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver)
static ReturnedValue createOwned(ExecutionEngine *engine, const QQmlProperty &prop)
QVariant toVariant() const
PropertyKey next(const Object *o, Property *pd=nullptr, PropertyAttributes *attrs=nullptr) override
~QmlListWrapperOwnPropertyKeyIterator() override=default