eo-cxx: Added generic parent_type and parent_set.

This allows us to use any type implementing _eo_ptr() with the parent
idiom "efl::eo::parent = obj" and also with efl::eo::inherit parent_set.
This commit is contained in:
Savio Sena 2014-07-24 15:54:04 -03:00
parent 90f46e36f2
commit 425f220f92
2 changed files with 10 additions and 0 deletions

View File

@ -291,6 +291,11 @@ struct parent_expr
return { parent._eo_ptr() };
}
template <typename T>
parent_type operator=(T const& parent) const
{
return { parent._eo_ptr() };
}
parent_type operator=(std::nullptr_t) const
{
return { nullptr };

View File

@ -105,6 +105,11 @@ struct inherit
///
Eo_Class const* _eo_class() const { return _eo_cls; }
template <typename T>
void parent_set(T& p_)
{
detail::parent_set(_eo_raw, p_._eo_ptr());
}
protected:
/// @brief Copy constructor.
///