forked from enlightenment/efl
cxx: Add _get_wref() convenience to all classes
This allows constructs like: auto w_obj = obj._get_wref(); auto cb = std::bind([w_obj]() { auto o = w_obj.lock(); if (!o) return; o->call(); }); event_add(..., obj, cb); Note: I don't like how those wref work. Close to c++ wref but far from EFL wref.
This commit is contained in:
parent
88e10da36b
commit
73ec85aeff
|
@ -170,6 +170,10 @@ struct class_definition_generator
|
||||||
// /// @endcond
|
// /// @endcond
|
||||||
if(!as_generator(scope_tab << "/// @endcond\n").generate(sink, attributes::unused, context)) return false;
|
if(!as_generator(scope_tab << "/// @endcond\n").generate(sink, attributes::unused, context)) return false;
|
||||||
|
|
||||||
|
if(!as_generator( scope_tab << "::efl::eo::wref<" << string << "> _get_wref() const { "
|
||||||
|
"return ::efl::eo::wref<" << string << ">(*this); }\n"
|
||||||
|
).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
|
||||||
|
|
||||||
if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n"
|
if(!as_generator( scope_tab << "::efl::eo::concrete const& _get_concrete() const { return *this; }\n"
|
||||||
<< scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n"
|
<< scope_tab << "::efl::eo::concrete& _get_concrete() { return *this; }\n"
|
||||||
).generate(sink, attributes::unused, context)) return false;
|
).generate(sink, attributes::unused, context)) return false;
|
||||||
|
|
Loading…
Reference in New Issue