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
|
|
|
} \
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_VOID_FUNC_BODYV(simple_##name##_set, EFL_FUNC_CALL(name), int name); \
|
|
|
|
EFL_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
|
|
|
{
|
2013-12-30 13:16:55 -08:00
|
|
|
int a = 0, b = 0;
|
2016-03-01 10:06:28 -08:00
|
|
|
a = simple_a_get(obj);
|
|
|
|
b = simple_b_get(obj);
|
2016-08-15 06:44:41 -07:00
|
|
|
printf("%s %s\n", efl_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
|
|
|
{
|
2013-12-30 13:16:55 -08:00
|
|
|
int a = 0, b = 0;
|
2016-03-01 10:06:28 -08:00
|
|
|
a = simple_a_get(obj);
|
|
|
|
b = simple_b_get(obj);
|
2016-08-15 06:44:41 -07:00
|
|
|
printf("%s %s\n", efl_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
|
|
|
}
|
|
|
|
|
2016-09-05 04:31:55 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_class_initializer(Efl_Class *klass)
|
|
|
|
{
|
|
|
|
EFL_OPS_DEFINE(ops,
|
|
|
|
EFL_OBJECT_OP_FUNC(simple_a_set, _a_set),
|
|
|
|
EFL_OBJECT_OP_FUNC(simple_a_get, _a_get),
|
|
|
|
EFL_OBJECT_OP_FUNC(simple_b_set, _b_set),
|
|
|
|
EFL_OBJECT_OP_FUNC(simple_b_get, _b_get),
|
2016-09-08 05:08:08 -07:00
|
|
|
EFL_OBJECT_OP_FUNC(interface_ab_sum_get, _ab_sum_get),
|
|
|
|
EFL_OBJECT_OP_FUNC(interface2_ab_sum_get2, _ab_sum_get2),
|
2016-09-05 04:31:55 -07:00
|
|
|
);
|
|
|
|
|
2019-02-10 07:57:00 -08:00
|
|
|
return efl_class_functions_set(klass, &ops, NULL);
|
2016-09-05 04:31:55 -07:00
|
|
|
}
|
2012-05-15 07:17:07 -07:00
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
static const Efl_Class_Description class_desc = {
|
2014-04-02 01:46:34 -07:00
|
|
|
EO_VERSION,
|
2012-05-15 07:17:07 -07:00
|
|
|
"Simple",
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CLASS_TYPE_REGULAR,
|
2012-05-15 07:17:07 -07:00
|
|
|
sizeof(Private_Data),
|
2016-09-05 04:31:55 -07:00
|
|
|
_class_initializer,
|
2013-11-07 09:20:11 -08:00
|
|
|
NULL,
|
2012-05-15 07:17:07 -07:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, INTERFACE2_CLASS, NULL);
|