Add support to gsignal checker for more parameters.

This commit is contained in:
John Maguire 2012-06-08 14:30:31 +02:00
parent 2da6c40fb5
commit ae4898655d

View File

@ -44,6 +44,11 @@ int GetFunctionParamCount(R (*func)(P0, P1, P2)) {
return 3;
}
template <typename R, typename P0, typename P1, typename P2, typename P3>
int GetFunctionParamCount(R (*func)(P0, P1, P2, P3)) {
return 4;
}
#else // BOOST_NO_VARIADIC_TEMPLATES
template <typename R, typename... Params>
@ -69,6 +74,13 @@ bool CheckedGConnect(
source, signal, G_CALLBACK(callback), data, GetFunctionParamCount(callback));
}
template <typename R, typename P0, typename P1, typename P2, typename P3>
bool CheckedGConnect(
gpointer source, const char* signal, R (*callback)(P0, P1, P2, P3), gpointer data) {
return CheckedGConnect(
source, signal, G_CALLBACK(callback), data, GetFunctionParamCount(callback));
}
#else
template <typename R, typename... Params>