19#include <QtQml/qjsprimitivevalue.h>
20#include <QtQml/qjsvalue.h>
21#include <QtQml/qqmllist.h>
22#include <QtQml/qqmlparserstatus.h>
23#include <QtQml/qqmlpropertyvaluesource.h>
24#include <QtQml/qtqmlglobal.h>
26#include <QtCore/qdatetime.h>
27#include <QtCore/qdebug.h>
28#include <QtCore/qglobal.h>
29#include <QtCore/qmetasequence.h>
30#include <QtCore/qmetaobject.h>
31#include <QtCore/qpointer.h>
32#include <QtCore/qurl.h>
33#include <QtCore/qvariant.h>
34#include <QtCore/qversionnumber.h>
42class QQmlPropertyValueInterceptor;
44class QQmlFinalizerHook;
53struct ExecutionEngine;
55class ExecutableCompilationUnit;
65using QQmlAttachedPropertiesFunc = QQmlPrivate::QQmlAttachedPropertiesFunc<QObject>;
67inline size_t qHash(QQmlAttachedPropertiesFunc func, size_t seed = 0)
69 return qHash(quintptr(func), seed);
72template <
typename TYPE>
84class QQmlCustomParser;
101 class QQmlElement final :
public T
108 QQmlPrivate::qdeclarativeelement_destructor(
this);
119 static void operator
delete(
void *,
void *) {
135 template<
typename T,
typename WrapperT =
T,
typename =
std::
void_t<>>
138 static constexpr bool value =
false;
151 template<
typename T,
typename WrapperT>
154 if constexpr (!std::is_base_of<QObject, T>::value)
156 if constexpr (!std::is_same_v<T, WrapperT> && HasSingletonFactory<T, WrapperT>::value)
158 if constexpr (
std::is_default_constructible<T>::value)
160 if constexpr (HasSingletonFactory<T>::value)
169 template<
typename Ret,
typename Class>
175 template<
typename T,
typename Marker>
179 void createInto(
void *memory,
void *) {
new (memory) QQmlElement<T>; }
189 return T::create(q, j);
191 return WrapperT::create(q, j);
204 template<
typename T,
typename WrapperT = T,
208 template<
typename T,
typename WrapperT>
218 template<
typename T,
typename WrapperT>
225 template<
typename T,
typename WrapperT>
234 template<
typename T,
typename WrapperT>
271 template<
typename F,
typename Result =
void>
274 static constexpr const Result (*create)(
const QJSValue &) =
nullptr;
286 template<
typename T,
typename F,
292 template<
typename T,
typename F>
298 template<
typename T,
typename F,
bool HasCtor>
303 return F::create(params);
307 template<
typename T,
typename F>
312 return QVariant::fromValue(T(params));
316 template<
class From,
class To,
int N>
319 static inline int cast() {
return -1; }
322 template<
class From,
class To>
325 static inline int cast() {
return int(
reinterpret_cast<quintptr>(
static_cast<To *>(
reinterpret_cast<From *>(0x10000000)))) - 0x10000000; }
328 template<
class From,
class To>
345 template<
class T,
class A>
420 return QQmlAttachedPropertiesFunc<QObject>(QmlAttached<T>::attachedPropertiesFunc());
425 return QmlAttached<T>::staticMetaObject();
520 QQmlCustomParser *(*customParserFactory)();
673#if QT_QML_REMOVED_SINCE(6
, 9
)
715#if QT_QML_REMOVED_SINCE(6
, 9
)
729#if QT_QML_REMOVED_SINCE(6
, 9
)
747#if QT_QML_REMOVED_SINCE(6
, 9
)
764#if QT_QML_REMOVED_SINCE(6
, 9
)
771#if QT_QML_REMOVED_SINCE(6
, 9
)
776#if QT_QML_REMOVED_SINCE(6
, 6
)
785#if QT_QML_REMOVED_SINCE(6
, 9
)
792#if QT_QML_REMOVED_SINCE(6
, 9
)
818 template<
typename Value>
825 void (*
signature)(
QV4::ExecutableCompilationUnit *unit, QMetaType *argTypes);
826 void (*
functionPtr)(
const AOTCompiledContext *context,
void **argv);
829#if QT_DEPRECATED_SINCE(6
, 6
)
840 typedef const CachedQmlUnit *(*QmlUnitCacheLookupFunction)(
const QUrl &url);
863#if QT_DEPRECATED_SINCE(6
, 3
)
886 if (!metaObject || !key)
889 const int offset = metaObject->classInfoOffset();
890 const int start = (startOffset == -1)
891 ? (metaObject->classInfoCount() + offset - 1)
893 for (
int i = start; i >= offset; --i)
894 if (qstrcmp(key, metaObject->classInfo(i).name()) == 0) {
900 inline const char *
classInfo(
const QMetaObject *metaObject,
const char *key)
902 return metaObject->classInfo(indexOfOwnClassInfo(metaObject, key)).value();
906 QTypeRevision defaultValue = QTypeRevision())
908 const int index = indexOfOwnClassInfo(metaObject, key);
909 return (index == -1) ? defaultValue
910 : QTypeRevision::fromEncodedVersion(
911 QLatin1StringView(metaObject->classInfo(index).value()).toInt());
917 bool defaultValue =
false)
919 const int index = indexOfOwnClassInfo(metaObject, key);
922 return qstrcmp(metaObject->classInfo(index).value(),
"true") == 0;
937 static auto test(
int) -> std::conditional_t<
938 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_extended)>::value,
939 typename U::QmlExtendedType *,
944 static auto test(...) ->
void *;
957 static constexpr auto metaObjectImpl(
int) ->
958 decltype((
void)U::qmlExtendedNamespace(),
static_cast<
const QMetaObject *>(
nullptr))
960 if constexpr (QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_extendedNamespace)>::value)
961 return U::qmlExtendedNamespace();
967 static constexpr auto metaObjectImpl(...) ->
const QMetaObject *
981 static auto test(
int) -> std::conditional_t<
982 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_foreign)>::value,
983 typename U::QmlForeignType *,
988 static auto test(...) -> U *;
999 static auto test(
int) -> std::enable_if_t<
1000 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_uncreatable)>::value
1001 &&
bool(U::QmlIsUncreatable::yes),
1005 static auto test(...) -> std::false_type;
1008 static constexpr bool Value =
decltype(test<T>(0))::value;
1016 static auto test(
int) -> std::enable_if_t<
1017 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_anonymous)>::value
1018 &&
bool(U::QmlIsAnonymous::yes),
1023 static auto test(...) -> std::false_type;
1026 static constexpr bool Value =
decltype(test<T>(0))::value;
1034 static auto test(
int) -> std::enable_if_t<
1035 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_singleton)>::value
1036 &&
bool(U::QmlIsSingleton::yes),
1041 static auto test(...) -> std::false_type;
1044 static constexpr bool Value =
decltype(test<T>(0))::value;
1055 static auto test_impl(...) -> std::false_type;
1058 static constexpr bool test() {
1059 if constexpr (
decltype(test_impl<U>(0))::value) {
1060 static_assert((
std::is_same_v<
typename U::QmlSequenceValueType,
1068 static constexpr bool Value = test<T>();
1076 static auto test(
int) ->
1080 static auto test(...) -> std::false_type;
1083 static constexpr bool Value =
decltype(test<T>(0))::value;
1086 template<
class T,
typename =
std::
void_t<>>
1103 if constexpr (!
std::is_default_constructible_v<T>)
1105 else if constexpr (std::is_base_of_v<QObject, T>)
1108 return std::is_copy_constructible_v<T>;
1113 if constexpr (std::is_base_of_v<QObject, T>)
1114 return QMetaType::fromType<T*>();
1116 return QMetaType::fromType<T>();
1121 if constexpr (std::is_base_of_v<QObject, T>)
1122 return QMetaType::fromType<QQmlListProperty<T>>();
1124 return QMetaType::fromType<QList<T>>();
1129 if constexpr (std::is_base_of_v<QObject, T>)
1130 return QMetaSequence();
1132 return QMetaSequence::fromContainer<QList<T>>();
1148 static constexpr int size() {
return 0; }
1151 template<
typename T,
typename E,
typename WrapperT = T>
1153 const QMetaObject *classInfoMetaObject,
1154 QList<
int> *qmlTypeIds,
const QMetaObject *extension)
1156 static_assert(std::is_base_of_v<QObject, T>);
1161 QTypeRevision::fromMajorVersion(versionMajor),
1163 Constructors<T, WrapperT>::createSingletonInstance,
1165 StaticMetaObject<T>::staticMetaObject(),
1166 classInfoMetaObject,
1168 QmlMetaType<T>::self(),
1170 ExtendedType<E>::createParent,
1171 extension ? extension : ExtendedType<E>::staticMetaObject(),
1179 template<
typename T,
typename E>
1181 const QMetaObject *classInfoMetaObject,
1182 QList<
int> *qmlTypeIds,
const QMetaObject *extension,
1183 bool forceAnonymous =
false)
1187 QmlMetaType<T>::self(),
1188 QmlMetaType<T>::list(),
1189 QmlMetaType<T>::size(),
1190 Constructors<T>::createInto,
1192 ValueType<T, E>::create,
1195 QTypeRevision::fromMajorVersion(versionMajor),
1197 StaticMetaObject<T>::staticMetaObject(),
1198 classInfoMetaObject,
1200 attachedPropertiesFunc<T>(),
1201 attachedPropertiesMetaObject<T>(),
1203 StaticCastSelector<T, QQmlParserStatus>::cast(),
1204 StaticCastSelector<T, QQmlPropertyValueSource>::cast(),
1205 StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(),
1207 ExtendedType<E>::createParent,
1208 extension ? extension : ExtendedType<E>::staticMetaObject(),
1210 &qmlCreateCustomParser<T>,
1212 StaticCastSelector<T, QQmlFinalizerHook>::cast(),
1215 QmlMetaType<T>::sequence(),
1224 template<
typename T>
1226 const QMetaObject *classInfoMetaObject,
1227 QList<
int> *qmlTypeIds)
1232 QTypeRevision::fromMajorVersion(versionMajor),
1233 classInfoMetaObject,
1234 QMetaType::fromType<T>(),
1235 QMetaSequence::fromContainer<T>(),
1248 const QtPrivate::QMetaTypeInterface::MetaObjectFn &metaObjectFunction,
const char *name)
1294Q_DECLARE_OPAQUE_POINTER(QQmlV4FunctionPtr)
1295Q_DECLARE_OPAQUE_POINTER(QQmlV4ExecutionEnginePtr)
void operator delete(void *)
static void operator delete(void *ptr)
QTypeRevision revisionClassInfo(const QMetaObject *metaObject, const char *key, QTypeRevision defaultValue=QTypeRevision())
QObject * createParent(QObject *p)
A *(*)(QObject *) QQmlAttachedPropertiesFunc
constexpr QtPrivate::QMetaTypeInterface metaTypeForNamespace(const QtPrivate::QMetaTypeInterface::MetaObjectFn &metaObjectFunction, const char *name)
void(*)(void *, void *) CreateIntoFunction
std::is_same< T, typename QmlMarkerFunction< Marker >::ClassType > QmlTypeHasMarker
QObject * createSingletonInstance(QQmlEngine *q, QJSEngine *j)
void Q_QML_EXPORT qmlRegisterTypeAndRevisions< QQmlTypeNotAvailable, void >(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds, const QMetaObject *, bool)
static int indexOfOwnClassInfo(const QMetaObject *metaObject, const char *key, int startOffset=-1)
void createInto(void *memory, void *)
void qmlRegisterSequenceAndRevisions(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds)
Q_QML_EXPORT void qmlRegistrationWarning(QmlRegistrationWarning warning, QMetaType type)
@ CompositeSingletonRegistration
@ SequentialContainerRegistration
@ SequentialContainerAndRevisionsRegistration
@ QmlUnitCacheHookRegistration
@ SingletonAndRevisionsRegistration
@ TypeAndRevisionsRegistration
SingletonConstructionMode
QQmlAttachedPropertiesFunc< QObject > attachedPropertiesFunc()
@ UnconstructibleSingleton
constexpr SingletonConstructionMode singletonConstructionMode()
const QMetaObject * attachedPropertiesMetaObject()
const char * classInfo(const QMetaObject *metaObject, const char *key)
void qmlRegisterSingletonAndRevisions(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds, const QMetaObject *extension)
bool boolClassInfo(const QMetaObject *metaObject, const char *key, bool defaultValue=false)
void qmlRegisterTypeAndRevisions(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds, const QMetaObject *extension, bool forceAnonymous=false)
Combined button and popup list for selecting options.
DECLARE_HEAP_OBJECT(DynamicFunctionObject, FunctionObject)
DECLARE_HEAP_OBJECT(BoundFunction, JavaScriptFunctionObject)
DECLARE_HEAP_OBJECT(ConstructorFunction, ScriptFunction)
DECLARE_HEAP_OBJECT(FunctionObject, Object)
DECLARE_HEAP_OBJECT(JavaScriptFunctionObject, FunctionObject)
DECLARE_HEAP_OBJECT(MemberFunction, ArrowFunction)
DECLARE_HEAP_OBJECT(ScriptFunction, ArrowFunction)
ReturnedValue checkedResult(QV4::ExecutionEngine *v4, ReturnedValue result)
void(* IRLoaderFunction)(Document *, const QQmlPrivate::CachedQmlUnit *)
size_t qHash(QByteArrayView key, size_t seed) noexcept
QQmlCustomParser * qmlCreateCustomParser()
QV4::ExecutionEngine * QQmlV4ExecutionEnginePtr
QQmlV4Function * QQmlV4FunctionPtr
DEFINE_OBJECT_VTABLE(SharedArrayBufferCtor)
DEFINE_OBJECT_VTABLE(ArrayBufferCtor)
DEFINE_OBJECT_VTABLE(ArrayBuffer)
DEFINE_OBJECT_VTABLE(SharedArrayBuffer)
#define Q_MANAGED_TYPE(type)
#define V4_INTERNALCLASS(c)
#define RETURN_UNDEFINED()
void(* functionPtr)(const AOTCompiledContext *context, void **argv)
void(* signature)(QV4::ExecutableCompilationUnit *unit, QMetaType *argTypes)
virtual ~AOTTrackedLocalsStorage()=default
virtual void markObjects(QV4::MarkStack *markStack) const =0
const AOTCompiledFunction * aotCompiledFunctions
const QV4::CompiledData::Unit * qmlData
static constexpr CreateIntoFunction createInto
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateIntoFunction createInto
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateIntoFunction createInto
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateIntoFunction createInto
static const QMetaObject * staticMetaObject()
static constexpr const CreateParentFunction createParent
static constexpr bool value
static constexpr bool Value
static QQmlAttachedPropertiesFunc< QObject > attachedPropertiesFunc()
static const QMetaObject * staticMetaObject()
static Func attachedPropertiesFunc()
static const QMetaObject * staticMetaObject()
static constexpr const QMetaObject * metaObject()
static constexpr bool Value
static constexpr bool Value
static constexpr bool Value
static constexpr bool Value
AutoParentFunction function
QmlUnitCacheLookupFunction lookupCachedQmlUnit
const QMetaObject * classInfoMetaObject
QMetaSequence metaSequence
QList< int > * qmlTypeIds
QMetaSequence metaSequence
const QMetaObject * instanceMetaObject
const QMetaObject * classInfoMetaObject
std::function< QObject *(QQmlEngine *, QJSEngine *)> qObjectApi
const QMetaObject * extensionMetaObject
QList< int > * qmlTypeIds
QObject *(* extensionObjectCreate)(QObject *)
std::function< QObject *(QQmlEngine *, QJSEngine *)> qObjectApi
QObject *(* extensionObjectCreate)(QObject *)
std::function< QJSValue(QQmlEngine *, QJSEngine *)> scriptApi
const QMetaObject * extensionMetaObject
const QMetaObject * instanceMetaObject
QObject *(* extensionObjectCreate)(QObject *)
QQmlAttachedPropertiesFunc< QObject > attachedPropertiesFunction
QVariant(* createValueType)(const QJSValue &)
const QMetaObject * extensionMetaObject
const QMetaObject * metaObject
void(* create)(void *, void *)
QMetaSequence listMetaSequence
const QMetaObject * classInfoMetaObject
const QMetaObject * attachedPropertiesMetaObject
QList< int > * qmlTypeIds
QQmlCustomParser * customParser
void(* create)(void *, void *)
QQmlAttachedPropertiesFunc< QObject > attachedPropertiesFunction
QVariant(* createValueType)(const QJSValue &)
const QMetaObject * extensionMetaObject
QObject *(* extensionObjectCreate)(QObject *)
const QMetaObject * metaObject
const QMetaObject * attachedPropertiesMetaObject
bool has(StructVersion v) const
ValueTypeCreationMethod creationMethod
static no_type checkType(...)
static yes_type checkType(To *)
static QVariant create(const QJSValue ¶ms)
static constexpr const CreateValueTypeFunction create
static QVariant create(const QJSValue ¶ms)
static ReturnedValue method_isView(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get_byteLength(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_slice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void init(ExecutionEngine *engine, Object *ctor)
static void virtualCallWithMetaTypes(const FunctionObject *f, QObject *thisObject, void **a, const QMetaType *types, int argc)
static ReturnedValue virtualCall(const QV4::FunctionObject *f, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static QQmlRefPointer< ExecutableCompilationUnit > parse(ExecutionEngine *engine, const Value *argv, int argc, Type t=Type_Function)
static ReturnedValue method_bind(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_call(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_hasInstance(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_apply(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void init(QV4::ExecutionEngine *engine)
void init(QV4::ExecutionContext *scope, Function *function, QV4::String *name=nullptr)
void init(QV4::ExecutionEngine *engine)
void init(QV4::ExecutionEngine *engine, qsizetype index, VTable::Call call)
void init(QV4::ExecutionEngine *engine)
Heap::InternalClass * classForConstructor() const
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
void init(ExecutionEngine *engine, Object *ctor)
static ReturnedValue method_get_byteLength(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_slice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue slice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc, bool shared)