summaryrefslogtreecommitdiff
path: root/src/lib/eo
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-02-11 16:31:52 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-02-21 11:54:09 -0800
commitb23f65291f9624827e40ebf32d5133cb1074aeb6 (patch)
tree34f7287c424413a2bf5debb2ff8601e6c7d1e00a /src/lib/eo
parent56a91961ce07337fb9e73f46298415426175d25a (diff)
eo: make reflection setter able to return an error code in case of failure.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de> Differential Revision: https://phab.enlightenment.org/D7935
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/Eo.h4
-rw-r--r--src/lib/eo/eo.c19
2 files changed, 14 insertions, 9 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 323a1a97b5..52b75134ac 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -827,7 +827,7 @@ struct _Efl_Class_Description
827/** 827/**
828 * Setter type which is used to set an #Eina_Value, this function should access one particular property field 828 * Setter type which is used to set an #Eina_Value, this function should access one particular property field
829 */ 829 */
830typedef void (*Efl_Object_Property_Reflection_Setter)(Eo *obj, Eina_Value value); 830typedef Eina_Error (*Efl_Object_Property_Reflection_Setter)(Eo *obj, Eina_Value value);
831 831
832/** 832/**
833 * Getter type which is used to get an #Eina_Value, this function should access one particular property field 833 * Getter type which is used to get an #Eina_Value, this function should access one particular property field
@@ -1985,7 +1985,7 @@ EAPI Eina_Bool efl_destructed_is(const Eo *obj);
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 */ 1987 */
1988EAPI void efl_property_reflection_set(Eo *obj, const char *property_name, Eina_Value value); 1988EAPI Eina_Error efl_property_reflection_set(Eo *obj, const char *property_name, Eina_Value value);
1989 1989
1990/** 1990/**
1991 * @brief Retrieve an #Eina_Value containing the current value of the property specified with \c property_name. 1991 * @brief Retrieve an #Eina_Value containing the current value of the property specified with \c property_name.
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index c2b5f85b60..efd68055dc 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -3636,20 +3636,25 @@ _efl_class_reflection_find(const _Efl_Class *klass, const char *property_name)
3636 return NULL; 3636 return NULL;
3637} 3637}
3638 3638
3639EAPI void 3639EAPI Eina_Error
3640efl_property_reflection_set(Eo *obj_id, const char *property_name, Eina_Value value) 3640efl_property_reflection_set(Eo *obj_id, const char *property_name, Eina_Value value)
3641{ 3641{
3642 Eina_Error r = EINA_ERROR_NOT_IMPLEMENTED;
3643 Eina_Bool freed = EINA_FALSE;
3644
3642 EO_OBJ_POINTER_GOTO(obj_id, obj, end); 3645 EO_OBJ_POINTER_GOTO(obj_id, obj, end);
3643 const Efl_Object_Property_Reflection *reflection = _efl_class_reflection_find(obj->klass, property_name); 3646 const Efl_Object_Property_Reflection *reflection = _efl_class_reflection_find(obj->klass, property_name);
3644 3647
3645 if (!reflection || !reflection->set) goto end; 3648 if (reflection && reflection->set)
3649 {
3650 r = reflection->set(obj_id, value);
3651 freed = EINA_TRUE;
3652 }
3646 3653
3647 reflection->set(obj_id, value); 3654 end:
3648 EO_OBJ_DONE(obj_id); 3655 if (!freed) eina_value_flush(&value);
3649 return;
3650end:
3651 eina_value_flush(&value);
3652 EO_OBJ_DONE(obj_id); 3656 EO_OBJ_DONE(obj_id);
3657 return r;
3653} 3658}
3654 3659
3655EAPI Eina_Value 3660EAPI Eina_Value