From c7550b2964e8f1c1cd9f51c7db573c5361f8cb10 Mon Sep 17 00:00:00 2001 From: Vitor Sousa Date: Wed, 9 Dec 2015 15:32:04 -0200 Subject: [PATCH] eina_cxx: Add missing methods to Eina C++ wrappers Also fix release_native_handle type error on mutable ranges. --- src/bindings/eina_cxx/eina_accessor.hh | 11 +++++++++++ src/bindings/eina_cxx/eina_iterator.hh | 16 ++++++++++++++++ src/bindings/eina_cxx/eina_list.hh | 2 ++ src/bindings/eina_cxx/eina_range_types.hh | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/bindings/eina_cxx/eina_accessor.hh b/src/bindings/eina_cxx/eina_accessor.hh index d084918ca8..800c3fa122 100644 --- a/src/bindings/eina_cxx/eina_accessor.hh +++ b/src/bindings/eina_cxx/eina_accessor.hh @@ -119,6 +119,17 @@ struct accessor_common_base return _impl; } + /** + * @brief Release the handle of the wrapped @c Eina_Accessor. + * @return Handle for the native @c Eina_Accessor. + */ + Eina_Accessor* release_native_handle() + { + auto h = _impl; + _impl = nullptr; + return h; + } + /** * @brief Swap content between both objects. * @param other Other accessor object. diff --git a/src/bindings/eina_cxx/eina_iterator.hh b/src/bindings/eina_cxx/eina_iterator.hh index 81eb2ee508..de04fd73a3 100644 --- a/src/bindings/eina_cxx/eina_iterator.hh +++ b/src/bindings/eina_cxx/eina_iterator.hh @@ -95,6 +95,22 @@ public: return *this; } + + /** + * @brief Get the handle for the wrapped @c Eina_Iterator. + * @return Internal handle for the native Eina iterator. + * + * This member function returns the native @c Eina_Iterator handle + * that is wrapped inside this object. + * + * @warning It is important to take care when using it, since the + * handle will be automatically release upon object destruction. + */ + Eina_Iterator* native_handle() const + { + return _iterator; + } + protected: /** * @internal diff --git a/src/bindings/eina_cxx/eina_list.hh b/src/bindings/eina_cxx/eina_list.hh index ae140b2069..a47a7d7206 100644 --- a/src/bindings/eina_cxx/eina_list.hh +++ b/src/bindings/eina_cxx/eina_list.hh @@ -511,6 +511,7 @@ public: using _base_type::crend; using _base_type::swap; using _base_type::native_handle; + using _base_type::release_native_handle; }; template @@ -613,6 +614,7 @@ public: } using _base_type::swap; using _base_type::native_handle; + using _base_type::release_native_handle; friend bool operator==(range_list const& rhs, range_list const& lhs) { diff --git a/src/bindings/eina_cxx/eina_range_types.hh b/src/bindings/eina_cxx/eina_range_types.hh index 313ca05cd9..4f05d734e2 100644 --- a/src/bindings/eina_cxx/eina_range_types.hh +++ b/src/bindings/eina_cxx/eina_range_types.hh @@ -276,7 +276,7 @@ struct _mutable_range_template : _const_range_template { auto h = _handle; _handle = nullptr; - return h; + return const_cast(h); } /**