summaryrefslogtreecommitdiff
path: root/src/lib/eo
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-02-11 18:20:51 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-02-21 11:54:14 -0800
commit11d2b39b445ba7a381ff6661c30365df74647755 (patch)
treef3c8002de7b9180d73a383d050adbcb3da59ceb9 /src/lib/eo
parent770750486c84305f3aaf82df48605ee956b1281e (diff)
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
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/Eo.h13
-rw-r--r--src/lib/eo/eo.c13
2 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 52b75134ac..cefcb1746e 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -1984,6 +1984,7 @@ EAPI Eina_Bool efl_destructed_is(const Eo *obj);
1984 * @param property_name The name of the property to modify. 1984 * @param property_name The name of the property to modify.
1985 * @param value The value to set, the value passed here will be flushed by the function 1985 * @param value The value to set, the value passed here will be flushed by the function
1986 * 1986 *
1987 * @see efl_property_reflection_get() and efl_property_reflection_exist()
1987 */ 1988 */
1988EAPI Eina_Error efl_property_reflection_set(Eo *obj, const char *property_name, Eina_Value value); 1989EAPI Eina_Error efl_property_reflection_set(Eo *obj, const char *property_name, Eina_Value value);
1989 1990
@@ -1993,9 +1994,21 @@ EAPI Eina_Error efl_property_reflection_set(Eo *obj, const char *property_name,
1993 * @param property_name The name of the property to get. 1994 * @param property_name The name of the property to get.
1994 * 1995 *
1995 * @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. 1996 * @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.
1997 *
1998 * @see efl_property_reflection_set() and efl_property_reflection_exist()
1996 */ 1999 */
1997EAPI Eina_Value efl_property_reflection_get(Eo *obj, const char *property_name); 2000EAPI Eina_Value efl_property_reflection_get(Eo *obj, const char *property_name);
1998 2001
2002/**
2003 * @brief Check if a property exist for reflection.
2004 * @param obj The object to inspect.
2005 * @param property_name The name of the property to check if it exist.
2006 *
2007 * @return EINA_TRUE if the property exist, EINA_FALSE otherwise.
2008 *
2009 * @see efl_property_reflection_set() and efl_property_reflection_get()
2010 */
2011EAPI Eina_Bool efl_property_reflection_exist(Eo *obj, const char *property_name);
1999 2012
2000/** 2013/**
2001 * @addtogroup Efl_Class_Class Eo's Class class. 2014 * @addtogroup Efl_Class_Class Eo's Class class.
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index a5c72e0762..76bebef023 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -3674,6 +3674,19 @@ efl_property_reflection_get(Eo *obj_id, const char *property_name)
3674 return r; 3674 return r;
3675} 3675}
3676 3676
3677EAPI Eina_Bool
3678efl_property_reflection_exist(Eo *obj_id, const char *property_name)
3679{
3680 Eina_Bool r = EINA_FALSE;
3681 EO_OBJ_POINTER_GOTO(obj_id, obj, end);
3682 const Efl_Object_Property_Reflection *reflection = _efl_class_reflection_find(obj->klass, property_name);
3683
3684 if (reflection) r = EINA_TRUE;
3685 end:
3686 EO_OBJ_DONE(obj_id);
3687 return r;
3688}
3689
3677EAPI Efl_Class_Type 3690EAPI Efl_Class_Type
3678efl_class_type_get(const Efl_Class *klass_id) 3691efl_class_type_get(const Efl_Class *klass_id)
3679{ 3692{