From 425f220f92db35d709ff3ef4d0692c70905f00fe Mon Sep 17 00:00:00 2001 From: Savio Sena Date: Thu, 24 Jul 2014 15:54:04 -0300 Subject: [PATCH] eo-cxx: Added generic parent_type and parent_set. This allows us to use any type implementing _eo_ptr() with the parent idiom "efl::eo::parent = obj" and also with efl::eo::inherit parent_set. --- src/bindings/eo_cxx/eo_base.hh | 5 +++++ src/bindings/eo_cxx/eo_inherit.hh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/bindings/eo_cxx/eo_base.hh b/src/bindings/eo_cxx/eo_base.hh index 8801b7f365..70052d0cc6 100644 --- a/src/bindings/eo_cxx/eo_base.hh +++ b/src/bindings/eo_cxx/eo_base.hh @@ -291,6 +291,11 @@ struct parent_expr return { parent._eo_ptr() }; } + template + parent_type operator=(T const& parent) const + { + return { parent._eo_ptr() }; + } parent_type operator=(std::nullptr_t) const { return { nullptr }; diff --git a/src/bindings/eo_cxx/eo_inherit.hh b/src/bindings/eo_cxx/eo_inherit.hh index 66de0869e5..9198e56145 100644 --- a/src/bindings/eo_cxx/eo_inherit.hh +++ b/src/bindings/eo_cxx/eo_inherit.hh @@ -105,6 +105,11 @@ struct inherit /// Eo_Class const* _eo_class() const { return _eo_cls; } + template + void parent_set(T& p_) + { + detail::parent_set(_eo_raw, p_._eo_ptr()); + } protected: /// @brief Copy constructor. /// -- 2.34.1