4#ifndef QPROPERTYPRIVATE_H
5#define QPROPERTYPRIVATE_H
18#include <QtCore/qglobal.h>
19#include <QtCore/qtaggedpointer.h>
20#include <QtCore/qmetatype.h>
21#include <QtCore/qcontainerfwd.h>
22#include <QtCore/qttypetraits.h>
30template<
typename Class,
typename T,
auto Offset,
auto Setter,
auto Signal,
auto Getter>
34using PendingBindingObserverList = QVarLengthArray<QPropertyBindingPrivatePtr>;
43 bool deref() {
return --ref != 0; }
50class QQmlPropertyBinding;
51class QPropertyBindingPrivate;
60 explicit operator const T *()
const noexcept {
return d; }
61 T *
data()
const noexcept {
return d; }
62 T *
get()
const noexcept {
return d; }
64 T *
take()
noexcept { T *x = d; d =
nullptr;
return x; }
70 destroyAndFreeMemory();
76 :
d(
o.
d) {
if (d) d->addRef(); }
78 void reset(T *ptr =
nullptr)
noexcept;
93 operator bool ()
const noexcept {
return d !=
nullptr; }
94 bool operator!()
const noexcept {
return d ==
nullptr; }
105 const T *
rhs)
noexcept
116class QUntypedPropertyBinding;
117class QPropertyBindingPrivate;
119class QPropertyObserver;
136class QPropertyBindingData;
156
157
158
164 using DtorFn =
void(*)(
void *);
165 using MoveCtrFn =
void(*)(
void *,
void *);
174 static_assert (
alignof(Callable) <=
alignof(std::max_align_t),
"Bindings do not support overaligned functors!");
177 if constexpr (!
std::is_invocable_v<Callable>) {
179 static_assert (std::is_invocable_r_v<
bool, Callable, QMetaType, QUntypedPropertyData *> );
180 auto untypedEvaluationFunction =
static_cast<Callable *>(f);
181 return std::invoke(*untypedEvaluationFunction, metaType, dataPtr);
186 auto evaluationFunction =
static_cast<Callable *>(f);
187 PropertyType newValue =
std::invoke(*evaluationFunction);
188 if constexpr (QTypeTraits::has_operator_equal_v<PropertyType>) {
189 if (newValue == propertyPtr->valueBypassingBindings())
192 propertyPtr->setValueBypassingBindings(
std::move(newValue));
196 Q_UNREACHABLE_RETURN(
false);
199 [](
void *f){
static_cast<Callable *>(f)->~Callable(); },
200 [](
void *addr,
void *other){
201 new (addr) Callable(
std::move(*
static_cast<Callable *>(other)));
222
223
224
225
226
227
228
229
230
291
292
293
294
295
296
297
298
299
300
324template <
typename T,
typename Tag>
336 d =
reinterpret_cast<quintptr *>(ptr);
342 d =
reinterpret_cast<quintptr *>(ptr);
353 *d =
reinterpret_cast<quintptr>(ptr) | (*d & QTaggedPointer<T, Tag>::tagMask());
358 return reinterpret_cast<T*>(*d & QTaggedPointer<T, Tag>::pointerMask());
367 quintptr *d =
nullptr;
371 template <
typename F>
372 struct ExtractClassFromFunctionPointer;
374 template<
typename T,
typename C>
375 struct ExtractClassFromFunctionPointer<T C::*> {
using Class = 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
QUntypedPropertyData * propertyData
const QtPrivate::QPropertyBindingData * originalBindingData
const MoveCtrFn moveConstruct
static constexpr BindingFunctionVTable createFor()
const QtPrivate::BindingFunctionVTable * vtable