eolian-cxx: Fix C++ events with new Eo_Event_Cb signature
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>
Mon, 29 Feb 2016 14:01:04 +0000 (11:01 -0300)
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>
Mon, 29 Feb 2016 14:01:04 +0000 (11:01 -0300)
src/bindings/eo_cxx/eo_cxx_interop.hh
src/bindings/eo_cxx/eo_event.hh
src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
src/lib/eolian_cxx/grammar/parameters_generator.hh
src/tests/eolian_cxx/callback.c

index e0fd2ed..7cd7b35 100644 (file)
@@ -438,11 +438,9 @@ C get_callback()
 }
 
 template <typename F>
-Eina_Bool free_callback_calback(void* data, Eo* obj EINA_UNUSED
-                                , Eo_Event_Description const* e EINA_UNUSED
-                                , void* event_info EINA_UNUSED)
+Eina_Bool free_callback_callback(void* data, ::Eo_Event2 const*)
 {
-   delete (F*) data;
+   delete static_cast<F*>(data);
    return EO_CALLBACK_CONTINUE;
 }
 
index 965a2c6..d0b335e 100644 (file)
@@ -137,12 +137,12 @@ Eina_Bool really_call_event(T& wrapper, F& f, Eo_Event_Description const& desc,
 
 template <typename T, typename F>
 Eina_Bool
-event_callback(void *data, Eo *obj, Eo_Event_Description const* desc, void *info)
+event_callback(void *data, ::Eo_Event2 const* event)
 {
-   T wrapper(::eo_ref(obj));
+   T wrapper(::eo_ref(event->obj));
    F *f = static_cast<F*>(data);
-   return _detail::really_call_event(wrapper, *f, *desc, info
-                                     , std::is_void<decltype((*f)(wrapper, *desc, info))>());
+   return _detail::really_call_event(wrapper, *f, *event->desc, event->event_info
+                                     , std::is_void<decltype((*f)(wrapper, *event->desc, event->event_info))>());
 }
 
 }
index ab64936..73847a8 100644 (file)
@@ -174,7 +174,7 @@ operator<<(std::ostream& out, functors_constructor_methods const& x)
                       d.out << tab(3)
                             << "eo_do(_eoptr," << endl
                             << tab(4) << "eo_event_callback_add(EO_BASE_EVENT_DEL, "
-                            << "&::efl::eolian::free_callback_calback<"
+                            << "&::efl::eolian::free_callback_callback<"
                             << parameter_no_ref_type(d.type, d.name)
                             << ">, " << callback_tmp(d.name) << "));" << endl;
                  })
index 3b59ea0..ecda9d8 100644 (file)
@@ -122,7 +122,7 @@ inline std::ostream&
 operator<<(std::ostream& out, callback_parameter_free_ev_add const& x)
 {
    out << "eo_do(" << x._eo_raw_expr
-       << ", eo_event_callback_add(EO_BASE_EVENT_DEL, &::efl::eolian::free_callback_calback<"
+       << ", eo_event_callback_add(EO_BASE_EVENT_DEL, &::efl::eolian::free_callback_callback<"
        << parameter_no_ref_type(x._type, x._name) << ">, "
        << callback_tmp(x._name) << "));";
    return out;
index 4ad49ff..c08af89 100644 (file)
@@ -17,11 +17,9 @@ typedef struct _Callback_Data Callback_Data;
 
 #define MY_CLASS CALLBACK_CLASS
 
-static Eina_Bool _callback_callback_added(void* data EINA_UNUSED, Eo* obj EINA_UNUSED
-                                          , Eo_Event_Description const* e EINA_UNUSED
-                                          , void* event_info EINA_UNUSED)
+static Eina_Bool _callback_callback_added(void* data EINA_UNUSED, Eo_Event2 const* event)
 {
-  Callback_Data* pd = event_info;
+  Callback_Data* pd = event->event_info;
   ++pd->callbacks;
   eo_event_callback_call(CALLBACK_EVENT_CALL_ON_ADD, &pd->callbacks);
   return EINA_TRUE;