diff --git a/src/bindings/cxx/eo_cxx/eo_wref.hh b/src/bindings/cxx/eo_cxx/eo_wref.hh index e0f9c7bf82..124b1da3b7 100644 --- a/src/bindings/cxx/eo_cxx/eo_wref.hh +++ b/src/bindings/cxx/eo_cxx/eo_wref.hh @@ -123,6 +123,18 @@ struct wref return *this; } +#ifdef EFL_CXX_WREF_EASY + T operator->() const { + if (!_eo_wref) return T(nullptr); + return T(detail::ref(_eo_wref)); + } + + T operator*() const { + if (!_eo_wref) return T(nullptr); + return T(detail::ref(_eo_wref)); + } +#endif + private: void _add() { diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp index 320d806398..54df3301a6 100644 --- a/src/lib/eolian_cxx/grammar/class_definition.hpp +++ b/src/lib/eolian_cxx/grammar/class_definition.hpp @@ -174,6 +174,13 @@ struct class_definition_generator "return ::efl::eo::wref<" << string << ">(*this); }\n" ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; + if(!as_generator("#ifdef EFL_CXX_WREF_EASY\n").generate(sink, attributes::unused, context)) return false; + if(!as_generator( scope_tab << "const " << string << "* operator->() const { return this; }\n" + ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; + if(!as_generator( scope_tab << string << "* operator->() { return this; }\n" + ).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false; + if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false; + if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n" << scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n" ).generate(sink, attributes::unused, context)) return false;