50 DECLARE_MARKOBJECTS(VariantAssociationObject)
52 enum class AssociationType: quint8
59 const QVariantMap &variantMap, QV4::Heap::Object *container,
int property,
60 Heap::ReferenceObject::Flags flags);
63 const QVariantHash &variantHash, QV4::Heap::Object *container,
int property,
64 Heap::ReferenceObject::Flags flags);
68 void *storagePointer() {
return &m_variantAssociation; }
71 bool setVariant(
const QVariant &variant);
73 template<
typename Association>
74 void createElementWrappers(
const Association &association)
78 QV4::Scope scope(internalClass->engine);
79 QV4::ScopedObject self(scope,
this);
80 for (
auto it = association.begin(), end = association.end(); it != end; ++it) {
81 QV4::ScopedString key(scope, scope.engine->newString(it.key()));
82 QV4::ScopedValue val(scope, scope.engine->fromVariant(*it));
87 QV4::ReturnedValue getElement(
const QString &id,
bool *hasProperty);
89 VariantAssociationObject *detached();
95 static constexpr auto alignment = std::max(
alignof(QVariantMap),
alignof(QVariantHash));
97 std::byte m_variantAssociation[std::max(
sizeof(QVariantMap),
sizeof(QVariantHash))];
99 AssociationType m_type;