Eobj: Added forgotten docs to eobj_xref/xunref.
[profile/ivi/eobj.git] / lib / Eobj.h
1 #ifndef EOBJ_H
2 #define EOBJ_H
3
4 #include <stdarg.h>
5 #include <Eina.h>
6
7 /**
8  * @defgroup Eobj Eobj Generic Object System
9  *
10  * The Eobj generic object system. It was designed to be the base object
11  * system for the EFL.
12  *
13  * @{
14  */
15
16 /**
17  * @def EOBJ_TYPECHECK(type, x)
18  *
19  * Checks x is castable to type "type" and casts it to it.
20  * @param type The C type to check against.
21  * @param x the variable to test and cast.
22  */
23 #define EOBJ_TYPECHECK(type, x) \
24    ({ \
25     type __x; \
26     __x = x; \
27     (void) __x; \
28     (type) x; \
29     })
30
31 /**
32  * @typedef Eobj
33  * The basic Object type.
34  */
35 typedef struct _Eobj Eobj;
36 /**
37  * @typedef Eobj_Op
38  * The Eobj operation type id.
39  */
40 typedef unsigned int Eobj_Op;
41
42 /**
43  * @def EOBJ_NOOP
44  * A special #Eobj_Op meaning "No operation".
45  */
46 #define EOBJ_NOOP ((Eobj_Op) 0)
47
48 /**
49  * @typedef eobj_op_func_type
50  * The type of the Op functions. This is the type of the functions used by
51  * Eobj.
52  */
53 typedef void (*eobj_op_func_type)(Eobj *, void *class_data, va_list *list);
54
55 /**
56  * @addtogroup Eobj_Events Eobj's Event Handling
57  * @{
58  */
59
60 /**
61  * @struct _Eobj_Event_Description
62  * This struct holds the description of a specific event.
63  */
64 struct _Eobj_Event_Description
65 {
66    const char *name; /**< name of the event. */
67    const char *type; /**< describes the data passed in event_info */
68    const char *doc; /**< Explanation about the event. */
69 };
70
71 /**
72  * @typedef Eobj_Event_Description
73  * A convenience typedef for #_Eobj_Event_Description
74  */
75 typedef struct _Eobj_Event_Description Eobj_Event_Description;
76
77 /**
78  * @def EOBJ_EVENT_DESCRIPTION(name, type, doc)
79  * An helper macro to help populating #Eobj_Event_Description
80  * @param name The name of the event.
81  * @param type The type string of the event.
82  * @param doc Additional doc for the event.
83  * @see Eobj_Event_Description
84  */
85 #define EOBJ_EVENT_DESCRIPTION(name, type, doc) { name, type, doc }
86
87 /**
88  * @}
89  */
90
91 /**
92  * @addtogroup Eobj_Class Eobj Class
93  * @{
94  */
95
96 /**
97  * @typedef Eobj_Class
98  * The basic Object class type.
99  */
100 typedef struct _Eobj_Class Eobj_Class;
101
102 /**
103  * An enum representing the possible types of an Eobj class.
104  */
105 enum _Eobj_Class_Type
106 {
107    EOBJ_CLASS_TYPE_REGULAR = 0, /**< Regular class. */
108    EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT, /**< Regular non instant-able class. */
109    EOBJ_CLASS_TYPE_INTERFACE, /**< Interface */
110    EOBJ_CLASS_TYPE_MIXIN /**< Mixin */
111 };
112
113 /**
114  * @typedef Eobj_Class_Type
115  * A convenience typedef for #_Eobj_Class_Type.
116  */
117 typedef enum _Eobj_Class_Type Eobj_Class_Type;
118
119 /**
120  * @struct _Eobj_Op_Func_Description
121  * Used to associate an Op with a func.
122  * @see eobj_class_funcs_set
123  */
124 struct _Eobj_Op_Func_Description
125 {
126    Eobj_Op op; /**< The op */
127    eobj_op_func_type func; /**< The function to call for the op. */
128 };
129
130 /**
131  * @typedef Eobj_Op_Func_Description
132  * A convenience typedef for #_Eobj_Op_Func_Description
133  */
134 typedef struct _Eobj_Op_Func_Description Eobj_Op_Func_Description;
135
136 /**
137  * @def EOBJ_OP_FUNC(op, func)
138  * A convenience macro to be used when populating the #Eobj_Op_Func_Description
139  * array.
140  */
141 #define EOBJ_OP_FUNC(op, func) { op, func }
142 /**
143  * @def EOBJ_OP_FUNC_SENTINEL
144  * A convenience macro to be used when populating the #Eobj_Op_Func_Description
145  * array. It must appear at the end of the ARRAY.
146  */
147 #define EOBJ_OP_FUNC_SENTINEL { 0, NULL }
148
149 /**
150  * @struct _Eobj_Op_Description
151  * This struct holds the description of a specific op.
152  */
153 struct _Eobj_Op_Description
154 {
155    Eobj_Op sub_op; /**< The sub_id of the op in it's class. */
156    const char *name; /**< The name of the op. */
157    const char *type; /**< descripbes the Op's function signature. */
158    const char *doc; /**< Explanation about the Op. */
159 };
160
161 /**
162  * @typedef Eobj_Op_Description
163  * A convenience typedef for #_Eobj_Op_Description
164  */
165 typedef struct _Eobj_Op_Description Eobj_Op_Description;
166
167 /**
168  * @struct _Eobj_Class_Description
169  * This struct holds the description of a class.
170  * This description should be passed to eobj_class_new.
171  * Please use the #EOBJ_CLASS_DESCRIPTION_OPS macro when populating it.
172  */
173 struct _Eobj_Class_Description
174 {
175    const char *name; /**< The name of the class. */
176    Eobj_Class_Type type; /**< The type of the class. */
177    struct {
178         Eobj_Op *base_op_id;
179         const Eobj_Op_Description *descs;
180         size_t count;
181    } ops; /**< The ops description, should be filled using #EOBJ_CLASS_DESCRIPTION_OPS */
182    const Eobj_Event_Description **events; /**< The event descriptions for this class. */
183    size_t data_size; /**< The size of data (private + protected + public) this class needs per object. */
184    void (*constructor)(Eobj *obj, void *class_data); /**< The constructor of the object. */
185    void (*destructor)(Eobj *obj, void *class_data); /**< The destructor of the object. */
186    void (*class_constructor)(Eobj_Class *klass); /**< The constructor of the class. */
187    void (*class_destructor)(Eobj_Class *klass); /**< The destructor of the class. */
188 };
189
190 /**
191  * @typedef Eobj_Class_Description
192  * A convenience typedef for #_Eobj_Class_Description
193  */
194 typedef struct _Eobj_Class_Description Eobj_Class_Description;
195
196 /**
197  * @def EOBJ_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count)
198  * An helper macro to help populating #Eobj_Class_Description.
199  * @param base_op_id A pointer to the base op id of the class.
200  * @param op_descs the op descriptions array.
201  * @param count the number of ops in the op descriptions array.
202  */
203 #define EOBJ_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) { base_op_id, op_descs, count }
204
205 /**
206  * @def EOBJ_OP_DESCRIPTION(op, type, doc)
207  * An helper macro to help populating #Eobj_Op_Description
208  * @param sub_id The sub id of the op being described.
209  * @param type The type string for the op.
210  * @param doc Additional doc for the op.
211  * @see Eobj_Op_Description
212  * @see EOBJ_OP_DESCRIPTION_SENTINEL
213  */
214 #define EOBJ_OP_DESCRIPTION(sub_id, type, doc) { sub_id, #sub_id, type, doc }
215 /**
216  * @def EOBJ_OP_DESCRIPTION_SENTINEL
217  * An helper macro to help populating #Eobj_Op_Description
218  * Should be placed at the end of the array.
219  * @see Eobj_Op_Description
220  * @see EOBJ_OP_DESCRIPTION
221  */
222 #define EOBJ_OP_DESCRIPTION_SENTINEL { 0, NULL, NULL, NULL }
223
224 /**
225  * @brief Create a new class.
226  * @param desc the class description to create the class with.
227  * @param parent the class to inherit from.
228  * @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects).
229  * @return The new class's handle on success, or NULL otherwise.
230  */
231 EAPI const Eobj_Class *eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ...);
232
233 /**
234  * @brief Sets the OP functions for a class.
235  * @param klass the class to set the functions to.
236  * @param func_descs a NULL terminated array of #Eobj_Op_Func_Description
237  *
238  * Should be called from within the class constructor.
239  */
240 EAPI void eobj_class_funcs_set(Eobj_Class *klass, const Eobj_Op_Func_Description *func_descs);
241
242 /**
243  * @brief Gets the name of the passed class.
244  * @param klass the class to work on.
245  * @return The class's name.
246  *
247  * @see eobj_class_get()
248  */
249 EAPI const char *eobj_class_name_get(const Eobj_Class *klass);
250
251 /**
252  * @}
253  */
254
255 /**
256  * @brief Init the eobj subsystem
257  * @return #EINA_TRUE on success.
258  *
259  * @see eobj_shutfown()
260  */
261 EAPI Eina_Bool eobj_init(void);
262
263 /**
264  * @brief Shutdown the eobj subsystem
265  * @return #EINA_TRUE on success.
266  *
267  * @see eobj_init()
268  */
269 EAPI Eina_Bool eobj_shutdown(void);
270
271 /**
272  * @def eobj_do
273  * A convenience wrapper around eobj_do_internal()
274  * @see eobj_do_internal
275  */
276 #define eobj_do(object, ...) eobj_do_internal(object, __VA_ARGS__, (Eobj_Op) 0)
277
278 /**
279  * @brief Issues ops on an object.
280  * @param obj The object to work on
281  * @param ... NULL terminated list of OPs and parameters.
282  * @return #EINA_TRUE on success.
283  *
284  * Use the helper macros, don't pass the parameters manually.
285  * Use #eobj_do instead of this function.
286  *
287  * @see #eobj_do
288  */
289 EAPI Eina_Bool eobj_do_internal(Eobj *obj, ...);
290
291 /**
292  * @brief Calls the super function for the specific op.
293  * @param obj The object to work on
294  * @param op The wanted op.
295  * @param ... list of parameters.
296  * @return #EINA_TRUE on success.
297  *
298  * Use the helper macros, don't pass the parameters manually.
299  *
300  * @see #eobj_do
301  */
302 EAPI Eina_Bool eobj_do_super(Eobj *obj, Eobj_Op op, ...);
303
304 /**
305  * @brief Gets the class of the object.
306  * @param obj The object to work on
307  * @return The object's class.
308  *
309  * @see eobj_class_name_get()
310  */
311 EAPI const Eobj_Class *eobj_class_get(const Eobj *obj);
312
313 /**
314  * @brief Calls the super constructor of the object passed.
315  * @param obj the object to work on.
316  *
317  * @see eobj_destructor_super()
318  */
319 EAPI void eobj_constructor_super(Eobj *obj);
320
321 /**
322  * @brief Calls the super destructor of the object passed.
323  * @param obj the object to work on.
324  *
325  * @see eobj_constructor_super()
326  */
327 EAPI void eobj_destructor_super(Eobj *obj);
328
329 /**
330  * @brief Notify eobj that there was an error when constructing the object.
331  * @param obj the object to work on.
332  *
333  * (Should only be called from within a constructor/destructor).
334  *
335  * @see eobj_constructor_error_get()
336  */
337 EAPI void eobj_constructor_error_set(Eobj *obj);
338
339 /**
340  * @brief Check if there was an error constructing obj
341  * @param obj the object to work on.
342  * @return #EINA_TRUE if there was an error.
343  *
344  * (Should only be called from within a constructor/destructor).
345  *
346  * @see eobj_constructor_error_set()
347  */
348 EAPI Eina_Bool eobj_constructor_error_get(const Eobj *obj);
349
350 /**
351  * @brief Create a new object.
352  * @param klass the class of the object to create.
353  * @param parent the parent to set to the object.
354  * @return An handle to the new object on success, NULL otherwise.
355  */
356 EAPI Eobj *eobj_add(const Eobj_Class *klass, Eobj *parent);
357
358 /**
359  * @brief Get the parent of an object
360  * @param obj the object to get the parent of.
361  * @return a pointer to the parent object.
362  */
363 EAPI Eobj *eobj_parent_get(Eobj *obj);
364
365 /**
366  * @brief Get a pointer to the data of an object for a specific class.
367  * @param obj the object to work on.
368  * @param klass the klass associated with the data.
369  * @return a pointer to the data.
370  */
371 EAPI void *eobj_data_get(Eobj *obj, const Eobj_Class *klass);
372
373 /**
374  * @brief Increment the object's reference count by 1.
375  * @param obj the object to work on.
376  * @return The object passed.
377  *
378  * @see eobj_unref()
379  * @see eobj_ref_get()
380  */
381 EAPI Eobj *eobj_ref(Eobj *obj);
382
383 /**
384  * @brief Decrement the object's reference count by 1 and free it if needed.
385  * @param obj the object to work on.
386  *
387  * @see eobj_ref()
388  * @see eobj_ref_get()
389  */
390 EAPI void eobj_unref(Eobj *obj);
391
392 /**
393  * @brief Return the ref count of the object passed.
394  * @param obj the object to work on.
395  * @return the ref count of the object.
396  *
397  * @see eobj_ref()
398  * @see eobj_unref()
399  */
400 EAPI int eobj_ref_get(const Eobj *obj);
401
402 /**
403  * @def eobj_xref(obj, ref_obj)
404  * Convenience macro around eobj_xref()
405  * @see eobj_xref()
406  */
407 #define eobj_xref(obj, ref_obj) eobj_xref_internal(obj, ref_obj, __FILE__, __LINE__)
408
409 /**
410  * @brief Increment the object's reference count by 1 (and associate the ref with ref_obj)
411  * @param obj the object to work on.
412  * @param ref_obj the object that references obj.
413  * @param file the call's filename.
414  * @param line the call's line number.
415  * @return The object passed (obj)
416  *
417  * People should not use this function, use #eobj_xref instead.
418  *
419  * @see eobj_xunref()
420  */
421 EAPI Eobj *eobj_xref_internal(Eobj *obj, const Eobj *ref_obj, const char *file, int line);
422
423 /**
424  * @brief Decrement the object's reference count by 1 and free it if needed. Will free the ref associated with ref_obj).
425  * @param obj the object to work on.
426  * @param ref_obj the object that references obj.
427  *
428  * This function only enforces the checks for object association. I.e don't rely
429  * on it. If such enforces are compiled out, this function behaves the same as
430  * eobj_unref().
431  *
432  * @see eobj_xref_internal()
433  */
434 EAPI void eobj_xunref(Eobj *obj, const Eobj *ref_obj);
435
436 /**
437  * @brief Delete the object passed (disregarding ref count).
438  * @param obj the object to work on.
439  *
440  * @see eobj_unref()
441  */
442 EAPI void eobj_del(Eobj *obj);
443
444 /**
445  * @addtogroup Eobj_Weak_Ref Weak reference for Eobj objects.
446  * @{
447  */
448
449 /**
450  * @struct _Eobj_Weak_Ref
451  * This is exposed for performance, please use eobj_weak_ref_get() when you
452  * actually want to get the refed object.
453  */
454 struct _Eobj_Weak_Ref
455 {
456    Eobj *obj; /**< The object being referenced. */
457 };
458
459 /**
460  * @typedef Eobj_Weak_Ref
461  * Weak reference type for Eobj.
462  */
463 typedef struct _Eobj_Weak_Ref Eobj_Weak_Ref;
464
465 /**
466  * @brief Create a new weak reference to obj.
467  * @param obj The object being referenced.
468  * @return A new weak reference.
469  */
470 EAPI Eobj_Weak_Ref *eobj_weak_ref_new(const Eobj *obj);
471
472 /**
473  * @brief Free the weak reference passed.
474  * @param wref the weak reference to free.
475  */
476 EAPI void eobj_weak_ref_free(Eobj_Weak_Ref *wref);
477
478 /**
479  * @brief Get the referenced object from the weak reference.
480  * @param wref the weak reference to get the object from.
481  * @return The object referenced by wref.
482  */
483 static inline Eobj *
484 eobj_weak_ref_get(const Eobj_Weak_Ref *wref)
485 {
486    return wref->obj;
487 }
488
489 /**
490  * @}
491  */
492
493
494 /**
495  * @addtogroup Eobj_Composite_Objects Composite Objects.
496  * @{
497  */
498
499 /**
500  * @brief Make an object a composite object of another.
501  * @param obj the "parent" object.
502  * @param comp_obj the object that will be used to composite obj.
503  *
504  * @see eobj_composite_object_detach()
505  * @see eobj_composite_is()
506  */
507 EAPI void eobj_composite_object_attach(Eobj *obj, Eobj *comp_obj);
508
509 /**
510  * @brief Detach a composite object from another object.
511  * @param obj the "parent" object.
512  * @param comp_obj the object attached to obj.
513  *
514  * @see eobj_composite_object_attach()
515  * @see eobj_composite_is()
516  */
517 EAPI void eobj_composite_object_detach(Eobj *obj, Eobj *comp_obj);
518
519 /**
520  * @brief Check if an object is a composite object.
521  * @param comp_obj the object to be checked.
522  * @return #EINA_TRUE if it is, #EINA_FALSE otherwise.
523  *
524  * @see eobj_composite_object_attach()
525  * @see eobj_composite_object_detach()
526  */
527 EAPI Eina_Bool eobj_composite_is(Eobj *comp_obj);
528
529 /**
530  * @}
531  */
532
533 /**
534  * @addtogroup Eobj_Events Eobj's Event Handling
535  * @{
536  */
537
538 /**
539  * @def EOBJ_CALLBACK_PRIORITY_BEFORE
540  * Slightly more prioritized than default.
541  */
542 #define EOBJ_CALLBACK_PRIORITY_BEFORE -100
543 /**
544  * @def EOBJ_CALLBACK_PRIORITY_DEFAULT
545  * Default callback priority level
546  */
547 #define EOBJ_CALLBACK_PRIORITY_DEFAULT 0
548 /**
549  * @def EOBJ_CALLBACK_PRIORITY_AFTER
550  * Slightly less prioritized than default.
551  */
552 #define EOBJ_CALLBACK_PRIORITY_AFTER 100
553
554 /**
555  * @typedef Eobj_Callback_Priority
556  *
557  * Callback priority value. Range is -32k - 32k. The lower the number, the
558  * higher the priority.
559  *
560  * @see EOBJ_CALLBACK_PRIORITY_AFTER
561  * @see EOBJ_CALLBACK_PRIORITY_BEFORE
562  * @see EOBJ_CALLBACK_PRIORITY_DEFAULT
563  */
564 typedef short Eobj_Callback_Priority;
565
566 /**
567  * @typedef Eobj_Event_Cb
568  *
569  * An event callback prototype.
570  *
571  * @param data The user data registered with the callback.
572  * @param obj The object which initiated the event.
573  * @param desc The event's description.
574  * @param event_info additional data passed with the event.
575  * @return #EINA_FALSE to stop calling additional callbacks for the event, #EINA_TRUE to continue.
576  */
577 typedef Eina_Bool (*Eobj_Event_Cb)(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info);
578
579 /**
580  * @brief Add an event callback forwarder for an event and an object.
581  * @param obj The object to listen to events on.
582  * @param desc The description of the event to listen to.
583  * @param new_obj The object to emit events from.
584  * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
585  *
586  * @see eobj_event_callback_forwarder_del()
587  */
588 EAPI Eina_Bool eobj_event_callback_forwarder_add(Eobj *obj, const Eobj_Event_Description *desc, Eobj *new_obj);
589
590 /**
591  * @brief Remove an event callback forwarder for an event and an object.
592  * @param obj The object to listen to events on.
593  * @param desc The description of the event to listen to.
594  * @param new_obj The object to emit events from.
595  * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
596  *
597  * @see eobj_event_callback_forwarder_add()
598  */
599 EAPI Eina_Bool eobj_event_callback_forwarder_del(Eobj *obj, const Eobj_Event_Description *desc, Eobj *new_obj);
600
601 /**
602  * @def eobj_event_callback_add(obj, desc, cb, data)
603  * Add a callback for an event.
604  * @param obj The object to listen to events on.
605  * @param desc The description of the event to listen to.
606  * @param cb the callback to call.
607  * @param data additional data to pass to the callback.
608  * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
609  *
610  * callbacks of the same priority are called in reverse order of creation.
611  *
612  * @see eobj_event_callback_priority_add()
613  */
614 #define eobj_event_callback_add(obj, desc, cb, data) \
615    eobj_event_callback_priority_add(obj, desc, \
616          EOBJ_CALLBACK_PRIORITY_DEFAULT, cb, data)
617
618 /**
619  * @brief Add a callback for an event with a specific priority.
620  * @param obj The object to listen to events on.
621  * @param desc The description of the event to listen to.
622  * @param priority The priority of the callback.
623  * @param cb the callback to call.
624  * @param data additional data to pass to the callback.
625  * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
626  *
627  * callbacks of the same priority are called in reverse order of creation.
628  *
629  * @see #eobj_event_callback_add
630  */
631 EAPI Eina_Bool eobj_event_callback_priority_add(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Callback_Priority priority, Eobj_Event_Cb cb, const void *data);
632
633 /**
634  * @brief Del a callback for an event
635  * @param obj The object to listen to delete from.
636  * @param desc The description of the event to listen to.
637  * @param func the callback to delete.
638  * @return The additional data that was set to be passed to the callback.
639  *
640  * @see eobj_event_callback_del_full()
641  */
642 EAPI void *eobj_event_callback_del(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Event_Cb func);
643
644 /**
645  * @brief Del a callback with a specific data associated to it for an event.
646  * @param obj The object to listen to delete from.
647  * @param desc The description of the event to listen to.
648  * @param func the callback to delete.
649  * @param user_data The data to compare.
650  * @return The additional data that was set to be passed to the callback.
651  *
652  * @see eobj_event_callback_del()
653  */
654 EAPI void *eobj_event_callback_del_full(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Event_Cb func, const void *user_data);
655
656 /**
657  * @brief Call the callbacks for an event of an object.
658  * @param obj The object to work on.
659  * @param desc The description of the event to call.
660  * @param event_info Extra event info to pass to the callbacks.
661  * @return #EINA_FALSE if one of the callbacks aborted the callback calls or #EINA_TRUE otherwise.
662  */
663 EAPI Eina_Bool eobj_event_callback_call(Eobj *obj, const Eobj_Event_Description *desc, const void *event_info);
664
665 /**
666  * @}
667  */
668
669 /**
670  * @addtogroup Eobj_Class_Base Eobj's Base class.
671  * @{
672  */
673
674 /**
675  * @def EOBJ_BASE_CLASS
676  * The class type for the Eobj base class.
677  */
678 #define EOBJ_BASE_CLASS eobj_base_class_get()
679 /**
680  * @brief Use #EOBJ_BASE_CLASS
681  * @internal
682  * */
683 EAPI const Eobj_Class *eobj_base_class_get(void) EINA_CONST;
684
685 /**
686  * @typedef eobj_base_data_free_func
687  * Data free func prototype.
688  */
689 typedef void (*eobj_base_data_free_func)(void *);
690
691 /**
692  * @var EOBJ_BASE_BASE_ID
693  * #EOBJ_BASE_CLASS 's base id.
694  */
695 extern EAPI Eobj_Op EOBJ_BASE_BASE_ID;
696
697 enum {
698      EOBJ_BASE_SUB_ID_DATA_SET,
699      EOBJ_BASE_SUB_ID_DATA_GET,
700      EOBJ_BASE_SUB_ID_DATA_DEL,
701      EOBJ_BASE_SUB_ID_LAST
702 };
703
704 /**
705  * @def EOBJ_BASE_ID(sub_id)
706  * Helper macro to get the full Op ID out of the sub_id for EOBJ_BASE.
707  * @param sub_id the sub id inside EOBJ_BASE.
708  */
709 #define EOBJ_BASE_ID(sub_id) (EOBJ_BASE_BASE_ID + sub_id)
710
711 /**
712  * @def EOBJ_BASE_DATA_SET(key, data, free_func)
713  * Set generic data to object.
714  * @param key the key associated with the data
715  * @param data the data to set.
716  * @param free_func the func to free data with (NULL means "do nothing").
717  *
718  * @see #EOBJ_BASE_DATA_GET
719  * @see #EOBJ_BASE_DATA_DEL
720  */
721 #define EOBJ_BASE_DATA_SET(key, data, free_func) EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_SET), EOBJ_TYPECHECK(const char *, key), EOBJ_TYPECHECK(const void *, data), EOBJ_TYPECHECK(eobj_base_data_free_func, free_func)
722
723 /**
724  * @def EOBJ_BASE_DATA_GET(key, data)
725  * Get generic data from object.
726  * @param key the key associated with the data
727  * @param data the data for the key
728  *
729  * @see #EOBJ_BASE_DATA_SET
730  * @see #EOBJ_BASE_DATA_DEL
731  */
732 #define EOBJ_BASE_DATA_GET(key, data) EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_GET), EOBJ_TYPECHECK(const char *, key), EOBJ_TYPECHECK(void **, data)
733
734 /**
735  * @def EOBJ_BASE_DATA_DEL(key)
736  * Del generic data from object.
737  * @param key the key associated with the data
738  *
739  * @see #EOBJ_BASE_DATA_SET
740  * @see #EOBJ_BASE_DATA_GET
741  */
742 #define EOBJ_BASE_DATA_DEL(key) EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_DEL), EOBJ_TYPECHECK(const char *, key)
743
744 /**
745  * @var _EOBJ_EV_CALLBACK_ADD
746  * see EOBJ_EV_CALLBACK_ADD
747  */
748 EAPI extern const Eobj_Event_Description _EOBJ_EV_CALLBACK_ADD;
749
750 /**
751  * @def EOBJ_EV_CALLBACK_ADD
752  * The event description (of type #Eobj_Event_Description) for
753  * The "Callback listener added" event.
754  */
755 #define EOBJ_EV_CALLBACK_ADD (&(_EOBJ_EV_CALLBACK_ADD))
756
757 /**
758  * @var _EOBJ_EV_CALLBACK_DEL
759  * see EOBJ_EV_CALLBACK_DEL
760  */
761 EAPI extern const Eobj_Event_Description _EOBJ_EV_CALLBACK_DEL;
762
763 /**
764  * @def EOBJ_EV_CALLBACK_DEL
765  * The event description (of type #Eobj_Event_Description) for
766  * The "Callback listener deleted" event.
767  */
768 #define EOBJ_EV_CALLBACK_DEL (&(_EOBJ_EV_CALLBACK_DEL))
769
770 /**
771  * @var _EOBJ_EV_FREE
772  * see #EOBJ_EV_FREE
773  */
774 EAPI extern const Eobj_Event_Description _EOBJ_EV_FREE;
775
776 /**
777  * @def EOBJ_EV_FREE
778  * Object is being freed.
779  */
780 #define EOBJ_EV_FREE (&(_EOBJ_EV_FREE))
781
782 /**
783  * @var _EOBJ_EV_DEL
784  * see #EOBJ_EV_DEL
785  */
786 EAPI extern const Eobj_Event_Description _EOBJ_EV_DEL;
787
788 /**
789  * @def EOBJ_EV_DEL
790  * Object is being deleted.
791  */
792 #define EOBJ_EV_DEL (&(_EOBJ_EV_DEL))
793
794 /**
795  * @}
796  */
797
798 /**
799  * @}
800  */
801
802 #endif