forked from enlightenment/efl
eolian-cxx: Fix Eolian C++ constructing methods with new eo_add
Also fix Eolian C++ examples using the new "eo_super".
This commit is contained in:
parent
5c7d78d104
commit
9cbda57bf0
|
@ -472,9 +472,9 @@ F* alloc_static_callback(F&& f)
|
|||
|
||||
template <typename... Fs>
|
||||
inline
|
||||
void call_ctors(Fs&&... fs)
|
||||
void call_ctors(Eo* _obj_eoid, Fs&&... fs)
|
||||
{
|
||||
std::initializer_list<int const> const v {(fs(), 0)...};
|
||||
std::initializer_list<int const> const v {(fs(_obj_eoid), 0)...};
|
||||
(void) v;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,15 @@ namespace detail {
|
|||
template <typename D, typename... E, std::size_t... S>
|
||||
Eo_Class const* create_class(eina::index_sequence<S...>);
|
||||
|
||||
inline
|
||||
void inherit_constructor(void* this_);
|
||||
/// @internal
|
||||
///
|
||||
/// @brief Find the correct function for the <em>"constructor"</em>
|
||||
/// operation and invoke it.
|
||||
///
|
||||
/// @param this_ The <em>user data</em> to be passed to the resolved function.
|
||||
/// @param args An heterogeneous sequence of arguments.
|
||||
///
|
||||
inline EOAPI EO_VOID_FUNC_BODYV(inherit_constructor, EO_FUNC_CALL(this_), void* this_);
|
||||
|
||||
}
|
||||
|
||||
|
@ -78,7 +85,7 @@ struct inherit
|
|||
inherit(efl::eo::parent_type _p, Args&& ... args)
|
||||
{
|
||||
_eo_cls = detail::create_class<D, E...> (eina::make_index_sequence<sizeof...(E)>());
|
||||
_eo_raw = eo_add_ref(_eo_cls, _p._eo_raw, detail::inherit_constructor(this), ::efl::eolian::call_ctors(args...));
|
||||
_eo_raw = eo_add_ref(_eo_cls, _p._eo_raw, detail::inherit_constructor(eoid, this), ::efl::eolian::call_ctors(eoid, args...));
|
||||
::efl::eolian::register_ev_del_free_callback(_eo_raw, args...);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,18 +53,6 @@ void inherit_constructor_impl(Eo*, Inherit_Private_Data* self, void* this_)
|
|||
self->this_ = this_;
|
||||
}
|
||||
|
||||
/// @internal
|
||||
///
|
||||
/// @brief Find the correct function for the <em>"constructor"</em>
|
||||
/// operation and invoke it.
|
||||
///
|
||||
/// @param this_ The <em>user data</em> to be passed to the resolved function.
|
||||
/// @param args An heterogeneous sequence of arguments.
|
||||
///
|
||||
// inline EOAPI EO_VOID_FUNC_BODYV(inherit_constructor, EO_FUNC_CALL(this_), void* this_);
|
||||
inline
|
||||
void inherit_constructor(void* this_);
|
||||
|
||||
template <typename T>
|
||||
int initialize_operation_description(detail::tag<void>, void*);
|
||||
|
||||
|
|
|
@ -24,14 +24,14 @@ _colourable_eo_base_constructor(Eo *obj, Colourable_Data *self)
|
|||
{
|
||||
EINA_CXX_DOM_LOG_DBG(domain) << __func__ << std::endl;
|
||||
self->r = self->g = self->b = 0;
|
||||
return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
|
||||
return eo_constructor(eo_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
void
|
||||
_colourable_eo_base_destructor(Eo *obj, Colourable_Data *self EINA_UNUSED)
|
||||
{
|
||||
EINA_CXX_DOM_LOG_DBG(domain) << __func__ << std::endl;
|
||||
eo_do_super(obj, MY_CLASS, eo_destructor());
|
||||
eo_destructor(eo_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -42,7 +42,7 @@ _colourable_rgb_24bits_constructor(Eo *obj, Colourable_Data *self, int rgb)
|
|||
self->r = (rgb & 0x00ff0000) >> 16;
|
||||
self->g = (rgb & 0x0000ff00) >> 8;
|
||||
self->b = rgb & 0x000000ff;
|
||||
eo_do_super(obj, MY_CLASS, eo_constructor());
|
||||
eo_constructor(eo_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -25,7 +25,7 @@ _colourablesquare_size_constructor(Eo *obj, ColourableSquare_Data *self, int siz
|
|||
{
|
||||
self->size = size;
|
||||
EINA_CXX_DOM_LOG_DBG(domain) << __func__ << " [ size = " << size << " ]" << std::endl;
|
||||
eo_do_super(obj, MY_CLASS, eo_constructor());
|
||||
eo_constructor(eo_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -23,7 +23,7 @@ struct ColourableCircle
|
|||
int colour_get()
|
||||
{
|
||||
int rgb = 0;
|
||||
eo_do_super(_eo_ptr(), _eo_class(), rgb = ::colourable_colour_get());
|
||||
rgb = ::colourable_colour_get(eo_super(_eo_ptr(), _eo_class()));
|
||||
std::cout << "ColourableCircle::colour_get(" << this << ") ==> "
|
||||
<< std::hex << rgb << std::endl;
|
||||
return rgb;
|
||||
|
@ -52,7 +52,7 @@ struct ColourableBar
|
|||
int colour_get()
|
||||
{
|
||||
int rgb = 0;
|
||||
eo_do_super(_eo_ptr(), _eo_class(), rgb = ::colourable_colour_get());
|
||||
rgb = ::colourable_colour_get(eo_super(_eo_ptr(), _eo_class()));
|
||||
std::cout << "ColourableBar::colour_get(" << this << ") ==> "
|
||||
<< std::hex << rgb << std::endl;
|
||||
return rgb;
|
||||
|
|
|
@ -158,9 +158,10 @@ operator<<(std::ostream& out, functors_constructor_methods const& x)
|
|||
<< tab(2) << "{}" << endl;
|
||||
|
||||
// Struct operator()
|
||||
out << tab(2) << "void operator()()" << endl
|
||||
out << tab(2) << "void operator()(Eo* _obj_eoid)" << endl
|
||||
<< tab(2) << "{" << endl
|
||||
<< tab(3) << "::" << c.impl << "(" << parameters_forward_to_c(c.params) << ");" << endl
|
||||
<< tab(3) << "::" << c.impl << "(_obj_eoid" << (c.params.empty() ? "" : ", ")
|
||||
<< parameters_forward_to_c(c.params) << ");" << endl
|
||||
<< tab(2) << "}" << endl;
|
||||
|
||||
// Register event to free allocated callbacks when the Eo* is deleted
|
||||
|
@ -579,10 +580,10 @@ operator<<(std::ostream& out, function_call_constructor_methods const& x)
|
|||
<< tab(2) << "Eo* _ret_eo = eo_add_ref(" << x._cls.eo_name << ", _p._eo_raw";
|
||||
for (it = first; it != last; ++it)
|
||||
{
|
||||
out << ", _c" << (it-first) << "()";
|
||||
out << ", _c" << (it-first) << "(eoid)";
|
||||
}
|
||||
if (!x._cls.optional_constructors.empty())
|
||||
out << ", ::efl::eolian::call_ctors(_opts...)";
|
||||
out << ", ::efl::eolian::call_ctors(eoid, _opts...)";
|
||||
out << ");" << endl << endl;
|
||||
|
||||
for (it = first; it != last; ++it)
|
||||
|
|
Loading…
Reference in New Issue