efl/src/tests/eo/mixin/mixin_mixin.c

54 lines
1.1 KiB
C
Raw Normal View History

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
2012-09-25 23:56:52 -07:00
#include "mixin_mixin.h"
#include "mixin_simple.h"
#define MY_CLASS MIXIN_CLASS
2013-11-08 02:48:55 -08:00
static int
_ab_sum_get(Eo *obj, void *class_data EINA_UNUSED)
{
int a, b;
2013-11-08 02:48:55 -08:00
eo2_do(obj, a = simple_a_get(), b = simple_b_get());
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
2013-11-08 02:48:55 -08:00
return a + b;
}
static void
2013-11-08 02:48:55 -08:00
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
2013-11-08 02:48:55 -08:00
eo2_do_super(obj, MY_CLASS, eo2_constructor());
}
static void
2013-11-08 02:48:55 -08:00
_destructor(Eo *obj, void *class_data EINA_UNUSED)
{
2013-11-08 02:48:55 -08:00
eo2_do_super(obj, MY_CLASS, eo2_destructor());
}
2013-11-08 02:48:55 -08:00
EAPI EO2_FUNC_BODY(mixin_ab_sum_get, int, 0);
2013-11-08 02:48:55 -08:00
static Eo2_Op_Description op_descs[] = {
EO2_OP_FUNC_OVERRIDE(eo2_constructor, _constructor),
EO2_OP_FUNC_OVERRIDE(eo2_destructor, _destructor),
EO2_OP_FUNC(mixin_ab_sum_get, _ab_sum_get, "Get the sum of a and b."),
2013-11-08 02:48:55 -08:00
EO2_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
2013-11-08 02:48:55 -08:00
EO2_VERSION,
"Mixin",
EO_CLASS_TYPE_MIXIN,
2013-11-08 02:48:55 -08:00
EO2_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
2013-11-08 02:48:55 -08:00
NULL,
NULL
};
2013-11-08 02:48:55 -08:00
EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, EO2_BASE_CLASS, NULL)