Eo: Turn evas example back on.
[profile/ivi/eobj.git] / src / tests / mixin / mixin.c
1 #include "Eo.h"
2 #include "mixin.h"
3 #include "simple.h"
4
5 #include "config.h"
6
7 EAPI Eo_Op MIXIN_BASE_ID = 0;
8
9 #define MY_CLASS MIXIN_CLASS
10
11 static void
12 _ab_sum_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list)
13 {
14    int a, b;
15    eo_query(obj, simple_a_get(&a), simple_b_get(&b));
16    int *sum = va_arg(*list, int *);
17    if (sum)
18       *sum = a + b;
19    printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
20 }
21
22 static void
23 _constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
24 {
25    eo_do_super(obj, eo_constructor());
26 }
27
28 static void
29 _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
30 {
31    eo_do_super(obj, eo_destructor());
32 }
33
34 static void
35 _class_constructor(Eo_Class *klass)
36 {
37    const Eo_Op_Func_Description func_desc[] = {
38         EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
39         EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
40         EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
41         EO_OP_FUNC_SENTINEL
42    };
43
44    eo_class_funcs_set(klass, func_desc);
45 }
46
47
48 static const Eo_Op_Description op_desc[] = {
49      EO_OP_DESCRIPTION_CONST(MIXIN_SUB_ID_AB_SUM_GET, "Get the sum of a and b."),
50      EO_OP_DESCRIPTION_SENTINEL
51 };
52
53 static const Eo_Class_Description class_desc = {
54      "Mixin",
55      EO_CLASS_TYPE_MIXIN,
56      EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
57      NULL,
58      0,
59      _class_constructor,
60      NULL
61 };
62
63 EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL)
64