summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2012-12-24 12:55:14 +0000
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2012-12-24 12:55:14 +0000
commiteed9825834f1d24c38ae73b11f31a8cdcf8ff8ab (patch)
treebf6f50d8b9a2a86de566e805145b79530ea213ba /doc
parent300ee59f38c9649163cc3a05d58e9906decc3192 (diff)
Eo tutorial in Doxygen format.
Signed-off-by: Daniel Zaoui <daniel.zaoui@samsung.com> SVN revision: 81681
Diffstat (limited to 'doc')
-rw-r--r--doc/Doxyfile.in1
-rw-r--r--doc/Eo_Tutorial280
-rw-r--r--doc/eo_tutorial.dox309
3 files changed, 310 insertions, 280 deletions
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
index 016ca76947..69da95dd61 100644
--- a/doc/Doxyfile.in
+++ b/doc/Doxyfile.in
@@ -597,6 +597,7 @@ INPUT = @top_srcdir@/src/lib \
597 @srcdir@/ecore_examples.dox \ 597 @srcdir@/ecore_examples.dox \
598 @srcdir@/eet_examples.dox \ 598 @srcdir@/eet_examples.dox \
599 @srcdir@/evas_examples.dox \ 599 @srcdir@/evas_examples.dox \
600 @srcdir@/eo_tutorial.dox \
600 @builddir@/eio.dox 601 @builddir@/eio.dox
601 602
602# This tag can be used to specify the character encoding of the source files 603# This tag can be used to specify the character encoding of the source files
diff --git a/doc/Eo_Tutorial b/doc/Eo_Tutorial
deleted file mode 100644
index 766ed1ed6e..0000000000
--- a/doc/Eo_Tutorial
+++ /dev/null
@@ -1,280 +0,0 @@
1EO Tutorial:
2===========
3
4* Purpose:
5---------
6The purpose of this document is to explain how to work with Eo, how to port your code to Eo and what are the common pitfalls. It doesn't explain how it works inside.
7
8* Description:
9-------------
10Eo is an Object oriented infrastructure for the EFL. It is a API/ABI safe library.
11
12It supports inheritance, mixins, interfaces and composite objects.
13Every class can implement functions from every other class.
14It supports event signals, function overrides, private/protected/public/etc. variables and functions.
15
16At the creation of the class, a "virtual table" is filled with the needed functions.
17The key of this table is a (class id, function id) tuple.
18
19eo_do is invoked with a list of op ids and their parameters and is in charge to dispatch the relevant functions. Finding the correct function is fast because it is just a lookup table.
20
21* How to use it?
22---------------
231) Creation of an instance of a class
24Old way:
25object = evas_object_line_add(canvas);
26
27New way:
28object = eo_add(EVAS_OBJ_LINE_CLASS, canvas);
29
302) Call to function
31Old way:
32 evas_object_move(obj, 120, 120);
33 evas_object_resize(obj, 200, 200);
34
35Eo way:
36 eo_do(obj,
37 evas_obj_move(120, 120),
38 evas_obj_resize(200, 200));
39
403) Extract specific data
41Old way:
42 Evas_Object_Line *o = (Evas_Object_Line *)(obj->object_data);
43 MAGIC_CHECK(o, Evas_Object_Line, MAGIC_OBJ_LINE);
44 return;
45 MAGIC_CHECK_END();
46
47Eo way:
48 Evas_Object_Line *o = eo_data_get(obj, EVAS_OBJ_LINE_CLASS);
49 if (!o) return;
50
514) Call function of parent
52Old way:
53 ELM_WIDGET_CLASS(_elm_button_parent_sc)->theme(obj))
54
55New way:
56 eo_do_super(obj, elm_wdg_theme(&int_ret));
57
58* Important to know:
59-------------------
601) eo_do is the function used to invoke functions of a specific class on an object.
61
622) eo_data_get receives an object and a class and returns the data of the given class for the object. The class must belong to the object class hierarchy.
63
643) eo_isa indicates if a given object is of a given type.
65
664) eo_do_super is in charge to invoke a function in the next parents that implements it. It is recommended to use eo_do_super only from a function with the same op id.
67In addition, there is no way to jump over classes who implement the function. If A inherits from B, B from C and A, B and C implement a virtual function defined in C, the function calls order will be A, then B and finally C. It is impossible to pass over B.
68
695) eo_do returns if the operation succeeded or failed (function found, object deleted...), not the result of the called function. Pay attention to this detail when you call eo_do. The return value needs to be an additional parameter which will hold a return value.
70
716) Don't do this:
72 int w, h;
73 eo_do(obj,
74 evas_obj_size_get(&w, &h),
75 evas_obj_size_set(w+10, h+20));
76 w+10 and h+20 are evaluated before the call to size_get.
77 Instead, separate it in two calls to eo_do.
78
797) When calling eo_add on an object, the reference counter of this one is incremented. You need to call eo_unref to decrement this counter.
80If it is called with a parent, two references are on the object. eo_del removes both of these references.
81When there is no more references on an object, this one is deleted and then can be freed. The deletion calls to the destructor (see eo_destructor). When done, Eo checks if the object can be freed. The free mechanism can be "disabled" through eo_manual_free_set. It is the responsibility of the developer to call eo_manual_free on the object to free it. This mechanism has been used for example in Evas on the Evas objects and in Ecore
82
838) When eo_do reaches a function of a class, it is the responsibility of the user to extract from the va_list ALL the parameters needed for this function, NO MORE, NO LESS. Otherwise, unknown behavior can occur. eo_do is called with a list of op id, params, op id, params... A bad extraction of parameters can bring to the parsing of a wrong op id and so in the best case, to an error, in the worst case, to another function not in relation with the actual use case.
84
859) Always pay attention to:
86 - the pairing between function id and the function itself. Using the same function for two ids occurs and is hard to debug.
87 - the definition of the function macros in the H file and their parameters order/type
88 - to extract all the parameters of a function from the va_list
89
9010) Enum of the op ids in H file and descriptions in C file must be synchronized, i.e same number of ids and same order. If you change the order by adding, removing or moving ids, you break ABI of your library.
91
9211) Avoid exposing your class data to prevent ABI break. Supply access functions instead.
93
94* How to create a class - H side?
95--------------------------------
96- If the object is new, establish the public APIs
97- #define $(CLASS_NAME) $(class_name)_class_get(): will be used to access data/inherit from this class...
98- const Eo_Class *$(class_name)_class_get(void) EINA_CONST: declaration of the function that will create the class (not the instance), i.e virtual table...
99- extern EAPI Eo_Op $(CLASS_NAME)_BASE_ID: class id that will be essentially used to identify functions set of this class
100- enum of the function ids of the class in the form $(CLASS_NAME)_SUB_ID: used to identify the function inside the class; function id is unique per class but (class id, function id) is unique per system..
101- #define $(CLASS_NAME)_ID(sub_id) ($(CLASS_NAME)_BASE_ID + sub_id): formula to calculate the system function id
102- define of each function consists of:
103 - the name of the function that will be used in eo_do
104 - parameters without types
105 - $(CLASS_NAME)_ID($(CLASS_NAME)_SUB_ID_FUNCTION
106 - EO_TYPECHECK for each parameter: type and variable name
107- And don't forget to document each function
108
109Evas Object Line Example:
110------------------------
111#define EVAS_OBJ_LINE_CLASS evas_object_line_class_get()
112const Eo_Class *evas_object_line_class_get(void) EINA_CONST;
113
114extern EAPI Eo_Op EVAS_OBJ_LINE_BASE_ID;
115
116enum
117{
118 EVAS_OBJ_LINE_SUB_ID_XY_SET,
119 EVAS_OBJ_LINE_SUB_ID_XY_GET,
120 EVAS_OBJ_LINE_SUB_ID_LAST
121}
122
123#define EVAS_OBJ_LINE_ID(sub_id) (EVAS_OBJ_LINE_BASE_ID + sub_id)
124
125/**
126 * @def evas_obj_line_xy_set
127 * @since 1.8
128 *
129 * Sets the coordinates of the end points of the given evas line object.
130 *
131 * @param[in] x1
132 * @param[in] y1
133 * @param[in] x2
134 * @param[in] y2
135 *
136 * @see evas_object_line_xy_set
137 */
138#define evas_obj_line_xy_set(x1, y1, x2, y2) EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_SET), EO_TYPECHECK(Evas_Coord, x1), EO_TYPECHECK(Evas_Coord, y1), EO_TYPECHECK(Evas_Coord, x2), EO_TYPECHECK(Evas_Coord, y2)
139
140/**
141 * @def evas_obj_line_xy_get
142 * @since 1.8
143 *
144 * Retrieves the coordinates of the end points of the given evas line object.
145 *
146 * @param[out] x1
147 * @param[out] y1
148 * @param[out] x2
149 * @param[out] y2
150 *
151 * @see evas_object_line_xy_get
152 */
153#define evas_obj_line_xy_get(x1, y1, x2, y2) EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_GET), EO_TYPECHECK(Evas_Coord *, x1), EO_TYPECHECK(Evas_Coord *, y1), EO_TYPECHECK(Evas_Coord *, x2), EO_TYPECHECK(Evas_Coord *, y2)
154
155* How to create a class - C side?
156--------------------------------
157Below, the object line as example.
158
159#include "Eo.h"
160EAPI Eo_Op $(CLASS_NAME)_BASE_ID = EO_NOOP; // Initialisation of the class id to 0. Will be set dynamically by Eo itself.
161#define MY_CLASS $(CLASS_NAME)
162
163...
164
165Example for a developer function called by Eo:
166This function receives the Eo object, the data corresponding to this class and the list of parameters.
167static void
168_foo(Eo *eo_obj, void *_pd, va_list *list)
169{
170 int param_1 = va_arg(*list, int);
171 Eina_Bool param_2 = va_arg(*list, int);
172 Eina_Bool ret = va_arg(*list, Eina_Bool *);
173 foo_data obj = _pd;
174
175 if (ret) *ret = EINA_FALSE;
176 ...
177}
178
179You can (not a must) implement a constructor. This constructor MUST call the parent constructor (eo_do_super). It is the same for the destructor.
180See eo_constructor and eo_destructor.
181If you don't have anything to do in constructor (like malloc, variables init...) or in destructor (free), don't implement them.
182
183At the end of the file, you need to describe the class.
184First, you need to supply the class constructor that sets the list of the functions that are implemented in this class. It includes functions overriden (constructor, destructor, member_add...) and functions specific to this class. If there is no function implemented in this class, you don't need a class constructor.
185Then, you need a list to describe the new functions. For each one, the op id and a description.
186Then, the class itself that consists in:
187 - the version of Eo, used for backward compatibility
188 - the class name
189 - the type of the class:
190 - regular: an object can be created from this type (mostly used)
191 - regular non instant-iable: Same as previous, but objects can’t be created from this type (elm_widget)
192 - interface: used to extend classes, no implementations for functions and no internal data
193 - mixin : interfaces with internal data and pre-made implementations for functions
194 - the descriptions list described above and the number of ops for this class
195 - events
196 - size of the data of the class
197 - the class constructor, if exists, else NULL
198 - the class destructor (NULL most of the time)
199
200Finally, we define the class with:
201 - the function name to give to the function that creates/returns the class
202 - the class description explained above
203 - the parent and the interfaces/mixins, finished by NULL
204
205
206Evas Object Line Example:
207------------------------
208#include "Eo.h"
209EAPI Eo_Op EVAS_OBJ_LINE_BASE_ID = EO_NOOP;
210#define MY_CLASS EVAS_OBJ_LINE_CLASS
211
212...
213
214static void
215_line_xy_get(Eo *eo_obj, void *_pd, va_list *list)
216{
217 const Evas_Object_Line *o = _pd;
218
219 Evas_Coord *x1 = va_arg(*list, Evas_Coord *);
220 Evas_Coord *y1 = va_arg(*list, Evas_Coord *);
221 Evas_Coord *x2 = va_arg(*list, Evas_Coord *);
222 Evas_Coord *y2 = va_arg(*list, Evas_Coord *);
223
224 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
225 if (x1) *x1 = obj->cur.geometry.x + o->cur.x1;
226 if (y1) *y1 = obj->cur.geometry.y + o->cur.y1;
227 if (x2) *x2 = obj->cur.geometry.x + o->cur.x2;
228 if (y2) *y2 = obj->cur.geometry.y + o->cur.y2;
229}
230
231static void
232_constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED)
233{
234 eo_do_super(eo_obj, eo_constructor());
235
236 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
237 evas_object_line_init(eo_obj);
238}
239
240...
241
242/* class constructor */
243static void
244_class_constructor(Eo_Class *klass)
245{
246 const Eo_Op_Func_Description func_desc[] = {
247 /* Virtual functions of parent class implemented in this class */
248 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
249 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
250 /* Specific functions to this class */
251 EO_OP_FUNC(EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_SET), _line_xy_set),
252 EO_OP_FUNC(EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_GET), _line_xy_get),
253 EO_OP_FUNC_SENTINEL
254 };
255
256 eo_class_funcs_set(klass, func_desc);
257}
258
259/* Descriptions for the functions specific to this class */
260static const Eo_Op_Description op_desc[] = {
261 EO_OP_DESCRIPTION(EVAS_OBJ_LINE_SUB_ID_XY_SET, "Sets the coordinates of the end points of the given evas line object."),
262 EO_OP_DESCRIPTION(EVAS_OBJ_LINE_SUB_ID_XY_GET, "Retrieves the coordinates of the end points of the given evas line object."),
263 EO_OP_DESCRIPTION_SENTINEL
264};
265
266/* Description of the class */
267static const Eo_Class_Description class_desc = {
268 EO_VERSION,
269 "Evas_Object_Line",
270 EO_CLASS_TYPE_REGULAR,
271 EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_LINE_BASE_ID, op_desc, EVAS_OBJ_LINE_SUB_ID_LAST),
272 NULL,
273 sizeof(Evas_Object_Line),
274 _class_constructor,
275 NULL
276};
277
278/* Definition of the class */
279EO_DEFINE_CLASS(evas_object_line_class_get, &class_desc, EVAS_OBJ_CLASS, NULL);
280
diff --git a/doc/eo_tutorial.dox b/doc/eo_tutorial.dox
new file mode 100644
index 0000000000..c30da62e44
--- /dev/null
+++ b/doc/eo_tutorial.dox
@@ -0,0 +1,309 @@
1/**
2 * @page Eo_Tutorial Eo Tutorial
3 *
4 * Purpose:
5 * -------
6 * The purpose of this document is to explain how to work with Eo, how to port your code to Eo and what are the common pitfalls. It doesn't explain how it works inside.
7 *
8 * Description:
9 * -----------
10 * Eo is an Object oriented infrastructure for the EFL. It is a API/ABI safe library.
11 *
12 * It supports inheritance, mixins, interfaces and composite objects.\n
13 * Every class can implement functions from every other class.\n
14 * It supports event signals, function overrides, private/protected/public/etc. variables and functions.
15 *
16 * At the creation of the class, a "virtual table" is filled with the needed functions.\n
17 * The key of this table is a (class id, function id) tuple.
18 *
19 * eo_do is invoked with a list of op ids and their parameters and is in charge to dispatch the relevant functions. Finding the correct function is fast because it is just a lookup table.
20 *
21 * How to use it?
22 * -------------
23 * - Creation of an instance of a class
24 *
25 * - Old way:
26 * @code
27 * object = evas_object_line_add(canvas);
28 * @endcode
29 *
30 * - Eo way:
31 * @code
32 * object = eo_add(EVAS_OBJ_LINE_CLASS, canvas);
33 * @endcode
34 *
35 * - Call to function
36 *
37 * - Old way:
38 * @code
39 * evas_object_move(obj, 120, 120);
40 * evas_object_resize(obj, 200, 200);
41 * @endcode
42 *
43 * - Eo way:
44 * @code
45 * eo_do(obj,
46 * evas_obj_move(120, 120),
47 * evas_obj_resize(200, 200));
48 * @endcode
49 *
50 * - Extract specific data
51 *
52 * - Old way:
53 * @code
54 * Evas_Object_Line *o = (Evas_Object_Line *)(obj->object_data);
55 * MAGIC_CHECK(o, Evas_Object_Line, MAGIC_OBJ_LINE);
56 * return;
57 * MAGIC_CHECK_END();
58 * @endcode
59 *
60 * - Eo way:
61 * @code
62 * Evas_Object_Line *o = eo_data_get(obj, EVAS_OBJ_LINE_CLASS);
63 * if (!o) return;
64 * @endcode
65 *
66 * - Call function of parent
67 * - Old way:
68 * @code
69 * ELM_WIDGET_CLASS(_elm_button_parent_sc)->theme(obj));
70 * @endcode
71 *
72 * - New way:
73 * @code
74 * eo_do_super(obj, elm_wdg_theme(&int_ret));
75 * @endcode
76 *
77 * Important to know:
78 * -----------------
79 * - eo_do is the function used to invoke functions of a specific class on an object.
80 *
81 * - eo_data_get receives an object and a class and returns the data of the given class for the object. The class must belong to the object class hierarchy.
82 *
83 * - eo_isa indicates if a given object is of a given type.
84 *
85 * - eo_do_super is in charge to invoke a function in the next parents that implement it. It is recommended to use eo_do_super only from a function with the same op id.\n
86 * In addition, there is no way to jump over classes who implement the function. If A inherits from B, B from C and A, B and C implement a virtual function defined in C, the function calls order will be A, then B and finally C. It is impossible to pass over B.
87 *
88 * - eo_do returns if the operation succeeded or failed (function found, object deleted...), not the result of the called function. Pay attention to this detail when you call eo_do. The return value needs to be an additional parameter which will hold a return value.
89 *
90 * - Don't do this:
91 * @code
92 * int w, h;
93 * eo_do(obj,
94 * evas_obj_size_get(&w, &h),
95 * evas_obj_size_set(w+10, h+20));
96 * @endcode
97 * w+10 and h+20 are evaluated before the call to size_get.
98 * Instead, separate it in two calls to eo_do.
99 *
100 * - When creating an object with eo_add, the reference counter of this one is incremented. If it is called with a parent, two references are on the object. eo_del removes both of these references.\n
101 * When there is no more references on an object, this one is deleted and then can be freed. The deletion calls to the destructor (see eo_destructor). When done, Eo checks if the object can be freed. The free mechanism can be "disabled" through eo_manual_free_set. If this is the case, it is the responsibility of the developer to call eo_manual_free on the object in order to free it. This mechanism has been used for example in Evas on the Evas objects and in Ecore.
102 *
103 * - When eo_do reaches a function of a class, it is the responsibility of the user to extract from the va_list ALL the parameters needed for this function, NO MORE, NO LESS. Otherwise, unknown behavior can occur. eo_do is called with a list of op id, params, op id, params... A bad extraction of parameters can bring to the parsing of a wrong op id and so in the best case, to an error, in the worst case, to another function not in relation with the actual use case.
104 *
105 * - Always pay attention to:
106 * - the pairing between function id and the function itself. Using the same function for two ids occurs and is hard to debug.
107 * - the definition of the function macros in the H file and their parameters order/type
108 * - to extract all the parameters of a function from the va_list
109 *
110 * - Enum of the op ids in H file and descriptions in C file must be synchronized, i.e same number of ids and same order. If you change the order by adding, removing or moving ids, you break ABI of your library.
111 *
112 * - Avoid exposing your class data to prevent ABI break. Supply access functions instead.
113 *
114 * How to create a class - H side?
115 * ------------------------------
116 * - If the object is new, establish the public APIs
117 * - #define \$(CLASS_NAME) \$(class_name)_class_get(): will be used to access data/inherit from this class...
118 * - const Eo_Class *\$(class_name)_class_get(void) EINA_CONST: declaration of the function that will create the class (not the instance), i.e virtual table...
119 * - extern EAPI Eo_Op \$(CLASS_NAME)_BASE_ID: class id that will be essentially used to identify functions set of this class
120 * - enum of the function ids of the class in the form \$(CLASS_NAME)_SUB_ID: used to identify the function inside the class; function id is unique per class but (class id, function id) is unique per system..
121 * - #define \$(CLASS_NAME)_ID(sub_id) (\$(CLASS_NAME)_BASE_ID + sub_id): formula to calculate the system function id
122 * - define of each function consists of:
123 * - the name of the function that will be used in eo_do
124 * - parameters without types
125 * - \$(CLASS_NAME)_ID(\$(CLASS_NAME)_SUB_ID_FUNCTION
126 * - EO_TYPECHECK for each parameter: type and variable name
127 * - And don't forget to document each function
128 *
129 * - Example (Evas Object Line):
130 * @code
131 * #define EVAS_OBJ_LINE_CLASS evas_object_line_class_get()
132 *
133 * const Eo_Class *evas_object_line_class_get(void) EINA_CONST;
134 *
135 * extern EAPI Eo_Op EVAS_OBJ_LINE_BASE_ID;
136 *
137 * enum
138 * {
139 * EVAS_OBJ_LINE_SUB_ID_XY_SET,
140 * EVAS_OBJ_LINE_SUB_ID_XY_GET,
141 * EVAS_OBJ_LINE_SUB_ID_LAST
142 * }
143 *
144 * #define EVAS_OBJ_LINE_ID(sub_id) (EVAS_OBJ_LINE_BASE_ID + sub_id)
145 *
146 * /*
147 * * @def evas_obj_line_xy_set
148 * * @since 1.8
149 * *
150 * * Sets the coordinates of the end points of the given evas line object.
151 * *
152 * * @param[in] x1
153 * * @param[in] y1
154 * * @param[in] x2
155 * * @param[in] y2
156 * *
157 * */
158 * #define evas_obj_line_xy_set(x1, y1, x2, y2) EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_SET), EO_TYPECHECK(Evas_Coord, x1), EO_TYPECHECK(Evas_Coord, y1), EO_TYPECHECK(Evas_Coord, x2), EO_TYPECHECK(Evas_Coord, y2)
159 *
160 * /*
161 * * @def evas_obj_line_xy_get
162 * * @since 1.8
163 * *
164 * * Retrieves the coordinates of the end points of the given evas line object.
165 * *
166 * * @param[out] x1
167 * * @param[out] y1
168 * * @param[out] x2
169 * * @param[out] y2
170 * *
171 * */
172 * #define evas_obj_line_xy_get(x1, y1, x2, y2) EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_GET), EO_TYPECHECK(Evas_Coord *, x1), EO_TYPECHECK(Evas_Coord *, y1), EO_TYPECHECK(Evas_Coord *, x2), EO_TYPECHECK(Evas_Coord *, y2)
173 @endcode
174 *
175 * How to create a class - C side?
176 * ------------------------------
177 * Below, the object line as example.
178 *
179 * #include "Eo.h"\n
180 * EAPI Eo_Op \$(CLASS_NAME)_BASE_ID = EO_NOOP; // Initialisation of the class id to 0. Will be set dynamically by Eo itself.\n
181 * #define MY_CLASS \$(CLASS_NAME)
182 *
183 * ...
184 *
185 * Example for a developer function called by Eo:\n
186 * This function receives the Eo object, the data corresponding to this class and the list of parameters.
187 * @code
188 * static void
189 * _foo(Eo *eo_obj, void *_pd, va_list *list)
190 * {
191 * int param_1 = va_arg(*list, int);
192 * Eina_Bool param_2 = va_arg(*list, int);
193 * Eina_Bool ret = va_arg(*list, Eina_Bool *);
194 * foo_data obj = _pd;
195 *
196 * if (ret) *ret = EINA_FALSE;
197 * ...
198 * }
199 * @endcode
200 *
201 * You can (not a must) implement a constructor. This constructor MUST call the parent constructor (eo_do_super). It is the same for the destructor.\n
202 * See eo_constructor and eo_destructor.\n
203 * If you don't have anything to do in constructor (like malloc, variables init...) or in destructor (free), don't implement them.
204 *
205 * At the end of the file, you need to describe the class.\n
206 * First, you need to supply the class constructor that sets the list of the functions that are implemented in this class. It includes functions overriden (constructor, destructor, member_add...) and functions specific to this class. If there is no function implemented in this class, you don't need a class constructor.\n
207 * Then, you need a list to describe the new functions. For each one, the op id and a description.\n
208 *
209 * Then, the class itself that consists in:
210 * - the version of Eo, used for backward compatibility
211 * - the class name
212 * - the type of the class:
213 * - regular: an object can be created from this type (mostly used)
214 * - regular non instant-iable: Same as previous, but objects can’t be created from this type (elm_widget)
215 * - interface: used to extend classes, no implementations for functions and no internal data
216 * - mixin : interfaces with internal data and pre-made implementations for functions
217 * - the descriptions list described above and the number of ops for this class
218 * - events
219 * - size of the data of the class
220 * - the class constructor, if exists, else NULL
221 * - the class destructor (NULL most of the time)
222 *
223 * Finally, we define the class with:
224 * - the function name to give to the function that creates/returns the class
225 * - the class description explained above
226 * - the parent and the interfaces/mixins, finished by NULL
227 *
228 *
229 * Example (Evas Object Line):
230 * @code
231 * #include "Eo.h"
232 *
233 * EAPI Eo_Op EVAS_OBJ_LINE_BASE_ID = EO_NOOP;
234 *
235 * #define MY_CLASS EVAS_OBJ_LINE_CLASS
236 * @endcode
237 *
238 * ...
239 *
240 * @code
241 * static void
242 * _line_xy_get(Eo *eo_obj, void *_pd, va_list *list)
243 * {
244 * const Evas_Object_Line *o = _pd;
245 *
246 * Evas_Coord *x1 = va_arg(*list, Evas_Coord *);
247 * Evas_Coord *y1 = va_arg(*list, Evas_Coord *);
248 * Evas_Coord *x2 = va_arg(*list, Evas_Coord *);
249 * Evas_Coord *y2 = va_arg(*list, Evas_Coord *);
250 *
251 * Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
252 * if (x1) *x1 = obj->cur.geometry.x + o->cur.x1;
253 * if (y1) *y1 = obj->cur.geometry.y + o->cur.y1;
254 * if (x2) *x2 = obj->cur.geometry.x + o->cur.x2;
255 * if (y2) *y2 = obj->cur.geometry.y + o->cur.y2;
256 * }
257 *
258 * static void
259 * _constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED)
260 * {
261 * eo_do_super(eo_obj, eo_constructor());
262 *
263 * Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
264 * evas_object_line_init(eo_obj);
265 * }
266 *
267 * ...
268 *
269 * /* class constructor */
270 * static void
271 * _class_constructor(Eo_Class *klass)
272 * {
273 * const Eo_Op_Func_Description func_desc[] = {
274 * /* Virtual functions of parent class implemented in this class */
275 * EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
276 * EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
277 * /* Specific functions to this class */
278 * EO_OP_FUNC(EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_SET), _line_xy_set),
279 * EO_OP_FUNC(EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_GET), _line_xy_get),
280 * EO_OP_FUNC_SENTINEL
281 * };
282 *
283 * eo_class_funcs_set(klass, func_desc);
284 * }
285 *
286 * /* Descriptions for the functions specific to this class */
287 * static const Eo_Op_Description op_desc[] = {
288 * EO_OP_DESCRIPTION(EVAS_OBJ_LINE_SUB_ID_XY_SET, "Sets the coordinates of the end points of the given evas line object."),
289 * EO_OP_DESCRIPTION(EVAS_OBJ_LINE_SUB_ID_XY_GET, "Retrieves the coordinates of the end points of the given evas line object."),
290 * EO_OP_DESCRIPTION_SENTINEL
291 * };
292 *
293 * /* Description of the class */
294 * static const Eo_Class_Description class_desc = {
295 * EO_VERSION,
296 * "Evas_Object_Line",
297 * EO_CLASS_TYPE_REGULAR,
298 * EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_LINE_BASE_ID, op_desc, EVAS_OBJ_LINE_SUB_ID_LAST),
299 * NULL,
300 * sizeof(Evas_Object_Line),
301 * _class_constructor,
302 * NULL
303 * };
304 *
305 * /* Definition of the class */
306 * EO_DEFINE_CLASS(evas_object_line_class_get, &class_desc, EVAS_OBJ_CLASS, NULL);
307 * @endcode
308 */
309