forked from enlightenment/efl
cxx: Add implicit conversion to Eo* pointer
This is part of the experimental stuff. Allows calling C functions without using ._eo_ptr() explicitly. Probably not super useful, assuming the interfaces are done :)
This commit is contained in:
parent
a787c3cc07
commit
d887c4de52
|
@ -41,7 +41,7 @@ struct appData
|
||||||
|
|
||||||
void destroy() {
|
void destroy() {
|
||||||
// FIXME: need del() function and no error on unref().
|
// FIXME: need del() function and no error on unref().
|
||||||
::efl_allow_parent_unref_set(m_win._eo_ptr(), true);
|
::efl_allow_parent_unref_set(m_win, true);
|
||||||
m_win = nullptr;
|
m_win = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,12 +211,17 @@ struct class_definition_generator
|
||||||
|
|
||||||
// EXPERIMENTAL
|
// EXPERIMENTAL
|
||||||
if(!as_generator("#ifdef EFL_CXXPERIMENTAL\n").generate(sink, attributes::unused, context)) return false;
|
if(!as_generator("#ifdef EFL_CXXPERIMENTAL\n").generate(sink, attributes::unused, context)) return false;
|
||||||
|
// For easy wref, operator-> in wref needs to also return a pointer type
|
||||||
if(!as_generator( scope_tab << "const " << string << "* operator->() const { return this; }\n"
|
if(!as_generator( scope_tab << "const " << string << "* operator->() const { return this; }\n"
|
||||||
).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
|
).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
|
||||||
if(!as_generator( scope_tab << string << "* operator->() { return this; }\n"
|
if(!as_generator( scope_tab << string << "* operator->() { return this; }\n"
|
||||||
).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
|
).generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name), context)) return false;
|
||||||
|
// For easy interfacing with C: no need to use _eo_ptr()
|
||||||
|
if(!as_generator( scope_tab << "operator Eo*() const { return _eo_ptr(); }\n"
|
||||||
|
).generate(sink, attributes::unused, context)) return false;
|
||||||
if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false;
|
if(!as_generator("#endif \n").generate(sink, attributes::unused, context)) return false;
|
||||||
|
|
||||||
|
// eo_concrete
|
||||||
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