summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_test_reflection_complex_class_structure.c
blob: 474f0f77c293ec6e6c94180b90dac004865706ae (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>

#include <Eo.h>

#include "eo_suite.h"
#include "eo_test_class_simple.h"
#include "eo_test_reflection_complex_class_structure.h"

typedef struct {
   int i;
} Complex_Class_Data;

typedef struct {
   int i;
} Complex_Mixin_Data;

static void
_complex_class_complex_interface_i_test_set(Eo *obj EINA_UNUSED, Complex_Class_Data *pd, int i)
{
   pd->i = i;
}

static int
_complex_class_complex_interface_i_test_get(const Eo *obj EINA_UNUSED, Complex_Class_Data *pd)
{
   return pd->i;
}

static int
_complex_mixin_m_test_get(const Eo *obj EINA_UNUSED, Complex_Mixin_Data *pd)
{
   return pd->i;
}

static void
_complex_mixin_m_test_set(Eo *obj EINA_UNUSED, Complex_Mixin_Data *pd, int i)
{
   pd->i = i;
}

static Eina_Bool
_complex_class_class_initializer(Efl_Class *klass)
{
   const Efl_Object_Ops *opsp = NULL;

   const Efl_Object_Property_Reflection_Ops *ropsp = NULL;

#ifndef COMPLEX_CLASS_EXTRA_OPS
#define COMPLEX_CLASS_EXTRA_OPS
#endif

   EFL_OPS_DEFINE(ops,
      EFL_OBJECT_OP_FUNC(complex_interface_i_test_set, _complex_class_complex_interface_i_test_set),
      EFL_OBJECT_OP_FUNC(complex_interface_i_test_get, _complex_class_complex_interface_i_test_get),
      COMPLEX_CLASS_EXTRA_OPS
   );
   opsp = &ops;

   return efl_class_functions_set(klass, opsp, ropsp);
}

static const Efl_Class_Description _complex_class_class_desc = {
   EO_VERSION,
   "Complex_Class",
   EFL_CLASS_TYPE_REGULAR,
   sizeof(Complex_Class_Data),
   _complex_class_class_initializer,
   NULL,
   NULL
};

EFL_DEFINE_CLASS(complex_class_class_get, &_complex_class_class_desc, EO_CLASS, COMPLEX_INTERFACE_INTERFACE, COMPLEX_MIXIN_MIXIN, NULL);

static Eina_Error
__eolian_complex_interface_i_test_set_reflect(Eo *obj, Eina_Value val)
{
   Eina_Error r = 0;   int cval;
   if (!eina_value_int_convert(&val, &cval))
      {
         r = EINA_ERROR_VALUE_FAILED;
         goto end;
      }
   complex_interface_i_test_set(obj, cval);
 end:
   eina_value_flush(&val);
   return r;
}

EOAPI EFL_VOID_FUNC_BODYV(complex_interface_i_test_set, EFL_FUNC_CALL(i), int i);

static Eina_Value
__eolian_complex_interface_i_test_get_reflect(Eo *obj)
{
   int val = complex_interface_i_test_get(obj);
   return eina_value_int_init(val);
}

EOAPI EFL_FUNC_BODY_CONST(complex_interface_i_test_get, int, 0);

static Eina_Bool
_complex_interface_class_initializer(Efl_Class *klass)
{
   const Efl_Object_Ops *opsp = NULL;

   const Efl_Object_Property_Reflection_Ops *ropsp = NULL;

#ifndef COMPLEX_INTERFACE_EXTRA_OPS
#define COMPLEX_INTERFACE_EXTRA_OPS
#endif

   EFL_OPS_DEFINE(ops,
      EFL_OBJECT_OP_FUNC(complex_interface_i_test_set, NULL),
      EFL_OBJECT_OP_FUNC(complex_interface_i_test_get, NULL),
      COMPLEX_INTERFACE_EXTRA_OPS
   );
   opsp = &ops;

   static const Efl_Object_Property_Reflection refl_table[] = {
      {"i_test", __eolian_complex_interface_i_test_set_reflect, __eolian_complex_interface_i_test_get_reflect},
   };
   static const Efl_Object_Property_Reflection_Ops rops = {
      refl_table, EINA_C_ARRAY_LENGTH(refl_table)
   };
   ropsp = &rops;

   return efl_class_functions_set(klass, opsp, ropsp);
}

static const Efl_Class_Description _complex_interface_class_desc = {
   EO_VERSION,
   "Complex_Interface",
   EFL_CLASS_TYPE_INTERFACE,
   0,
   _complex_interface_class_initializer,
   NULL,
   NULL
};

EFL_DEFINE_CLASS(complex_interface_interface_get, &_complex_interface_class_desc, NULL, NULL);

static Eina_Error
__eolian_complex_mixin_m_test_set_reflect(Eo *obj, Eina_Value val)
{
   Eina_Error r = 0;   int cval;
   if (!eina_value_int_convert(&val, &cval))
      {
         r = EINA_ERROR_VALUE_FAILED;
         goto end;
      }
   complex_mixin_m_test_set(obj, cval);
 end:
   eina_value_flush(&val);
   return r;
}

EOAPI EFL_VOID_FUNC_BODYV(complex_mixin_m_test_set, EFL_FUNC_CALL(i), int i);


static Eina_Value
__eolian_complex_mixin_m_test_get_reflect(Eo *obj)
{
   int val = complex_mixin_m_test_get(obj);
   return eina_value_int_init(val);
}

EOAPI EFL_FUNC_BODY_CONST(complex_mixin_m_test_get, int, 0);

static Eina_Bool
_complex_mixin_class_initializer(Efl_Class *klass)
{
   const Efl_Object_Ops *opsp = NULL;

   const Efl_Object_Property_Reflection_Ops *ropsp = NULL;

#ifndef COMPLEX_MIXIN_EXTRA_OPS
#define COMPLEX_MIXIN_EXTRA_OPS
#endif

   EFL_OPS_DEFINE(ops,
      EFL_OBJECT_OP_FUNC(complex_mixin_m_test_set, _complex_mixin_m_test_set),
      EFL_OBJECT_OP_FUNC(complex_mixin_m_test_get, _complex_mixin_m_test_get),
      COMPLEX_MIXIN_EXTRA_OPS
   );
   opsp = &ops;

   static const Efl_Object_Property_Reflection refl_table[] = {
      {"m_test", __eolian_complex_mixin_m_test_set_reflect, __eolian_complex_mixin_m_test_get_reflect},
   };
   static const Efl_Object_Property_Reflection_Ops rops = {
      refl_table, EINA_C_ARRAY_LENGTH(refl_table)
   };
   ropsp = &rops;

   return efl_class_functions_set(klass, opsp, ropsp);
}

static const Efl_Class_Description _complex_mixin_class_desc = {
   EO_VERSION,
   "Complex_Mixin",
   EFL_CLASS_TYPE_MIXIN,
   sizeof(Complex_Mixin_Data),
   _complex_mixin_class_initializer,
   NULL,
   NULL
};

EFL_DEFINE_CLASS(complex_mixin_mixin_get, &_complex_mixin_class_desc, NULL, NULL);