1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef Q_QDOC
5
6#ifndef QOBJECT_H
7#error Do not include qobject_impl.h directly
8#endif
9
10#if 0
11#pragma qt_sync_skip_header_check
12#pragma qt_sync_stop_processing
13#endif
14
15QT_BEGIN_NAMESPACE
16
17
18namespace QtPrivate {
19 /*
20 Logic to statically generate the array of qMetaTypeId
21 ConnectionTypes<FunctionPointer<Signal>::Arguments>::types() returns an array
22 of int that is suitable for the types arguments of the connection functions.
23
24 The array only exist of all the types are declared as a metatype
25 (detected using the TypesAreDeclaredMetaType helper struct)
26 If one of the type is not declared, the function return 0 and the signal
27 cannot be used in queued connection.
28 */
29 template <typename ArgList> struct TypesAreDeclaredMetaType { enum { Value = false }; };
30 template <> struct TypesAreDeclaredMetaType<List<>> { enum { Value = true }; };
31 template <typename Arg, typename... Tail> struct TypesAreDeclaredMetaType<List<Arg, Tail...> >
32 { enum { Value = QMetaTypeId2<Arg>::Defined && TypesAreDeclaredMetaType<List<Tail...>>::Value }; };
33
34 template <typename ArgList, bool Declared = TypesAreDeclaredMetaType<ArgList>::Value > struct ConnectionTypes
35 { static const int *types() { return nullptr; } };
36 template <> struct ConnectionTypes<List<>, true>
37 { static const int *types() { return nullptr; } };
38 template <typename... Args> struct ConnectionTypes<List<Args...>, true>
39 { static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper<Args>::qt_metatype_id())..., 0 }; return t; } };
40}
41
42
43QT_END_NAMESPACE
44
45#endif
46

source code of qtbase/src/corelib/kernel/qobject_impl.h