eo: add efl_property_reflection_exist to be able to know if a property is available on an object.

Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7937
This commit is contained in:
Cedric BAIL 2019-02-11 18:20:51 -08:00
parent 770750486c
commit 11d2b39b44
2 changed files with 26 additions and 0 deletions

View File

@ -1984,6 +1984,7 @@ EAPI Eina_Bool efl_destructed_is(const Eo *obj);
* @param property_name The name of the property to modify.
* @param value The value to set, the value passed here will be flushed by the function
*
* @see efl_property_reflection_get() and efl_property_reflection_exist()
*/
EAPI Eina_Error efl_property_reflection_set(Eo *obj, const char *property_name, Eina_Value value);
@ -1993,9 +1994,21 @@ EAPI Eina_Error efl_property_reflection_set(Eo *obj, const char *property_name,
* @param property_name The name of the property to get.
*
* @return The value that got returned by the actual property in form of a generic Eina_Value. The user of this API is owning the returned Value.
*
* @see efl_property_reflection_set() and efl_property_reflection_exist()
*/
EAPI Eina_Value efl_property_reflection_get(Eo *obj, const char *property_name);
/**
* @brief Check if a property exist for reflection.
* @param obj The object to inspect.
* @param property_name The name of the property to check if it exist.
*
* @return EINA_TRUE if the property exist, EINA_FALSE otherwise.
*
* @see efl_property_reflection_set() and efl_property_reflection_get()
*/
EAPI Eina_Bool efl_property_reflection_exist(Eo *obj, const char *property_name);
/**
* @addtogroup Efl_Class_Class Eo's Class class.

View File

@ -3674,6 +3674,19 @@ efl_property_reflection_get(Eo *obj_id, const char *property_name)
return r;
}
EAPI Eina_Bool
efl_property_reflection_exist(Eo *obj_id, const char *property_name)
{
Eina_Bool r = EINA_FALSE;
EO_OBJ_POINTER_GOTO(obj_id, obj, end);
const Efl_Object_Property_Reflection *reflection = _efl_class_reflection_find(obj->klass, property_name);
if (reflection) r = EINA_TRUE;
end:
EO_OBJ_DONE(obj_id);
return r;
}
EAPI Efl_Class_Type
efl_class_type_get(const Efl_Class *klass_id)
{