From 63725d71fda340986345725e2df3fcbaaa573649 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 23 Nov 2017 13:51:10 +0900 Subject: cxx: Implement proper part support (wrt. refs) It's VERY hacky, but works as expected: no leak, no extra unref. This is a lucky case of simply overriding efl_part() implementation in C++, without having to modify the declaration. --- src/lib/efl/cxx/efl_part_impl.hh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/lib/efl/cxx/efl_part_impl.hh (limited to 'src/lib/efl/cxx') diff --git a/src/lib/efl/cxx/efl_part_impl.hh b/src/lib/efl/cxx/efl_part_impl.hh new file mode 100644 index 0000000000..c1c99e785a --- /dev/null +++ b/src/lib/efl/cxx/efl_part_impl.hh @@ -0,0 +1,26 @@ +//#ifndef EFL_PART_IMPL_HH +//#define EFL_PART_IMPL_HH + +namespace efl { +inline ::efl::eolian::return_traits< ::efl::Object>::type Part::part( ::efl::eolian::in_traits< ::efl::eina::string_view>::type name) const +{ + Eo *handle = ::efl_part(this->_eo_ptr(), name.c_str()); + ::efl_auto_unref_set(handle, false); + return ::efl::Object{handle}; +} +} + +namespace eo_cxx { +namespace efl { +inline ::efl::eolian::return_traits< ::efl::Object>::type Part::part( ::efl::eolian::in_traits< ::efl::eina::string_view>::type name) const +{ + Eo *handle = ::efl_part(this->_eo_ptr(), name.c_str()); + ::efl_auto_unref_set(handle, false); + return ::efl::Object{handle}; +} +inline efl::Part::operator ::efl::Part() const { return *static_cast< ::efl::Part const*>(static_cast(this)); } +inline efl::Part::operator ::efl::Part&() { return *static_cast< ::efl::Part*>(static_cast(this)); } +inline efl::Part::operator ::efl::Part const&() const { return *static_cast< ::efl::Part const*>(static_cast(this)); } +} } + +//#endif -- cgit v1.2.1