summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_test_class_simple.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-05 15:40:41 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-07 14:43:25 +0100
commit0f32bb90476703f81fd08800eda0a0d89321f80f (patch)
tree97f71bd6fedc72e0609e0e807527de0da4a54072 /src/tests/eo/suite/eo_test_class_simple.c
parent0709bdea6f94149b6b319461edd27b7a0035552d (diff)
eo: here comes reflection API
this adds support in eo to generate a reflection API. To get the actaul reflection to the klass, the API efl_class_reflection_table_set needs to be called, the table in the end can be generated by eolian. Reflection API is inherited by the extended class. This means, if you have two reflection tables, first, the most upperst is called, then the next lower one is called. For now this API accepts NULL setter or getter, and will ignore them silently when they are called. fix T7681 Differential Revision: https://phab.enlightenment.org/D7879
Diffstat (limited to 'src/tests/eo/suite/eo_test_class_simple.c')
-rw-r--r--src/tests/eo/suite/eo_test_class_simple.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/tests/eo/suite/eo_test_class_simple.c b/src/tests/eo/suite/eo_test_class_simple.c
index dfba73f669..8d82b1eb11 100644
--- a/src/tests/eo/suite/eo_test_class_simple.c
+++ b/src/tests/eo/suite/eo_test_class_simple.c
@@ -23,6 +23,16 @@ _a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
23 efl_event_callback_legacy_call(obj, EV_A_CHANGED, &pd->a); 23 efl_event_callback_legacy_call(obj, EV_A_CHANGED, &pd->a);
24} 24}
25 25
26static void
27_a_set_reflect(Eo *obj, Eina_Value value)
28{
29 int a;
30
31 eina_value_int_convert(&value, &a);
32 simple_a_set(obj, a);
33 eina_value_flush(&value);
34}
35
26static int 36static int
27_a_get(Eo *obj EINA_UNUSED, void *class_data) 37_a_get(Eo *obj EINA_UNUSED, void *class_data)
28{ 38{
@@ -31,6 +41,14 @@ _a_get(Eo *obj EINA_UNUSED, void *class_data)
31 return pd->a; 41 return pd->a;
32} 42}
33 43
44static Eina_Value
45_a_get_reflect(Eo *obj)
46{
47 int a = simple_a_get(obj);
48
49 return eina_value_int_init(a);
50}
51
34static Eina_Bool 52static Eina_Bool
35_a_print(Eo *obj EINA_UNUSED, void *class_data) 53_a_print(Eo *obj EINA_UNUSED, void *class_data)
36{ 54{
@@ -103,8 +121,14 @@ _class_initializer(Efl_Class *klass)
103 EFL_OPS_DEFINE(cops, 121 EFL_OPS_DEFINE(cops,
104 EFL_OBJECT_OP_FUNC(simple_class_hi_print, _class_hi_print), 122 EFL_OBJECT_OP_FUNC(simple_class_hi_print, _class_hi_print),
105 ); 123 );
106 124 static const Efl_Object_Property_Reflection reflection_table[] = {
107 return efl_class_functions_set(klass, &ops, &cops, NULL); 125 {"simple_a", _a_set_reflect, _a_get_reflect},
126 };
127 static const Efl_Object_Property_Reflection_Ops ref_ops = {
128 reflection_table, EINA_C_ARRAY_LENGTH(reflection_table)
129 };
130
131 return efl_class_functions_set(klass, &ops, &cops, &ref_ops);
108} 132}
109 133
110static const Efl_Class_Description class_desc = { 134static const Efl_Class_Description class_desc = {