5#ifndef QPROPERTYPRIVATE_H
6#define QPROPERTYPRIVATE_H
19#include <QtCore/qglobal.h>
20#include <QtCore/qtaggedpointer.h>
21#include <QtCore/qmetatype.h>
22#include <QtCore/qcontainerfwd.h>
23#include <QtCore/qttypetraits.h>
31template<
typename Class,
typename T,
auto Offset,
auto Setter,
auto Signal,
auto Getter>
35using PendingBindingObserverList = QVarLengthArray<QPropertyBindingPrivatePtr>;
44 bool deref() {
return --ref != 0; }
51class QQmlPropertyBinding;
52class QPropertyBindingPrivate;
61 explicit operator const T *()
const noexcept {
return d; }
62 T *
data()
const noexcept {
return d; }
63 T *
get()
const noexcept {
return d; }
65 T *
take()
noexcept {
T *x = d; d =
nullptr;
return x; }
71 destroyAndFreeMemory();
77 :
d(
o.
d) {
if (d) d->addRef(); }
79 void reset(
T *ptr =
nullptr)
noexcept;
94 operator bool ()
const noexcept {
return d !=
nullptr; }
95 bool operator!()
const noexcept {
return d ==
nullptr; }
106 const T *
rhs)
noexcept
117class QUntypedPropertyBinding;
118class QPropertyBindingPrivate;
120class QPropertyObserver;
137class QPropertyBindingData;
157
158
159
175 static_assert (
alignof(Callable) <=
alignof(std::max_align_t),
"Bindings do not support overaligned functors!");
178 if constexpr (!
std::is_invocable_v<Callable>) {
180 static_assert (std::is_invocable_r_v<
bool, Callable, QMetaType, QUntypedPropertyData *> );
181 auto untypedEvaluationFunction =
static_cast<Callable *>(f);
182 return std::invoke(*untypedEvaluationFunction, metaType, dataPtr);
187 auto evaluationFunction =
static_cast<Callable *>(f);
188 PropertyType newValue =
std::invoke(*evaluationFunction);
189 if constexpr (QTypeTraits::has_operator_equal_v<PropertyType>) {
190 if (newValue == propertyPtr->valueBypassingBindings())
193 propertyPtr->setValueBypassingBindings(
std::move(newValue));
197 Q_UNREACHABLE_RETURN(
false);
200 [](
void *f){
static_cast<Callable *>(f)->~Callable(); },
201 [](
void *addr,
void *other){
202 new (addr) Callable(
std::move(*
static_cast<Callable *>(other)));
223
224
225
226
227
228
229
230
231
292
293
294
295
296
297
298
299
300
301
325template <
typename T,
typename Tag>
337 d =
reinterpret_cast<quintptr *>(ptr);
343 d =
reinterpret_cast<quintptr *>(ptr);
354 *d =
reinterpret_cast<quintptr>(ptr) | (*d & QTaggedPointer<T, Tag>::tagMask());
359 return reinterpret_cast<T*>(*d & QTaggedPointer<T, Tag>::pointerMask());
368 quintptr *d =
nullptr;
372 template <
typename F>
375 template<
typename T,
typename C>
\macro Q_OBJECT_BINDABLE_PROPERTY(containingClass, type, name, signal)
operator const T *() const noexcept
QPropertyBindingPrivatePtr & operator=(const QPropertyBindingPrivatePtr &o) noexcept
QPropertyBindingPrivatePtr & operator=(T *o) noexcept
T * operator->() const noexcept
~QPropertyBindingPrivatePtr()
Q_CORE_EXPORT void destroyAndFreeMemory()
QPropertyBindingPrivatePtr(QPropertyBindingPrivatePtr &&o) noexcept
QPropertyBindingPrivatePtr(const QPropertyBindingPrivatePtr &o) noexcept
T * data() const noexcept
void reset(T *ptr=nullptr) noexcept
const T * constData() const noexcept
T * operator->() noexcept
QPropertyBindingPrivatePtr(T *data) noexcept
QPropertyBindingPrivatePtr() noexcept
QTagPreservingPointerToPointer< T, Tag > & operator=(T **ptr)
QTagPreservingPointerToPointer(T **ptr)
QTagPreservingPointerToPointer< T, Tag > & operator=(QTaggedPointer< T, Tag > *ptr)
constexpr QTagPreservingPointerToPointer()=default
constexpr size_t getOffset(size_t o)
constexpr size_t getOffset(size_t(*offsetFn)())
constexpr BindingFunctionVTable bindingFunctionVTable
void(*)(QUntypedPropertyData *) QPropertyObserverCallback
bool(*)(QMetaType, QUntypedPropertyData *dataPtr, QPropertyBindingFunction) QPropertyBindingWrapper
QUntypedPropertyData * propertyData
const QtPrivate::QPropertyBindingData * originalBindingData
bool(*)(QMetaType, QUntypedPropertyData *, void *) CallFn
const MoveCtrFn moveConstruct
static constexpr BindingFunctionVTable createFor()
void(*)(void *, void *) MoveCtrFn
const QtPrivate::BindingFunctionVTable * vtable