cxx: Use per-function guards in efl object

This prevents generation of del().
I also removed constructor, finalize and destructor as I believe this
requires special work with eo_inherit (where did this work go??).
This commit is contained in:
Jean-Philippe Andre 2017-11-28 16:21:40 +09:00
parent 5d6a5343b7
commit 09cf282741
7 changed files with 56 additions and 37 deletions

View File

@ -16,7 +16,8 @@ bindings/cxx/eo_cxx/eo_wref.hh \
bindings/cxx/eo_cxx/eo_future.hh \
bindings/cxx/eo_cxx/eo_promise.hh \
bindings/cxx/eo_cxx/eo_promise_meta.hh \
bindings/cxx/eo_cxx/eo_private.hh
bindings/cxx/eo_cxx/eo_private.hh \
bindings/cxx/eo_cxx/efl_object_impl.hh
### Elementary C++
installed_elementarycxxmainheadersdir = $(includedir)/elementary-cxx-@VMAJ@/

View File

@ -1,6 +1,8 @@
#ifndef EFL_CXX_EO_HH
#define EFL_CXX_EO_HH
#include "efl_object_impl.hh"
#include <eo_concrete.hh>
#include <eo_init.hh>
#include <eo_wref.hh>
@ -10,4 +12,7 @@
#include <eo_cxx_interop.hh>
#include <eo_event.hh>
#include "efl_object.eo.hh"
#include "efl_object.eo.impl.hh"
#endif // EFL_CXX_EO_HH

View File

@ -0,0 +1,23 @@
#ifndef EFL_OBJECT_MANUAL_IMPL_HH
#define EFL_OBJECT_MANUAL_IMPL_HH
#define EFL_OBJECT_BETA
#define EFL_OBJECT_PROTECTED
// Skip del. Must be implemented in eo::concrete.
#define EOLIAN_CXX_EFL_DEL_DECLARATION
#define EOLIAN_CXX_EFL_DEL_IMPLEMENTATION
// Skip constructor, destructor and finalize.
#define EOLIAN_CXX_EFL_CONSTRUCTOR_DECLARATION
#define EOLIAN_CXX_EFL_CONSTRUCTOR_IMPLEMENTATION
#define EOLIAN_CXX_EFL_DESTRUCTOR_DECLARATION
#define EOLIAN_CXX_EFL_DESTRUCTOR_IMPLEMENTATION
#define EOLIAN_CXX_EFL_FINALIZE_DECLARATION
#define EOLIAN_CXX_EFL_FINALIZE_IMPLEMENTATION
// Skip auto_unref
#define EOLIAN_CXX_EFL_AUTO_UNREF_SET_DECLARATION
#define EOLIAN_CXX_EFL_AUTO_UNREF_SET_IMPLEMENTATION
#endif

View File

@ -1,16 +1,9 @@
#ifndef EFL_EFL_HH
#define EFL_EFL_HH
#ifdef EFL_BETA_API_SUPPORT
#define EFL_PART_IMPL_HH
#define EFL_OBJECT_BETA
#define EFL_OBJECT_PROTECTED
#include <Efl.eo.hh>
#include "cxx/efl_part_impl.hh"
#endif
#endif
#include <Eo.hh>
#include <Efl.eo.hh>
#endif

View File

@ -1,26 +1,15 @@
//#ifndef EFL_PART_IMPL_HH
//#define EFL_PART_IMPL_HH
#ifndef EFL_PART_MANUAL_IMPL_HH
#define EFL_PART_MANUAL_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};
}
#define EOLIAN_CXX_EFL_PART_DECLARATION \
::efl::Object part(::efl::eina::string_view const& name) const;
#define EOLIAN_CXX_EFL_PART_IMPLEMENTATION \
inline ::efl::Object Part::part(::efl::eina::string_view const& name) const \
{ \
::Eo *handle = ::efl_part(_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<void const*>(this)); }
inline efl::Part::operator ::efl::Part&() { return *static_cast< ::efl::Part*>(static_cast<void*>(this)); }
inline efl::Part::operator ::efl::Part const&() const { return *static_cast< ::efl::Part const*>(static_cast<void const*>(this)); }
} }
//#endif
#endif

View File

@ -134,7 +134,7 @@ struct class_definition_generator
<< "(const_cast<" << string << " *>(this))); }\n"
).generate(sink, cls.cxx_name, context))
return false;
for (auto&& e : cls.events)
{
if (e.beta)
@ -237,6 +237,7 @@ struct class_definition_generator
if(!as_generator( scope_tab << "using ::efl::eo::concrete::_eo_ptr;\n"
<< scope_tab << "using ::efl::eo::concrete::_release;\n"
<< scope_tab << "using ::efl::eo::concrete::_reset;\n"
<< scope_tab << "using ::efl::eo::concrete::_delete;\n"
<< scope_tab << "using ::efl::eo::concrete::operator bool;\n"
).generate(sink, attributes::unused, context)) return false;

View File

@ -40,8 +40,12 @@ struct function_declaration_generator
}
if(f.is_beta &&
!as_generator("#ifdef " << *(string << "_") << string << "_" << string << "_BETA\n")
.generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name, suffix), add_upper_case_context(ctx)))
!as_generator("#ifdef " << *(string << "_") << string << "_BETA\n")
.generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name), add_upper_case_context(ctx)))
return false;
if(f.is_protected &&
!as_generator("#ifdef " << *(string << "_") << string << "_PROTECTED\n")
.generate(sink, std::make_tuple(_klass_name.namespaces, _klass_name.eolian_name), add_upper_case_context(ctx)))
return false;
if(!as_generator
@ -70,6 +74,9 @@ struct function_declaration_generator
.generate(sink, f.c_name, add_upper_case_context(ctx)))
return false;
if(f.is_protected &&
!as_generator("#endif\n").generate(sink, attributes::unused, ctx))
return false;
if(f.is_beta &&
!as_generator("#endif\n").generate(sink, attributes::unused, ctx))
return false;