eo: add an helper to get an object from an Eina_Value.

This commit is contained in:
Cedric Bail 2017-12-06 21:58:30 -08:00 committed by Cedric BAIL
parent a57eca7f02
commit 626539e6e5
1 changed files with 22 additions and 0 deletions

View File

@ -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
@ -2086,6 +2088,26 @@ eina_value_object_init(Eo *obj)
return v;
}
/**
* @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;
}
/**
* @}
*/