2012-09-07 14:56:44 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2012-05-15 07:17:07 -07:00
|
|
|
#include "Eo.h"
|
2012-09-25 23:56:52 -07:00
|
|
|
#include "interface_interface.h"
|
|
|
|
#include "interface_interface2.h"
|
|
|
|
#include "interface_simple.h"
|
2012-05-15 07:17:07 -07:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
int b;
|
|
|
|
} Private_Data;
|
|
|
|
|
|
|
|
#define MY_CLASS SIMPLE_CLASS
|
|
|
|
|
|
|
|
#define _GET_SET_FUNC(name) \
|
2013-11-07 09:20:11 -08:00
|
|
|
static int \
|
|
|
|
_##name##_get(Eo *obj EINA_UNUSED, void *class_data) \
|
2012-05-15 07:17:07 -07:00
|
|
|
{ \
|
|
|
|
const Private_Data *pd = class_data; \
|
|
|
|
printf("%s %d\n", __func__, pd->name); \
|
2013-11-07 09:20:11 -08:00
|
|
|
return pd->name; \
|
2012-05-15 07:17:07 -07:00
|
|
|
} \
|
|
|
|
static void \
|
2013-11-07 09:20:11 -08:00
|
|
|
_##name##_set(Eo *obj EINA_UNUSED, void *class_data, int name) \
|
2012-05-15 07:17:07 -07:00
|
|
|
{ \
|
|
|
|
Private_Data *pd = class_data; \
|
|
|
|
pd->name = name; \
|
|
|
|
printf("%s %d\n", __func__, pd->name); \
|
2013-11-07 09:20:11 -08:00
|
|
|
} \
|
|
|
|
EO2_VOID_FUNC_BODYV(simple_##name##_set, EO2_FUNC_CALL(name), int name); \
|
|
|
|
EO2_FUNC_BODY(simple_##name##_get, int, 0);
|
2012-05-15 07:17:07 -07:00
|
|
|
|
|
|
|
_GET_SET_FUNC(a)
|
|
|
|
_GET_SET_FUNC(b)
|
|
|
|
|
2013-11-07 09:20:11 -08:00
|
|
|
static int
|
|
|
|
_ab_sum_get(Eo *obj, void *class_data EINA_UNUSED)
|
2012-05-15 07:17:07 -07:00
|
|
|
{
|
|
|
|
int a, b;
|
2013-11-07 09:20:11 -08:00
|
|
|
eo2_do(obj, a = simple_a_get(), b = simple_b_get());
|
2012-05-15 07:17:07 -07:00
|
|
|
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
|
2013-11-07 09:20:11 -08:00
|
|
|
return a + b;
|
2012-05-15 07:17:07 -07:00
|
|
|
}
|
|
|
|
|
2013-11-07 09:20:11 -08:00
|
|
|
static int
|
|
|
|
_ab_sum_get2(Eo *obj, void *class_data EINA_UNUSED)
|
2012-05-15 07:17:07 -07:00
|
|
|
{
|
|
|
|
int a, b;
|
2013-11-07 09:20:11 -08:00
|
|
|
eo2_do(obj, a = simple_a_get(), b = simple_b_get());
|
2012-05-15 07:17:07 -07:00
|
|
|
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
|
2013-11-07 09:20:11 -08:00
|
|
|
return a + b + 1;
|
2012-05-15 07:17:07 -07:00
|
|
|
}
|
|
|
|
|
2013-11-07 09:20:11 -08:00
|
|
|
static Eo2_Op_Description op_descs[] = {
|
2013-11-11 05:27:36 -08:00
|
|
|
EO2_OP_FUNC(simple_a_set, _a_set, "Set property a"),
|
|
|
|
EO2_OP_FUNC(simple_a_get, _a_get, "Get property a"),
|
|
|
|
EO2_OP_FUNC(simple_b_set, _b_set, "Set property b"),
|
|
|
|
EO2_OP_FUNC(simple_b_get, _b_get, "Get property b"),
|
|
|
|
EO2_OP_FUNC_OVERRIDE(interface_ab_sum_get, _ab_sum_get),
|
|
|
|
EO2_OP_FUNC_OVERRIDE(interface2_ab_sum_get2, _ab_sum_get2),
|
2013-11-07 09:20:11 -08:00
|
|
|
EO2_OP_SENTINEL
|
2012-05-15 07:17:07 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const Eo_Class_Description class_desc = {
|
2013-11-07 09:20:11 -08:00
|
|
|
EO2_VERSION,
|
2012-05-15 07:17:07 -07:00
|
|
|
"Simple",
|
|
|
|
EO_CLASS_TYPE_REGULAR,
|
2013-11-07 09:20:11 -08:00
|
|
|
EO2_CLASS_DESCRIPTION_OPS(op_descs),
|
2012-05-15 07:17:07 -07:00
|
|
|
NULL,
|
|
|
|
sizeof(Private_Data),
|
2013-11-07 09:20:11 -08:00
|
|
|
NULL,
|
2012-05-15 07:17:07 -07:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2013-11-07 09:20:11 -08:00
|
|
|
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO2_BASE_CLASS, INTERFACE2_CLASS, NULL);
|