eo-cxx: Added support for returning-void function objects

This commit is contained in:
Felipe Magno de Almeida 2014-07-17 21:46:50 -03:00
parent 1848d39588
commit 7af91ee8fa
1 changed files with 16 additions and 1 deletions

View File

@ -114,13 +114,28 @@ signal_connection make_signal_connection(std::unique_ptr<F>& data, Eo* eo, ::Eo_
namespace _detail {
template <typename T, typename F>
Eina_Bool really_call_event(T& wrapper, F& f, Eo_Event_Description const& desc, void *info
, std::true_type)
{
f(wrapper, desc, info);
return true;
}
template <typename T, typename F>
Eina_Bool really_call_event(T& wrapper, F& f, Eo_Event_Description const& desc, void *info
, std::false_type)
{
return f(wrapper, desc, info);
}
template <typename T, typename F>
Eina_Bool
event_callback(void *data, Eo *obj, Eo_Event_Description const* desc, void *info)
{
T wrapper(::eo_ref(obj));
F *f = static_cast<F*>(data);
return (*f)(wrapper, *desc, info);
return _detail::really_call_event(wrapper, *f, *desc, info
, std::is_void<decltype((*f)(wrapper, *desc, info))>());
}
}