summaryrefslogtreecommitdiff
path: root/src/bindings/cxx/eo_cxx/eo_event.hh
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-20 19:35:50 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-20 19:35:50 -0300
commit9be8f029af6383f21d4d6b956afc29f4b0e244d3 (patch)
treec9d83e90c0f7f7cc115f7d4387a93f134e744134 /src/bindings/cxx/eo_cxx/eo_event.hh
parente517571daeba751bccc7b81a879fa2860228f437 (diff)
eolian-cxx: Remove Eina_Bool from event function wrapper
Diffstat (limited to 'src/bindings/cxx/eo_cxx/eo_event.hh')
-rw-r--r--src/bindings/cxx/eo_cxx/eo_event.hh42
1 files changed, 5 insertions, 37 deletions
diff --git a/src/bindings/cxx/eo_cxx/eo_event.hh b/src/bindings/cxx/eo_cxx/eo_event.hh
index 2120121cd8..a66a043d66 100644
--- a/src/bindings/cxx/eo_cxx/eo_event.hh
+++ b/src/bindings/cxx/eo_cxx/eo_event.hh
@@ -124,55 +124,23 @@ signal_connection make_signal_connection(std::unique_ptr<F>& data, Eo* eo, ::Eo_
124namespace _detail { 124namespace _detail {
125 125
126template <typename T, typename P, typename F> 126template <typename T, typename P, typename F>
127Eina_Bool really_call_event(T& wrapper, F& f, void *, std::true_type, std::true_type) 127void really_call_event(T& wrapper, F& f, void *, std::true_type)
128{ 128{
129 f(wrapper); 129 f(wrapper);
130 return true;
131} 130}
132template <typename T, typename P, typename F> 131template <typename T, typename P, typename F>
133Eina_Bool really_call_event(T& wrapper, F& f, void *info, std::true_type, std::false_type) 132void really_call_event(T& wrapper, F& f, void *info, std::false_type)
134{ 133{
135 f(wrapper, convert_to_event<P>(info)); 134 f(wrapper, convert_to_event<P>(info));
136 return true;
137}
138template <typename T, typename P, typename F>
139Eina_Bool really_call_event(T& wrapper, F& f, void *, std::false_type, std::true_type)
140{
141 return f(wrapper);
142}
143template <typename T, typename P, typename F>
144Eina_Bool really_call_event(T& wrapper, F& f, void *info, std::false_type, std::false_type)
145{
146 return f(wrapper, convert_to_event<P>(info));
147} 135}
148 136
149template <typename T, typename P, typename F, typename Enable = void>
150struct is_void;
151template <typename T, typename P, typename F>
152struct is_void<T, P, F, typename std::enable_if
153 <std::is_void<decltype(std::declval<F>()(std::declval<T>(), std::declval<P>()))>::value>::type>
154 : std::true_type {};
155template <typename T, typename P, typename F>
156struct is_void<T, P, F, typename std::enable_if
157 <!std::is_void<decltype(std::declval<F>()(std::declval<T>(), std::declval<P>()))>::value>::type>
158 : std::false_type {};
159template <typename T, typename F>
160struct is_void<T, void, F, typename std::enable_if
161 <std::is_void<decltype(std::declval<F>()(std::declval<T>()))>::value>::type>
162 : std::true_type {};
163template <typename T, typename F>
164struct is_void<T, void, F, typename std::enable_if
165 <!std::is_void<decltype(std::declval<F>()(std::declval<T>()))>::value>::type>
166 : std::false_type {};
167
168template <typename T, typename P, typename F> 137template <typename T, typename P, typename F>
169Eina_Bool 138void event_callback(void *data, ::Eo_Event const* event)
170event_callback(void *data, ::Eo_Event const* event)
171{ 139{
172 T wrapper(::eo_ref(event->object)); 140 T wrapper(::eo_ref(event->object));
173 F *f = static_cast<F*>(data); 141 F *f = static_cast<F*>(data);
174 return _detail::really_call_event<T, P> 142 _detail::really_call_event<T, P>
175 (wrapper, *f, event->info, is_void<T, P, F>(), std::is_void<P>{}); 143 (wrapper, *f, event->info, std::is_void<P>{});
176} 144}
177} 145}
178 146