6#error Do not include qobjectdefs_impl.h directly
7#include <QtCore/qnamespace.h>
11#pragma qt_sync_skip_header_check
12#pragma qt_sync_stop_processing
15#include <QtCore/qfunctionaltools_impl.h>
36 template <
typename... Ts>
struct List {
static constexpr size_t size =
sizeof...(Ts); };
40 template <
typename Head,
typename... Tail>
struct List<Head, Tail...> {
41 static constexpr size_t size = 1 +
sizeof...(Tail);
63 template<
typename T,
typename U>
66 *
reinterpret_cast<U *
>(container.
data) = std::forward<T>(
value);
94 template<
int N,
int... I1,
int... I2>
98 template<
int N,
class S1,
class S2>
101 template<
int N>
struct GenSeq;
119 [[maybe_unused]]
auto staticcast = [](
QObject *
obj) {
return static_cast<Obj *
>(
obj); };
120 [[maybe_unused]]
auto qobjcast = [](
QObject *
obj) {
return Obj::staticMetaObject.cast(
obj); };
122 [[maybe_unused]]
auto dyncast = [](
QObject *
obj) {
return dynamic_cast<Obj *
>(
obj); };
125 auto cast = qobjcast;
128 "Called object is not of the correct type (class destructor may have already run)");
131 template <
typename,
typename,
typename,
typename>
struct FunctorCall;
132 template <
int... II,
typename... SignalArgs,
typename R,
typename Function>
138 template <
int... II,
typename... SignalArgs,
typename R,
typename... SlotArgs,
typename SlotRet,
class Obj>
142 assertObjectType<Obj>(
o);
146 template <
int... II,
typename... SignalArgs,
typename R,
typename... SlotArgs,
typename SlotRet,
class Obj>
150 assertObjectType<Obj>(
o);
154 template <
int... II,
typename... SignalArgs,
typename R,
typename... SlotArgs,
typename SlotRet,
class Obj>
156 static void call(SlotRet (Obj::*
f)(SlotArgs...) noexcept, Obj *
o,
void **
arg)
158 assertObjectType<Obj>(
o);
162 template <
int... II,
typename... SignalArgs,
typename R,
typename... SlotArgs,
typename SlotRet,
class Obj>
164 static void call(SlotRet (Obj::*
f)(SlotArgs...) const noexcept, Obj *
o,
void **
arg)
166 assertObjectType<Obj>(
o);
171 template<
class Obj,
typename Ret,
typename... Args>
struct FunctionPointer<Ret (Obj::*) (Args...)>
178 template <
typename SignalArgs,
typename R>
183 template<
class Obj,
typename Ret,
typename... Args>
struct FunctionPointer<Ret (Obj::*) (Args...) const>
190 template <
typename SignalArgs,
typename R>
201 enum {ArgumentCount =
sizeof...(Args), IsPointerToMemberFunction =
false};
202 template <
typename SignalArgs,
typename R>
208 template<
class Obj,
typename Ret,
typename... Args>
struct FunctionPointer<Ret (Obj::*) (Args...) noexcept>
215 template <
typename SignalArgs,
typename R>
220 template<
class Obj,
typename Ret,
typename... Args>
struct FunctionPointer<Ret (Obj::*) (Args...) const noexcept>
225 typedef Ret (Obj::*
Function) (Args...) const noexcept;
227 template <
typename SignalArgs,
typename R>
233 template<
typename Ret,
typename... Args>
struct FunctionPointer<Ret (*) (Args...) noexcept>
238 enum {ArgumentCount =
sizeof...(Args), IsPointerToMemberFunction =
false};
239 template <
typename SignalArgs,
typename R>
247 template <
typename T>
250 template <
typename From,
typename To,
typename Enable =
void>
253 template <
typename From,
typename To>
255 std::void_t< decltype( NarrowingDetector<To>{ {std::declval<From>()} } ) >
256 > : std::true_type {};
262 template <
typename From,
typename To,
typename Enable =
void>
265 template <
typename From,
typename To>
268 std::disjunction_v<std::is_same<From, To>, IsConvertibleWithoutNarrowing<From, To>>
270 > : std::true_type {};
278 static int test(
const std::remove_reference_t<A2>&);
280 enum {
value =
sizeof(
test(std::declval<std::remove_reference_t<A1>>())) ==
sizeof(
int) };
281#ifdef QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
283 static_assert(AreArgumentsConvertibleWithoutNarrowing::value,
"Signal and slot arguments are not compatible (narrowing)");
296 template <
typename Arg1,
typename Arg2,
typename... Tail1,
typename... Tail2>
312 template <
typename Functor,
typename First,
typename... ArgList>
315 typename List_Left<List<First, ArgList...>, sizeof...(ArgList)>::Value> {};
319 template <
typename F>
static auto test(F
f) ->
decltype(((
f.operator()((std::declval<ArgList>())...)),
int()));
322 Ok =
sizeof(test(std::declval<Functor>())) ==
sizeof(
int),
330 typedef decltype(std::declval<Functor>().operator()((std::declval<ArgList>())...))
Value;
333 template<
typename Function,
int N>
struct Functor
335 template <
typename SignalArgs,
typename R>
341 template<
typename Func>
346 enum {ArgumentCount = 0};
350 template<
typename Func>
351 using Callable = std::conditional_t<FunctionPointer<std::decay_t<Func>>::ArgumentCount == -1,
361 template<
typename Prototype,
typename Functor>
362 inline constexpr std::enable_if_t<!std::disjunction_v<std::is_convertible<Prototype, const char *>,
363 std::is_same<std::decay_t<Prototype>,
QMetaMethod>,
364 std::is_convertible<Functor, const char *>,
371 using Actual = std::decay_t<Functor>;
394#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
416 inline int ref() noexcept {
return m_ref.
ref(); }
417#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
418 inline void destroyIfLastRef() noexcept
419 {
if (!m_ref.
deref()) m_impl(Destroy,
this,
nullptr,
nullptr,
nullptr); }
421 inline bool compare(
void **
a) {
bool ret =
false; m_impl(Compare,
this,
nullptr,
a, &
ret);
return ret; }
422 inline void call(
QObject *
r,
void **
a) { m_impl(Call,
this,
r,
a,
nullptr); }
425 {
if (!m_ref.
deref()) m_impl(
this,
nullptr,
nullptr, Destroy,
nullptr); }
435 bool isImpl(ImplFn
f)
const {
return m_impl ==
f; }
444 template <
typename Func,
typename Args,
typename R>
448 using FunctorValue = std::decay_t<Func>;
450 using FuncType = std::conditional_t<std::is_member_function_pointer_v<FunctorValue>,
455#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
470 if constexpr (std::is_member_function_pointer_v<FunctorValue>)
471 FuncType::template call<Args, R>(that->object(),
static_cast<typename FuncType::Object *
>(
r),
a);
473 FuncType::template call<Args, R>(that->object(),
r,
a);
476 if constexpr (std::is_member_function_pointer_v<FunctorValue>) {
477 *
ret = *
reinterpret_cast<FunctorValue *
>(
a) == that->object();
496 template <
typename Func,
typename =
void>
499 template <
typename Func>
501 std::enable_if_t<!std::disjunction_v<std::is_convertible<Func, const char *>,
502 std::is_member_function_pointer<Func>
509 template <
typename Func>
511 std::enable_if_t<std::conjunction_v<std::negation<std::is_convertible<Func, const char *>>,
512 std::is_member_function_pointer<Func>,
513 std::is_convertible<typename QtPrivate::FunctionPointer<Func>::Object *, QObject *>
527 template <
typename Prototype,
typename Functor>
528 static constexpr std::enable_if_t<QtPrivate::countMatchingArguments<Prototype, Functor>() >= 0,
533 using ExpectedReturnType =
typename ExpectedSignature::ReturnType;
534 using ExpectedArguments =
typename ExpectedSignature::Arguments;
537 constexpr int MatchingArgumentCount = QtPrivate::countMatchingArguments<Prototype, Functor>();
540 static_assert(int(ActualSignature::ArgumentCount) <= int(ExpectedSignature::ArgumentCount),
541 "Functor requires more arguments than what can be provided.");
546 template<
typename Prototype,
typename Functor,
typename =
void>
548 template<
typename Prototype,
typename Functor>
550 std::is_same_v<decltype(QtPrivate::makeCallableObject<Prototype>(std::forward<Functor>(std::declval<Functor>()))),
551 QtPrivate::QSlotObjectBase *>>
552 > : std::true_type {};
554 template<
typename Prototype,
typename Functor>
557 "Functor is not compatible with expected prototype!");
QCallableObject(const Func &f)
QCallableObject(Func &&f)
void destroyIfLastRef() noexcept
bool isImpl(ImplFn f) const
void call(QObject *r, void **a)
QSlotObjectBase(ImplFn fn)
Combined button and popup list for selecting options.
void assertObjectType(QObjectPrivate *d)
InvokeGenSeq< ConcatSeqImpl< N, S1, S2 > > ConcatSeq
typename T::Type InvokeGenSeq
constexpr std::enable_if_t<!std::disjunction_v< std::is_convertible< Prototype, const char * >, std::is_same< std::decay_t< Prototype >, QMetaMethod >, std::is_convertible< Functor, const char * >, std::is_same< std::decay_t< Functor >, QMetaMethod > >, int > countMatchingArguments()
constexpr bool AssertCompatibleFunctions()
InvokeGenSeq< GenSeq< N > > makeIndexSequence
std::conditional_t< FunctionPointer< std::decay_t< Func > >::ArgumentCount==-1, ZeroArgFunctor< std::decay_t< Func > >, FunctionPointer< std::decay_t< Func > > > Callable
static constexpr QtPrivate::QSlotObjectBase * makeCallableObject(Functor &&func)
typename std::conditional_t< std::conjunction_v< std::is_empty< Object >, std::negation< std::is_final< Object > > >, detail::StorageEmptyBaseClassOptimization< Object, Tag >, detail::StorageByValue< Object, Tag > > CompactStorage
void operator,(T &&value, const ApplyReturnValue< U > &container)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_ASSERT_X(cond, x, msg)
static int compare(quint64 a, quint64 b)
const char className[16]
[1]
ApplyReturnValue(void *data_)
static int test(const std::remove_reference_t< A2 > &)
static auto test(F f) -> decltype(((f.operator()((std::declval< ArgList >())...)), int()))
typename QtPrivate::FunctionPointer< Func >::Object ContextType
static void call(Function f, Obj *o, void **arg)
List< Args... > Arguments
List< Args... > Arguments
static void call(Function f, Obj *o, void **arg)
static void call(Function f, Obj *o, void **arg)
List< Args... > Arguments
static void call(Function f, Obj *o, void **arg)
List< Args... > Arguments
List< Args... > Arguments
static void call(Function f, void *, void **arg)
static void call(Function f, void *, void **arg)
List< Args... > Arguments
@ IsPointerToMemberFunction
static void call(Function &f, void **arg)
static void call(SlotRet(Obj::*f)(SlotArgs...) const, Obj *o, void **arg)
static void call(SlotRet(Obj::*f)(SlotArgs...) const noexcept, Obj *o, void **arg)
static void call(SlotRet(Obj::*f)(SlotArgs...), Obj *o, void **arg)
static void call(SlotRet(Obj::*f)(SlotArgs...) noexcept, Obj *o, void **arg)
decltype(std::declval< Functor >().operator()((std::declval< ArgList >())...)) Value
static void call(Function &f, void *, void **arg)
makeIndexSequence< N > Value
List< L1..., L2... > Value
List_Append< List< typenameL::Car >, typenameList_Left< typenameL::Cdr, N-1 >::Value >::Value Value
decltype(std::declval< Func >()()) ReturnType
virtual HRESULT STDMETHODCALLTYPE Compare(__RPC__in_opt ITextRangeProvider *range, __RPC__out BOOL *pRetVal)=0