Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qobject_impl.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QOBJECT_H
6#error Do not include qobject_impl.h directly
7#endif
8
9#if 0
10#pragma qt_sync_skip_header_check
11#pragma qt_sync_stop_processing
12#endif
13
14QT_BEGIN_NAMESPACE
15
16
17namespace QtPrivate {
18 /*
19 Logic to statically generate the array of qMetaTypeId
20 ConnectionTypes<FunctionPointer<Signal>::Arguments>::types() returns an array
21 of int that is suitable for the types arguments of the connection functions.
22
23 The array only exist of all the types are declared as a metatype
24 (detected using the TypesAreDeclaredMetaType helper struct)
25 If one of the type is not declared, the function return 0 and the signal
26 cannot be used in queued connection.
27 */
28 template <typename ArgList> struct TypesAreDeclaredMetaType { enum { Value = false }; };
29 template <> struct TypesAreDeclaredMetaType<List<>> { enum { Value = true }; };
30 template <typename Arg, typename... Tail> struct TypesAreDeclaredMetaType<List<Arg, Tail...> >
32
33 template <typename ArgList, bool Declared = TypesAreDeclaredMetaType<ArgList>::Value > struct ConnectionTypes
34 { static const int *types() { return nullptr; } };
35 template <> struct ConnectionTypes<List<>, true>
36 { static const int *types() { return nullptr; } };
37 template <typename... Args> struct ConnectionTypes<List<Args...>, true>
38 { static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper<Args>::qt_metatype_id())..., 0 }; return t; } };
39}
40
41
42QT_END_NAMESPACE
static const int * types()