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/qtyperevision.h>
34#include <QtCore/qvariant.h>
35#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 3
36#include <QtCore/qversionnumber.h>
45class QQmlPropertyValueInterceptor;
47class QQmlFinalizerHook;
56struct ExecutionEngine;
58class ExecutableCompilationUnit;
70using QQmlAttachedPropertiesFunc = QQmlPrivate::QQmlAttachedPropertiesFunc<QObject>;
72inline size_t qHash(QQmlAttachedPropertiesFunc func, size_t seed = 0)
74 return qHash(quintptr(func), seed);
77template <
typename TYPE>
89class QQmlCustomParser;
106 class QQmlElement final :
public T
113 QQmlPrivate::qdeclarativeelement_destructor(
this);
124 static void operator
delete(
void *,
void *) {
141 template<
typename T,
typename WrapperT =
T,
typename =
std::
void_t<>>
144 static constexpr bool value =
false;
160 template<
typename Ret,
typename Class>
166 template<
typename T,
typename Marker>
174 static auto test(
int) -> std::enable_if_t<
175 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_uncreatable)>::value
176 &&
bool(U::QmlIsUncreatable::yes),
180 static auto test(...) -> std::false_type;
183 static constexpr bool Value =
decltype(test<T>(0))::value;
186 template<
typename T,
typename WrapperT>
189 if constexpr (!std::is_base_of<QObject, T>::value)
193 if constexpr (!std::is_same_v<T, WrapperT> && HasSingletonFactory<T, WrapperT>::value)
195 if constexpr (
std::is_default_constructible<T>::value)
197 if constexpr (HasSingletonFactory<T>::value)
204 void createInto(
void *memory,
void *) {
new (memory) QQmlElement<T>; }
214 return T::create(q, j);
216 return WrapperT::create(q, j);
229 template<
typename T,
typename WrapperT = T,
233 template<
typename T,
typename WrapperT>
243 template<
typename T,
typename WrapperT>
250 template<
typename T,
typename WrapperT>
259 template<
typename T,
typename WrapperT>
268 template<
typename T,
typename WrapperT>
305 template<
typename F,
typename Result =
void>
308 static constexpr const Result (*create)(
const QJSValue &) =
nullptr;
320 template<
typename T,
typename F,
326 template<
typename T,
typename F>
332 template<
typename T,
typename F,
bool HasCtor>
337 return F::create(params);
341 template<
typename T,
typename F>
346 return QVariant::fromValue(T(params));
350 template<
class From,
class To,
int N>
353 static inline int cast() {
return -1; }
356 template<
class From,
class To>
359 static inline int cast() {
return int(
reinterpret_cast<quintptr>(
static_cast<To *>(
reinterpret_cast<From *>(0x10000000)))) - 0x10000000; }
362 template<
class From,
class To>
379 template<
class T,
class A>
454 return QQmlAttachedPropertiesFunc<QObject>(QmlAttached<T>::attachedPropertiesFunc());
459 return QmlAttached<T>::staticMetaObject();
554 QQmlCustomParser *(*customParserFactory)();
707#if QT_QML_REMOVED_SINCE(6
, 9
)
749#if QT_QML_REMOVED_SINCE(6
, 9
)
763#if QT_QML_REMOVED_SINCE(6
, 9
)
781#if QT_QML_REMOVED_SINCE(6
, 9
)
798#if QT_QML_REMOVED_SINCE(6
, 9
)
805#if QT_QML_REMOVED_SINCE(6
, 9
)
810#if QT_QML_REMOVED_SINCE(6
, 6
)
819#if QT_QML_REMOVED_SINCE(6
, 9
)
826#if QT_QML_REMOVED_SINCE(6
, 9
)
852 template<
typename Value>
859 void (*
signature)(
QV4::ExecutableCompilationUnit *unit, QMetaType *argTypes);
860 void (*
functionPtr)(
const AOTCompiledContext *context,
void **argv);
863#if QT_DEPRECATED_SINCE(6
, 6
)
874 typedef const CachedQmlUnit *(*QmlUnitCacheLookupFunction)(
const QUrl &url);
897#if QT_DEPRECATED_SINCE(6
, 3
)
920 if (!metaObject || !key)
923 const int offset = metaObject->classInfoOffset();
924 const int start = (startOffset == -1)
925 ? (metaObject->classInfoCount() + offset - 1)
927 for (
int i = start; i >= offset; --i)
928 if (qstrcmp(key, metaObject->classInfo(i).name()) == 0) {
934 inline const char *
classInfo(
const QMetaObject *metaObject,
const char *key)
936 return metaObject->classInfo(indexOfOwnClassInfo(metaObject, key)).value();
940 QTypeRevision defaultValue = QTypeRevision())
942 const int index = indexOfOwnClassInfo(metaObject, key);
943 return (index == -1) ? defaultValue
944 : QTypeRevision::fromEncodedVersion(
945 QLatin1StringView(metaObject->classInfo(index).value()).toInt());
951 bool defaultValue =
false)
953 const int index = indexOfOwnClassInfo(metaObject, key);
956 return qstrcmp(metaObject->classInfo(index).value(),
"true") == 0;
971 static auto test(
int) -> std::conditional_t<
972 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_extended)>::value,
973 typename U::QmlExtendedType *,
978 static auto test(...) ->
void *;
991 static constexpr auto metaObjectImpl(
int) ->
992 decltype((
void)U::qmlExtendedNamespace(),
static_cast<
const QMetaObject *>(
nullptr))
994 if constexpr (QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_extendedNamespace)>::value)
995 return U::qmlExtendedNamespace();
1001 static constexpr auto metaObjectImpl(...) ->
const QMetaObject *
1015 static auto test(
int) -> std::conditional_t<
1016 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_foreign)>::value,
1017 typename U::QmlForeignType *,
1022 static auto test(...) -> U *;
1033 static auto test(
int) -> std::enable_if_t<
1034 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_anonymous)>::value
1035 &&
bool(U::QmlIsAnonymous::yes),
1040 static auto test(...) -> std::false_type;
1043 static constexpr bool Value =
decltype(test<T>(0))::value;
1051 static auto test(
int) -> std::enable_if_t<
1052 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_singleton)>::value
1053 &&
bool(U::QmlIsSingleton::yes),
1058 static auto test(...) -> std::false_type;
1061 static constexpr bool Value =
decltype(test<T>(0))::value;
1072 static auto test_impl(...) -> std::false_type;
1075 static constexpr bool test() {
1076 if constexpr (
decltype(test_impl<U>(0))::value) {
1077 static_assert((
std::is_same_v<
typename U::QmlSequenceValueType,
1085 static constexpr bool Value = test<T>();
1093 static auto test(
int) ->
1097 static auto test(...) -> std::false_type;
1100 static constexpr bool Value =
decltype(test<T>(0))::value;
1103 template<
class T,
typename =
std::
void_t<>>
1120 if constexpr (!
std::is_default_constructible_v<T>)
1122 else if constexpr (std::is_base_of_v<QObject, T>)
1125 return std::is_copy_constructible_v<T>;
1130 if constexpr (std::is_base_of_v<QObject, T>)
1131 return QMetaType::fromType<T*>();
1133 return QMetaType::fromType<T>();
1138 if constexpr (std::is_base_of_v<QObject, T>)
1139 return QMetaType::fromType<QQmlListProperty<T>>();
1141 return QMetaType::fromType<QList<T>>();
1146 if constexpr (std::is_base_of_v<QObject, T>)
1147 return QMetaSequence();
1149 return QMetaSequence::fromContainer<QList<T>>();
1165 static constexpr int size() {
return 0; }
1168 template<
typename T,
typename E,
typename WrapperT = T>
1170 const QMetaObject *classInfoMetaObject,
1171 QList<
int> *qmlTypeIds,
const QMetaObject *extension)
1173 static_assert(std::is_base_of_v<QObject, T>);
1178 QTypeRevision::fromMajorVersion(versionMajor),
1180 Constructors<T, WrapperT>::createSingletonInstance,
1182 StaticMetaObject<T>::staticMetaObject(),
1183 classInfoMetaObject,
1185 QmlMetaType<T>::self(),
1187 ExtendedType<E>::createParent,
1188 extension ? extension : ExtendedType<E>::staticMetaObject(),
1196 template<
typename T,
typename E>
1198 const QMetaObject *classInfoMetaObject,
1199 QList<
int> *qmlTypeIds,
const QMetaObject *extension,
1200 bool forceAnonymous =
false)
1204 QmlMetaType<T>::self(),
1205 QmlMetaType<T>::list(),
1206 QmlMetaType<T>::size(),
1207 Constructors<T>::createInto,
1209 ValueType<T, E>::create,
1212 QTypeRevision::fromMajorVersion(versionMajor),
1214 StaticMetaObject<T>::staticMetaObject(),
1215 classInfoMetaObject,
1217 attachedPropertiesFunc<T>(),
1218 attachedPropertiesMetaObject<T>(),
1220 StaticCastSelector<T, QQmlParserStatus>::cast(),
1221 StaticCastSelector<T, QQmlPropertyValueSource>::cast(),
1222 StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(),
1224 ExtendedType<E>::createParent,
1225 extension ? extension : ExtendedType<E>::staticMetaObject(),
1227 &qmlCreateCustomParser<T>,
1229 StaticCastSelector<T, QQmlFinalizerHook>::cast(),
1232 QmlMetaType<T>::sequence(),
1241 template<
typename T>
1243 const QMetaObject *classInfoMetaObject,
1244 QList<
int> *qmlTypeIds)
1249 QTypeRevision::fromMajorVersion(versionMajor),
1250 classInfoMetaObject,
1251 QMetaType::fromType<T>(),
1252 QMetaSequence::fromContainer<T>(),
1265 const QtPrivate::QMetaTypeInterface::MetaObjectFn &metaObjectFunction,
const char *name)
1327 return lhs.module == rhs.module && lhs.name == rhs.name
1328 && lhs.icNameOrExtensionTypeName == rhs.icNameOrExtensionTypeName
1347 return lhs.base == rhs.base && lhs.member == rhs.member && lhs.enumName == rhs.enumName;
1381 const Lookup &lookup,
const Signature &signature);
1388Q_DECLARE_OPAQUE_POINTER(QQmlV4FunctionPtr)
1389Q_DECLARE_OPAQUE_POINTER(QQmlV4ExecutionEnginePtr)
void operator delete(void *)
static void operator delete(void *ptr)
static constexpr QLatin1StringView s_thisCuModule("##THIS_CU_MODULE##")
static constexpr QLatin1StringView s_thisCuType("##THIS_CU_TYPE##")
Q_QML_EXPORT bool validateLookupSignature(QQmlEngine *engine, QV4::CompiledData::CompilationUnit *cu, const Lookup &lookup, const Signature &signature)
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.
bool(*)(QQmlEngine *engine, CompilationUnit *cu) LookupValidationFn
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)
friend bool comparesEqual(const Lookup &lhs, const Lookup &rhs) noexcept
std::vector< QString > paramNames
std::vector< Type > types
friend bool comparesEqual(const Type &lhs, const Type &rhs) noexcept
QString icNameOrExtensionTypeName
virtual ~AOTTrackedLocalsStorage()=default
virtual void markObjects(QV4::MarkStack *markStack) const =0
QV4::CompiledData::LookupValidationFn validateLookupSignatures
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 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)