cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=11d2b39b445ba7a381ff6661c30365df74647755

commit 11d2b39b445ba7a381ff6661c30365df74647755
Author: Cedric BAIL <[email protected]>
Date:   Mon Feb 11 18:20:51 2019 -0800

    eo: add efl_property_reflection_exist to be able to know if a property is 
available on an object.
    
    Reviewed-by: Marcel Hollerbach <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D7937
---
 src/lib/eo/Eo.h | 13 +++++++++++++
 src/lib/eo/eo.c | 13 +++++++++++++
 2 files changed, 26 insertions(+)

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);
  * @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.
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)
    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)
 {

-- 


Reply via email to