From 07e3bcdc106ac42703ae0fb88b6cac2d2bfdd072 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 26 Jan 2013 21:42:12 +0100 Subject: Remove QT_{BEGIN,END}_HEADER macro usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp Reviewed-by: Jędrzej Nowacki Reviewed-by: hjk --- src/corelib/kernel/qobjectdefs_impl.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/corelib/kernel/qobjectdefs_impl.h') diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index 68d8fdf961..2d2107f666 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -45,8 +45,6 @@ #error Do not include qobjectdefs_impl.h directly #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -601,6 +599,4 @@ namespace QtPrivate { QT_END_NAMESPACE -QT_END_HEADER - #endif -- cgit v1.2.3 From d93b2ef968f70fe2dd66f0879cc13ad4170e8553 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 22 Dec 2012 13:10:53 -0800 Subject: Mark all qtbase headers that aren't clean QtCore has a few headers that, though public, aren't meant to be included directly. Those are the atomic headers, the three _impl.h headers and qt_windows.h. QtGui includes two OpenGL headers that don't compile on their own. Other libraries should not have headers like that (but they do, something we need to fix eventually). Change-Id: I55e4eb057748f47df927ee618f9409acbc189cc1 Reviewed-by: Sean Harmer Reviewed-by: Gunnar Sletta Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobjectdefs_impl.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/corelib/kernel/qobjectdefs_impl.h') diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index 2d2107f666..8d85175a17 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -45,6 +45,11 @@ #error Do not include qobjectdefs_impl.h directly #endif +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + QT_BEGIN_NAMESPACE -- cgit v1.2.3 From e66159cfc7f78b8ad617175bbef6b70edbf9da6b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 3 Mar 2013 17:22:26 +0100 Subject: Mark QtPrivate::ApplyReturnType constructor as explicit. Else, the operator,(T, ApplyReturnType) is sometimes chosen if a pointer is passed, and that is breaking some decltype expressions. (such as the one in ComputeFunctorArgumentCount in the next patch) Change-Id: Ic203bbb1a8f5abbebb3b11786454807aa20be5fd Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobjectdefs_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel/qobjectdefs_impl.h') diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index 959a255389..46a6eab253 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -93,7 +93,7 @@ namespace QtPrivate { template struct ApplyReturnValue { void *data; - ApplyReturnValue(void *data_) : data(data_) {} + explicit ApplyReturnValue(void *data_) : data(data_) {} }; template void operator,(const T &value, const ApplyReturnValue &container) { -- cgit v1.2.3 From bc98bba2f302922761209c0e91485e809354abc1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 1 Mar 2013 10:18:36 +0100 Subject: Support connection to functor with multiple operator() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When variadic templates and decltype are supported, detect the best overload of operator() to call. Currently, the code takes the type of the operator(), which requires that the functor only has one, and that it has no template parameter. This feature is required if we want to connect to c++1y generic lambda (N3418) Change-Id: Ifa957da6955ea39ab804b58f320da9f98ff47d63 Reviewed-by: Jędrzej Nowacki --- src/corelib/kernel/qobjectdefs_impl.h | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/corelib/kernel/qobjectdefs_impl.h') diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index 46a6eab253..4f44d9204e 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Olivier Goffart ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -597,10 +598,43 @@ namespace QtPrivate { enum { value = AreArgumentsCompatible::Type, typename RemoveConstRef::Type>::value && CheckCompatibleArguments, List>::value }; }; +#endif + +#if defined(Q_COMPILER_DECLTYPE) && defined(Q_COMPILER_VARIADIC_TEMPLATES) + /* + Find the maximum number of arguments a functor object can take and be still compatible with + the arguments from the signal. + Value is the number of arguments, or -1 if nothing matches. + */ + template struct ComputeFunctorArgumentCount; + + template struct ComputeFunctorArgumentCountHelper + { enum { Value = -1 }; }; + template + struct ComputeFunctorArgumentCountHelper, false> + : ComputeFunctorArgumentCount, sizeof...(ArgList)>::Value> {}; + + template struct ComputeFunctorArgumentCount> + { + template static D dummy(); + template static auto test(F f) -> decltype(((f.operator()((dummy())...)), int())); + static char test(...); + enum { + Ok = sizeof(test(dummy())) == sizeof(int), + Value = Ok ? sizeof...(ArgList) : int(ComputeFunctorArgumentCountHelper, Ok>::Value) + }; + }; + /* get the return type of a functor, given the signal argument list */ + template struct FunctorReturnType; + template struct FunctorReturnType> { + template static D dummy(); + typedef decltype(dummy().operator()((dummy())...)) Value; + }; #endif -} +} QT_END_NAMESPACE -- cgit v1.2.3