summaryrefslogtreecommitdiff
path: root/src/tests/eo/constructors/constructors_mixin.c
blob: 417958941ed72aab91c35d28380f5d2d7397f62b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "Eo.h"
#include "constructors_mixin.h"
#include "constructors_simple.h"

#define MY_CLASS MIXIN_CLASS

static void
_add_and_print_set(Eo *obj, void *class_data EINA_UNUSED, int x)
{
   int a = 0, b = 0;
   a = simple_a_get(obj);
   b = simple_b_get(obj);
   printf("%s %d\n", __func__, a + b + x);
}

extern int my_init_count;

static Eo *
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
   my_init_count++;

   return efl_constructor(efl_super(obj, MY_CLASS));
}

static void
_destructor(Eo *obj, void *class_data EINA_UNUSED)
{
   efl_destructor(efl_super(obj, MY_CLASS));

   my_init_count--;
}

EAPI EFL_VOID_FUNC_BODYV(mixin_add_and_print, EFL_FUNC_CALL(x), int x);

static Efl_Op_Description op_descs[] = {
     EFL_OBJECT_OP_FUNC(mixin_add_and_print, _add_and_print_set),
     EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor),
     EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor),
};

static const Efl_Class_Description class_desc = {
     EO_VERSION,
     "Mixin",
     EFL_CLASS_TYPE_MIXIN,
     EFL_CLASS_DESCRIPTION_OPS(op_descs),
     NULL,
     0,
     NULL,
     NULL
};

EFL_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, EO_CLASS, NULL);