cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=626539e6e5bac4087bc98c0662b447bb37361601
commit 626539e6e5bac4087bc98c0662b447bb37361601 Author: Cedric Bail <[email protected]> Date: Wed Dec 6 21:58:30 2017 -0800 eo: add an helper to get an object from an Eina_Value. --- src/lib/eo/Eo.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index 7c20daaccb..f511562719 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h @@ -2058,6 +2058,7 @@ EOAPI extern const Eina_Value_Type *EINA_VALUE_TYPE_OBJECT; * @brief Create a new #Eina_Value containing the passed parameter. * @param obj The object to use * @return The #Eina_Value + * @see eina_value_object_get(), eina_value_object_init() * @since 1.21 */ static inline Eina_Value * @@ -2074,6 +2075,7 @@ eina_value_object_new(Eo *obj) * @brief Create a new #Eina_Value initialized with the passed parameter * @param obj The object to use * @return The #Eina_Value + * @see eina_value_object_new(), eina_value_object_get() * @since 1.21 */ static inline Eina_Value @@ -2087,6 +2089,26 @@ eina_value_object_init(Eo *obj) } /** + * @brief Get the object contained in an #Eina_Value + * @param v The #Eina_Value to extract the object from + * @return The object. + * @see eina_value_object_new(), eina_value_object_init() + * @since 1.21 + */ +static inline Eo * +eina_value_object_get(Eina_Value *v) +{ + Eo *r = NULL; + + if (!v) return NULL; + if (eina_value_type_get(v) != EINA_VALUE_TYPE_OBJECT) + return NULL; + + eina_value_pget(v, &r); + return r; +} + +/** * @} */ --
