diff --git a/src/bindings/eo_cxx/eo_cxx_interop.hh b/src/bindings/eo_cxx/eo_cxx_interop.hh index 7cd7b3577b..b1978a87c2 100644 --- a/src/bindings/eo_cxx/eo_cxx_interop.hh +++ b/src/bindings/eo_cxx/eo_cxx_interop.hh @@ -472,9 +472,9 @@ F* alloc_static_callback(F&& f) template inline -void call_ctors(Fs&&... fs) +void call_ctors(Eo* _obj_eoid, Fs&&... fs) { - std::initializer_list const v {(fs(), 0)...}; + std::initializer_list const v {(fs(_obj_eoid), 0)...}; (void) v; } diff --git a/src/bindings/eo_cxx/eo_inherit.hh b/src/bindings/eo_cxx/eo_inherit.hh index 3138d1e9a9..9639e33e4a 100644 --- a/src/bindings/eo_cxx/eo_inherit.hh +++ b/src/bindings/eo_cxx/eo_inherit.hh @@ -22,8 +22,15 @@ namespace detail { template Eo_Class const* create_class(eina::index_sequence); -inline -void inherit_constructor(void* this_); +/// @internal +/// +/// @brief Find the correct function for the "constructor" +/// operation and invoke it. +/// +/// @param this_ The user data to be passed to the resolved function. +/// @param args An heterogeneous sequence of arguments. +/// +inline EOAPI EO_VOID_FUNC_BODYV(inherit_constructor, EO_FUNC_CALL(this_), void* this_); } @@ -78,7 +85,7 @@ struct inherit inherit(efl::eo::parent_type _p, Args&& ... args) { _eo_cls = detail::create_class (eina::make_index_sequence()); - _eo_raw = eo_add_ref(_eo_cls, _p._eo_raw, detail::inherit_constructor(this), ::efl::eolian::call_ctors(args...)); + _eo_raw = eo_add_ref(_eo_cls, _p._eo_raw, detail::inherit_constructor(eoid, this), ::efl::eolian::call_ctors(eoid, args...)); ::efl::eolian::register_ev_del_free_callback(_eo_raw, args...); } diff --git a/src/bindings/eo_cxx/eo_inherit_bindings.hh b/src/bindings/eo_cxx/eo_inherit_bindings.hh index 458036d099..bb29b9e67a 100644 --- a/src/bindings/eo_cxx/eo_inherit_bindings.hh +++ b/src/bindings/eo_cxx/eo_inherit_bindings.hh @@ -53,18 +53,6 @@ void inherit_constructor_impl(Eo*, Inherit_Private_Data* self, void* this_) self->this_ = this_; } -/// @internal -/// -/// @brief Find the correct function for the "constructor" -/// operation and invoke it. -/// -/// @param this_ The user data to be passed to the resolved function. -/// @param args An heterogeneous sequence of arguments. -/// -// inline EOAPI EO_VOID_FUNC_BODYV(inherit_constructor, EO_FUNC_CALL(this_), void* this_); -inline -void inherit_constructor(void* this_); - template int initialize_operation_description(detail::tag, void*); diff --git a/src/examples/eolian_cxx/colourable_cxx.cc b/src/examples/eolian_cxx/colourable_cxx.cc index 934a5d0c60..f1f6beca82 100644 --- a/src/examples/eolian_cxx/colourable_cxx.cc +++ b/src/examples/eolian_cxx/colourable_cxx.cc @@ -24,14 +24,14 @@ _colourable_eo_base_constructor(Eo *obj, Colourable_Data *self) { EINA_CXX_DOM_LOG_DBG(domain) << __func__ << std::endl; self->r = self->g = self->b = 0; - return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); + return eo_constructor(eo_super(obj, MY_CLASS)); } void _colourable_eo_base_destructor(Eo *obj, Colourable_Data *self EINA_UNUSED) { EINA_CXX_DOM_LOG_DBG(domain) << __func__ << std::endl; - eo_do_super(obj, MY_CLASS, eo_destructor()); + eo_destructor(eo_super(obj, MY_CLASS)); } void @@ -42,7 +42,7 @@ _colourable_rgb_24bits_constructor(Eo *obj, Colourable_Data *self, int rgb) self->r = (rgb & 0x00ff0000) >> 16; self->g = (rgb & 0x0000ff00) >> 8; self->b = rgb & 0x000000ff; - eo_do_super(obj, MY_CLASS, eo_constructor()); + eo_constructor(eo_super(obj, MY_CLASS)); } void diff --git a/src/examples/eolian_cxx/colourablesquare_cxx.cc b/src/examples/eolian_cxx/colourablesquare_cxx.cc index 906183a2aa..6908f732fd 100644 --- a/src/examples/eolian_cxx/colourablesquare_cxx.cc +++ b/src/examples/eolian_cxx/colourablesquare_cxx.cc @@ -25,7 +25,7 @@ _colourablesquare_size_constructor(Eo *obj, ColourableSquare_Data *self, int siz { self->size = size; EINA_CXX_DOM_LOG_DBG(domain) << __func__ << " [ size = " << size << " ]" << std::endl; - eo_do_super(obj, MY_CLASS, eo_constructor()); + eo_constructor(eo_super(obj, MY_CLASS)); } int diff --git a/src/examples/eolian_cxx/eolian_cxx_inherit_01.cc b/src/examples/eolian_cxx/eolian_cxx_inherit_01.cc index bdfa3ad19f..b0fb16987e 100644 --- a/src/examples/eolian_cxx/eolian_cxx_inherit_01.cc +++ b/src/examples/eolian_cxx/eolian_cxx_inherit_01.cc @@ -23,7 +23,7 @@ struct ColourableCircle int colour_get() { int rgb = 0; - eo_do_super(_eo_ptr(), _eo_class(), rgb = ::colourable_colour_get()); + rgb = ::colourable_colour_get(eo_super(_eo_ptr(), _eo_class())); std::cout << "ColourableCircle::colour_get(" << this << ") ==> " << std::hex << rgb << std::endl; return rgb; @@ -52,7 +52,7 @@ struct ColourableBar int colour_get() { int rgb = 0; - eo_do_super(_eo_ptr(), _eo_class(), rgb = ::colourable_colour_get()); + rgb = ::colourable_colour_get(eo_super(_eo_ptr(), _eo_class())); std::cout << "ColourableBar::colour_get(" << this << ") ==> " << std::hex << rgb << std::endl; return rgb; diff --git a/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh b/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh index 74c9c32883..2a7091ad02 100644 --- a/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh +++ b/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh @@ -158,9 +158,10 @@ operator<<(std::ostream& out, functors_constructor_methods const& x) << tab(2) << "{}" << endl; // Struct operator() - out << tab(2) << "void operator()()" << endl + out << tab(2) << "void operator()(Eo* _obj_eoid)" << endl << tab(2) << "{" << endl - << tab(3) << "::" << c.impl << "(" << parameters_forward_to_c(c.params) << ");" << endl + << tab(3) << "::" << c.impl << "(_obj_eoid" << (c.params.empty() ? "" : ", ") + << parameters_forward_to_c(c.params) << ");" << endl << tab(2) << "}" << endl; // Register event to free allocated callbacks when the Eo* is deleted @@ -579,10 +580,10 @@ operator<<(std::ostream& out, function_call_constructor_methods const& x) << tab(2) << "Eo* _ret_eo = eo_add_ref(" << x._cls.eo_name << ", _p._eo_raw"; for (it = first; it != last; ++it) { - out << ", _c" << (it-first) << "()"; + out << ", _c" << (it-first) << "(eoid)"; } if (!x._cls.optional_constructors.empty()) - out << ", ::efl::eolian::call_ctors(_opts...)"; + out << ", ::efl::eolian::call_ctors(eoid, _opts...)"; out << ");" << endl << endl; for (it = first; it != last; ++it)