forked from enlightenment/efl
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:
parent
90f46e36f2
commit
425f220f92
|
@ -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 };
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue