summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_test_class_simple.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-09-26 06:56:52 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-09-26 06:56:52 +0000
commit3b5a3448b7dfc53c2f129bdb04bea9f7a02741a6 (patch)
tree18ad8a6b1841e9832c85a46f887b2cd6d6dacc4b /src/tests/eo/suite/eo_test_class_simple.c
parent195d31c73fef88cfaa803b07b2ae3cba983a4093 (diff)
merge: add eo
SVN revision: 77072
Diffstat (limited to 'src/tests/eo/suite/eo_test_class_simple.c')
-rw-r--r--src/tests/eo/suite/eo_test_class_simple.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/tests/eo/suite/eo_test_class_simple.c b/src/tests/eo/suite/eo_test_class_simple.c
new file mode 100644
index 0000000000..224f5b5a54
--- /dev/null
+++ b/src/tests/eo/suite/eo_test_class_simple.c
@@ -0,0 +1,69 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Eo.h"
6#include "eo_test_class_simple.h"
7
8#define MY_CLASS SIMPLE_CLASS
9
10EAPI Eo_Op SIMPLE_BASE_ID = 0;
11
12static void
13_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
14{
15 Simple_Public_Data *pd = class_data;
16 int a;
17 a = va_arg(*list, int);
18 printf("%s %d\n", eo_class_name_get(MY_CLASS), a);
19 pd->a = a;
20}
21
22static void
23_a_print(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
24{
25 const Simple_Public_Data *pd = class_data;
26 (void) list;
27 printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a);
28}
29
30static void
31_class_hi_print(const Eo_Class *klass, va_list *list)
32{
33 (void) list;
34 printf("Hi Print %s\n", eo_class_name_get(klass));
35}
36
37static void
38_class_constructor(Eo_Class *klass)
39{
40 const Eo_Op_Func_Description func_desc[] = {
41 EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
42 EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _a_print),
43 EO_OP_FUNC_CLASS(SIMPLE_ID(SIMPLE_SUB_ID_CLASS_HI_PRINT), _class_hi_print),
44 EO_OP_FUNC_SENTINEL
45 };
46
47 eo_class_funcs_set(klass, func_desc);
48}
49
50static const Eo_Op_Description op_desc[] = {
51 EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"),
52 EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_PRINT, "Print property A"),
53 EO_OP_DESCRIPTION_CLASS(SIMPLE_SUB_ID_CLASS_HI_PRINT, "Print Hi"),
54 EO_OP_DESCRIPTION_SENTINEL
55};
56
57static const Eo_Class_Description class_desc = {
58 EO_VERSION,
59 "Simple",
60 EO_CLASS_TYPE_REGULAR,
61 EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
62 NULL,
63 sizeof(Simple_Public_Data),
64 _class_constructor,
65 NULL
66};
67
68EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL)
69