14 # define EAPI __declspec(dllexport)
17 # endif /* ! DLL_EXPORT */
19 # define EAPI __declspec(dllimport)
20 # endif /* ! EFL_EO_BUILD */
24 # define EAPI __attribute__ ((visibility("default")))
34 * @var _eo_class_creation_lock
35 * This variable is used for locking purposes in the class_get function
36 * defined in #EO_DEFINE_CLASS.
37 * This is just to work around the fact that we need to init locks before
39 * Don't touch it if you don't know what you are doing.
42 EAPI extern Eina_Lock _eo_class_creation_lock;
45 * @defgroup Eo Eo Generic Object System
47 * The Eo generic object system. It was designed to be the base object
54 * @def EO_TYPECHECK(type, x)
56 * Checks x is castable to type "type" and casts it to it.
57 * @param type The C type to check against.
58 * @param x the variable to test and cast.
60 #define EO_TYPECHECK(type, x) \
69 * The basic Object type.
71 typedef struct _Eo Eo;
74 * The Eo operation type id.
76 typedef unsigned int Eo_Op;
80 * A special #Eo_Op meaning "No operation".
82 #define EO_NOOP ((Eo_Op) 0)
85 * @typedef eo_op_func_type
86 * The type of the Op functions. This is the type of the functions used by
89 * @see eo_op_func_type_const
91 typedef void (*eo_op_func_type)(Eo *, void *class_data, va_list *list);
94 * @typedef eo_op_func_type_const
95 * The type of the const Op functions. This is the type of the functions used
96 * by Eo. This is the same as #eo_op_func_type, except that this should
97 * be used with functions that don't modify the data.
99 * @see eo_op_func_type
101 typedef void (*eo_op_func_type_const)(const Eo *, const void *class_data, va_list *list);
104 * @addtogroup Eo_Events Eo's Event Handling
109 * @struct _Eo_Event_Description
110 * This struct holds the description of a specific event.
112 struct _Eo_Event_Description
114 const char *name; /**< name of the event. */
115 const char *type; /**< describes the data passed in event_info */
116 const char *doc; /**< Explanation about the event. */
120 * @typedef Eo_Event_Description
121 * A convenience typedef for #_Eo_Event_Description
123 typedef struct _Eo_Event_Description Eo_Event_Description;
126 * @def EO_EVENT_DESCRIPTION(name, type, doc)
127 * An helper macro to help populating #Eo_Event_Description
128 * @param name The name of the event.
129 * @param type The type string of the event.
130 * @param doc Additional doc for the event.
131 * @see Eo_Event_Description
133 #define EO_EVENT_DESCRIPTION(name, type, doc) { name, type, doc }
140 * @addtogroup Eo_Class Eo Class
146 * The basic Object class type.
148 typedef struct _Eo_Class Eo_Class;
151 * @def EO_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...)
152 * A convenience macro to be used for creating the class_get function. This
153 * macro is fairly simple but should still be used as it'll let us improve
155 * @param class_get_func_name the name of the wanted class_get function name.
156 * @param class_desc the class description.
157 * @param parent_class The parent class for the function. Look at eo_class_new() for more information.
158 * @param ... List of etxensions. Look at eo_class_new() for more information.
160 * You must use this macro if you want thread safety in class creation.
162 #define EO_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) \
163 EAPI const Eo_Class * \
164 class_get_func_name(void) \
166 static volatile char lk_init = 0; \
167 static Eina_Lock _my_lock; \
168 static const Eo_Class * volatile _my_class = NULL; \
169 if (EINA_LIKELY(!!_my_class)) return _my_class; \
171 eina_lock_take(&_eo_class_creation_lock); \
173 eina_lock_new(&_my_lock); \
174 if (lk_init < 2) eina_lock_take(&_my_lock); \
179 if (lk_init < 2) eina_lock_release(&_my_lock); \
180 eina_lock_release(&_eo_class_creation_lock); \
183 eina_lock_release(&_eo_class_creation_lock); \
184 _my_class = eo_class_new(class_desc, parent_class, __VA_ARGS__); \
185 eina_lock_release(&_my_lock); \
187 eina_lock_take(&_eo_class_creation_lock); \
188 eina_lock_free(&_my_lock); \
190 eina_lock_release(&_eo_class_creation_lock); \
196 * An enum representing the possible types of an Eo class.
200 EO_CLASS_TYPE_REGULAR = 0, /**< Regular class. */
201 EO_CLASS_TYPE_REGULAR_NO_INSTANT, /**< Regular non instant-able class. */
202 EO_CLASS_TYPE_INTERFACE, /**< Interface */
203 EO_CLASS_TYPE_MIXIN /**< Mixin */
207 * @typedef Eo_Class_Type
208 * A convenience typedef for #_Eo_Class_Type.
210 typedef enum _Eo_Class_Type Eo_Class_Type;
213 * @struct _Eo_Op_Func_Description
214 * Used to associate an Op with a func.
215 * @see eo_class_funcs_set
217 struct _Eo_Op_Func_Description
219 Eo_Op op; /**< The op */
220 eo_op_func_type func; /**< The function to call for the op. */
221 Eina_Bool constant; /**< @c EINA_TRUE if this function is a const. */
225 * @typedef Eo_Op_Func_Description
226 * A convenience typedef for #_Eo_Op_Func_Description
228 typedef struct _Eo_Op_Func_Description Eo_Op_Func_Description;
231 * @def EO_OP_FUNC(op, func)
232 * A convenience macro to be used when populating the #Eo_Op_Func_Description
235 * @see EO_OP_FUNC_CONST
237 #define EO_OP_FUNC(op, func) { op, EO_TYPECHECK(eo_op_func_type, func), EINA_FALSE }
240 * @def EO_OP_FUNC_CONST(op, func)
241 * A convenience macro to be used when populating the #Eo_Op_Func_Description
243 * The same as #EO_OP_FUNC but for const functions.
247 #define EO_OP_FUNC_CONST(op, func) { op, (eo_op_func_type) EO_TYPECHECK(eo_op_func_type_const, func), EINA_TRUE }
250 * @def EO_OP_FUNC_SENTINEL
251 * A convenience macro to be used when populating the #Eo_Op_Func_Description
252 * array. It must appear at the end of the ARRAY.
254 #define EO_OP_FUNC_SENTINEL { 0, NULL, EINA_FALSE }
257 * @struct _Eo_Op_Description
258 * This struct holds the description of a specific op.
260 struct _Eo_Op_Description
262 Eo_Op sub_op; /**< The sub_id of the op in it's class. */
263 const char *name; /**< The name of the op. */
264 const char *type; /**< descripbes the Op's function signature. */
265 const char *doc; /**< Explanation about the Op. */
266 Eina_Bool constant; /**< @c EINA_TRUE if this op's implementation should not change the obj. */
270 * @typedef Eo_Op_Description
271 * A convenience typedef for #_Eo_Op_Description
273 typedef struct _Eo_Op_Description Eo_Op_Description;
276 * @struct _Eo_Class_Description
277 * This struct holds the description of a class.
278 * This description should be passed to eo_class_new.
279 * Please use the #EO_CLASS_DESCRIPTION_OPS macro when populating it.
281 struct _Eo_Class_Description
283 const char *name; /**< The name of the class. */
284 Eo_Class_Type type; /**< The type of the class. */
287 const Eo_Op_Description *descs;
289 } ops; /**< The ops description, should be filled using #EO_CLASS_DESCRIPTION_OPS */
290 const Eo_Event_Description **events; /**< The event descriptions for this class. */
291 size_t data_size; /**< The size of data (private + protected + public) this class needs per object. */
292 void (*constructor)(Eo *obj, void *class_data); /**< The constructor of the object. */
293 void (*destructor)(Eo *obj, void *class_data); /**< The destructor of the object. */
294 void (*class_constructor)(Eo_Class *klass); /**< The constructor of the class. */
295 void (*class_destructor)(Eo_Class *klass); /**< The destructor of the class. */
299 * @typedef Eo_Class_Description
300 * A convenience typedef for #_Eo_Class_Description
302 typedef struct _Eo_Class_Description Eo_Class_Description;
305 * @def EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count)
306 * An helper macro to help populating #Eo_Class_Description.
307 * @param base_op_id A pointer to the base op id of the class.
308 * @param op_descs the op descriptions array.
309 * @param count the number of ops in the op descriptions array.
311 #define EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) { base_op_id, op_descs, count }
314 * @def EO_OP_DESCRIPTION(op, type, doc)
315 * An helper macro to help populating #Eo_Op_Description
316 * @param sub_id The sub id of the op being described.
317 * @param type The type string for the op.
318 * @param doc Additional doc for the op.
319 * @see Eo_Op_Description
320 * @see EO_OP_DESCRIPTION_CONST
321 * @see EO_OP_DESCRIPTION_SENTINEL
323 #define EO_OP_DESCRIPTION(sub_id, type, doc) { sub_id, #sub_id, type, doc, EINA_FALSE }
326 * @def EO_OP_DESCRIPTION_CONST(op, type, doc)
327 * An helper macro to help populating #Eo_Op_Description
328 * This macro is the same as EO_OP_DESCRIPTION but indicates that the op's
329 * implementation should not change the object.
330 * @param sub_id The sub id of the op being described.
331 * @param type The type string for the op.
332 * @param doc Additional doc for the op.
333 * @see Eo_Op_Description
334 * @see EO_OP_DESCRIPTION
335 * @see EO_OP_DESCRIPTION_SENTINEL
337 #define EO_OP_DESCRIPTION_CONST(sub_id, type, doc) { sub_id, #sub_id, type, doc, EINA_TRUE }
340 * @def EO_OP_DESCRIPTION_SENTINEL
341 * An helper macro to help populating #Eo_Op_Description
342 * Should be placed at the end of the array.
343 * @see Eo_Op_Description
344 * @see EO_OP_DESCRIPTION
346 #define EO_OP_DESCRIPTION_SENTINEL { 0, NULL, NULL, NULL, EINA_FALSE }
349 * @brief Create a new class.
350 * @param desc the class description to create the class with.
351 * @param parent the class to inherit from.
352 * @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects).
353 * @return The new class's handle on success, or NULL otherwise.
355 * You should use #EO_DEFINE_CLASS. It'll provide thread safety and other
358 * @see #EO_DEFINE_CLASS
360 EAPI const Eo_Class *eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent, ...);
363 * @brief Sets the OP functions for a class.
364 * @param klass the class to set the functions to.
365 * @param func_descs a NULL terminated array of #Eo_Op_Func_Description
367 * Should be called from within the class constructor.
369 EAPI void eo_class_funcs_set(Eo_Class *klass, const Eo_Op_Func_Description *func_descs);
372 * @brief Gets the name of the passed class.
373 * @param klass the class to work on.
374 * @return The class's name.
376 * @see eo_class_get()
378 EAPI const char *eo_class_name_get(const Eo_Class *klass);
385 * @brief Init the eo subsystem
386 * @return @c EINA_TRUE on success.
390 EAPI Eina_Bool eo_init(void);
393 * @brief Shutdown the eo subsystem
394 * @return @c EINA_TRUE on success.
398 EAPI Eina_Bool eo_shutdown(void);
402 * A convenience wrapper around eo_do_internal()
403 * @see eo_do_internal
405 #define eo_do(obj, ...) eo_do_internal(obj, EINA_FALSE, __VA_ARGS__, EO_NOOP)
409 * Same as #eo_do but only for const ops.
412 #define eo_query(obj, ...) eo_do_internal((Eo *) EO_TYPECHECK(const Eo *, obj), EINA_TRUE, __VA_ARGS__, EO_NOOP)
415 * @brief Issues ops on an object.
416 * @param obj The object to work on
417 * @param constant @c EINA_TRUE if this call is on a constant object.
418 * @param ... NULL terminated list of OPs and parameters.
419 * @return @c EINA_TRUE on success.
421 * Use the helper macros, don't pass the parameters manually.
422 * Use #eo_do instead of this function.
426 EAPI Eina_Bool eo_do_internal(Eo *obj, Eina_Bool constant, ...);
429 * @brief Calls the super function for the specific op.
430 * @param obj The object to work on
431 * @param ... list of parameters.
432 * @return @c EINA_TRUE on success.
434 * Unlike eo_do() and eo_query(), this function only accepts one op.
436 * Use the helper macros, don't pass the parameters manually.
438 * Same as eo_do_super() just for const objects.
443 #define eo_query_super(obj, ...) eo_do_super_internal((Eo *) EO_TYPECHECK(const Eo *, obj), EINA_TRUE, __VA_ARGS__)
446 * @brief Calls the super function for the specific op.
447 * @param obj The object to work on
448 * @param ... list of parameters.
449 * @return @c EINA_TRUE on success.
451 * Unlike eo_do() and eo_query(), this function only accepts one op.
454 * @see eo_query_super()
456 #define eo_do_super(obj, ...) eo_do_super_internal(obj, EINA_FALSE, __VA_ARGS__)
459 * @brief Calls the super function for the specific op.
460 * @param obj The object to work on
461 * @param constant @c EINA_TRUE if this call is on a constant object.
462 * @param op The wanted op.
463 * @param ... list of parameters.
464 * @return @c EINA_TRUE on success.
466 * Don't use this function, use the wrapping macros instead.
470 * @see #eo_query_super
472 EAPI Eina_Bool eo_do_super_internal(Eo *obj, Eina_Bool constant, Eo_Op op, ...);
475 * @brief Gets the class of the object.
476 * @param obj The object to work on
477 * @return The object's class.
479 * @see eo_class_name_get()
481 EAPI const Eo_Class *eo_class_get(const Eo *obj);
484 * @brief Calls the super constructor of the object passed.
485 * @param obj the object to work on.
487 * @see eo_destructor_super()
489 EAPI void eo_constructor_super(Eo *obj);
492 * @brief Calls the super destructor of the object passed.
493 * @param obj the object to work on.
495 * @see eo_constructor_super()
497 EAPI void eo_destructor_super(Eo *obj);
500 * @brief Notify eo that there was an error when constructing the object.
501 * @param obj the object to work on.
503 * (Should only be called from within a constructor/destructor).
505 * @see eo_constructor_error_get()
507 EAPI void eo_constructor_error_set(Eo *obj);
510 * @brief Check if there was an error constructing obj
511 * @param obj the object to work on.
512 * @return @c EINA_TRUE if there was an error.
514 * (Should only be called from within a constructor/destructor).
516 * @see eo_constructor_error_set()
518 EAPI Eina_Bool eo_constructor_error_get(const Eo *obj);
521 * @brief Create a new object.
522 * @param klass the class of the object to create.
523 * @param parent the parent to set to the object.
524 * @return An handle to the new object on success, NULL otherwise.
526 EAPI Eo *eo_add(const Eo_Class *klass, Eo *parent);
529 * @brief Get the parent of an object
530 * @param obj the object to get the parent of.
531 * @return a pointer to the parent object.
533 EAPI Eo *eo_parent_get(const Eo *obj);
536 * @brief Get a pointer to the data of an object for a specific class.
537 * @param obj the object to work on.
538 * @param klass the klass associated with the data.
539 * @return a pointer to the data.
541 EAPI void *eo_data_get(const Eo *obj, const Eo_Class *klass);
544 * @brief Increment the object's reference count by 1.
545 * @param obj the object to work on.
546 * @return The object passed.
548 * It's very easy to get a refcount leak and start leaking memory because
549 * of a forgotten unref or an extra ref. That is why there are eo_xref
550 * and eo_xunref that will make debugging easier in such a case.
551 * Therefor, these functions should only be used in small scopes, i.e at the
552 * start of some section in which the object may get freed, or if you know
553 * what you are doing.
558 EAPI Eo *eo_ref(Eo *obj);
561 * @brief Decrement the object's reference count by 1 and free it if needed.
562 * @param obj the object to work on.
567 EAPI void eo_unref(Eo *obj);
570 * @brief Return the ref count of the object passed.
571 * @param obj the object to work on.
572 * @return the ref count of the object.
577 EAPI int eo_ref_get(const Eo *obj);
580 * @def eo_xref(obj, ref_obj)
581 * Convenience macro around eo_xref_internal()
584 #define eo_xref(obj, ref_obj) eo_xref_internal(obj, ref_obj, __FILE__, __LINE__)
587 * @brief Increment the object's reference count by 1 (and associate the ref with ref_obj)
588 * @param obj the object to work on.
589 * @param ref_obj the object that references obj.
590 * @param file the call's filename.
591 * @param line the call's line number.
592 * @return The object passed (obj)
594 * People should not use this function, use #eo_xref instead.
595 * A compile flag my make it and eobj_xunref() behave the same as eobj_ref()
596 * and eobj_unref() respectively. So this should be used wherever possible.
600 EAPI Eo *eo_xref_internal(Eo *obj, const Eo *ref_obj, const char *file, int line);
603 * @brief Decrement the object's reference count by 1 and free it if needed. Will free the ref associated with ref_obj).
604 * @param obj the object to work on.
605 * @param ref_obj the object that references obj.
607 * This function only enforces the checks for object association. I.e don't rely
608 * on it. If such enforces are compiled out, this function behaves the same as
611 * @see eo_xref_internal()
613 EAPI void eo_xunref(Eo *obj, const Eo *ref_obj);
616 * @brief Delete the object passed (disregarding ref count).
617 * @param obj the object to work on.
621 EAPI void eo_del(Eo *obj);
624 * @addtogroup Eo_Composite_Objects Composite Objects.
629 * @brief Make an object a composite object of another.
630 * @param obj the "parent" object.
631 * @param comp_obj the object that will be used to composite obj.
633 * @see eo_composite_object_detach()
634 * @see eo_composite_is()
636 EAPI void eo_composite_object_attach(Eo *obj, Eo *comp_obj);
639 * @brief Detach a composite object from another object.
640 * @param obj the "parent" object.
641 * @param comp_obj the object attached to obj.
643 * @see eo_composite_object_attach()
644 * @see eo_composite_is()
646 EAPI void eo_composite_object_detach(Eo *obj, Eo *comp_obj);
649 * @brief Check if an object is a composite object.
650 * @param comp_obj the object to be checked.
651 * @return @c EINA_TRUE if it is, @c EINA_FALSE otherwise.
653 * @see eo_composite_object_attach()
654 * @see eo_composite_object_detach()
656 EAPI Eina_Bool eo_composite_is(Eo *comp_obj);
663 * @addtogroup Eo_Events Eo's Event Handling
668 * @def EO_CALLBACK_PRIORITY_BEFORE
669 * Slightly more prioritized than default.
671 #define EO_CALLBACK_PRIORITY_BEFORE -100
673 * @def EO_CALLBACK_PRIORITY_DEFAULT
674 * Default callback priority level
676 #define EO_CALLBACK_PRIORITY_DEFAULT 0
678 * @def EO_CALLBACK_PRIORITY_AFTER
679 * Slightly less prioritized than default.
681 #define EO_CALLBACK_PRIORITY_AFTER 100
684 * @typedef Eo_Callback_Priority
686 * Callback priority value. Range is -32k - 32k. The lower the number, the
687 * higher the priority.
689 * @see EO_CALLBACK_PRIORITY_AFTER
690 * @see EO_CALLBACK_PRIORITY_BEFORE
691 * @see EO_CALLBACK_PRIORITY_DEFAULT
693 typedef short Eo_Callback_Priority;
696 * @def EO_CALLBACK_STOP
697 * Stop calling callbacks for the even of which the callback was called for.
698 * @see EO_CALLBACK_CONTINUE
700 #define EO_CALLBACK_STOP EINA_FALSE
703 * @def EO_CALLBACK_CONTINUE
704 * Continue calling callbacks for the even of which the callback was called for.
705 * @see EO_CALLBACK_STOP
707 #define EO_CALLBACK_CONTINUE EINA_TRUE
710 * @typedef Eo_Event_Cb
712 * An event callback prototype.
714 * @param data The user data registered with the callback.
715 * @param obj The object which initiated the event.
716 * @param desc The event's description.
717 * @param event_info additional data passed with the event.
718 * @return #EO_CALLBACK_STOP to stop calling additional callbacks for the event, #EO_CALLBACK_CONTINUE to continue.
720 typedef Eina_Bool (*Eo_Event_Cb)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
723 * @brief Add an event callback forwarder for an event and an object.
724 * @param obj The object to listen to events on.
725 * @param desc The description of the event to listen to.
726 * @param new_obj The object to emit events from.
727 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
729 * @see eo_event_callback_forwarder_del()
731 EAPI Eina_Bool eo_event_callback_forwarder_add(Eo *obj, const Eo_Event_Description *desc, Eo *new_obj);
734 * @brief Remove an event callback forwarder for an event and an object.
735 * @param obj The object to listen to events on.
736 * @param desc The description of the event to listen to.
737 * @param new_obj The object to emit events from.
738 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
740 * @see eo_event_callback_forwarder_add()
742 EAPI Eina_Bool eo_event_callback_forwarder_del(Eo *obj, const Eo_Event_Description *desc, Eo *new_obj);
745 * @def eo_event_callback_add(obj, desc, cb, data)
746 * Add a callback for an event.
747 * @param obj The object to listen to events on.
748 * @param desc The description of the event to listen to.
749 * @param cb the callback to call.
750 * @param data additional data to pass to the callback.
751 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
753 * callbacks of the same priority are called in reverse order of creation.
755 * @see eo_event_callback_priority_add()
757 #define eo_event_callback_add(obj, desc, cb, data) \
758 eo_event_callback_priority_add(obj, desc, \
759 EO_CALLBACK_PRIORITY_DEFAULT, cb, data)
762 * @brief Add a callback for an event with a specific priority.
763 * @param obj The object to listen to events on.
764 * @param desc The description of the event to listen to.
765 * @param priority The priority of the callback.
766 * @param cb the callback to call.
767 * @param data additional data to pass to the callback.
768 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
770 * callbacks of the same priority are called in reverse order of creation.
772 * @see #eo_event_callback_add
774 EAPI Eina_Bool eo_event_callback_priority_add(Eo *obj, const Eo_Event_Description *desc, Eo_Callback_Priority priority, Eo_Event_Cb cb, const void *data);
777 * @brief Del a callback for an event
778 * @param obj The object to listen to delete from.
779 * @param desc The description of the event to listen to.
780 * @param func the callback to delete.
781 * @return The additional data that was set to be passed to the callback.
783 * @see eo_event_callback_del()
785 EAPI void *eo_event_callback_del_lazy(Eo *obj, const Eo_Event_Description *desc, Eo_Event_Cb func);
788 * @brief Del a callback with a specific data associated to it for an event.
789 * @param obj The object to listen to delete from.
790 * @param desc The description of the event to listen to.
791 * @param func the callback to delete.
792 * @param user_data The data to compare.
793 * @return The additional data that was set to be passed to the callback.
795 * @see eo_event_callback_del_lazy()
797 EAPI void *eo_event_callback_del(Eo *obj, const Eo_Event_Description *desc, Eo_Event_Cb func, const void *user_data);
800 * @brief Call the callbacks for an event of an object.
801 * @param obj The object to work on.
802 * @param desc The description of the event to call.
803 * @param event_info Extra event info to pass to the callbacks.
804 * @return @c EINA_FALSE if one of the callbacks aborted the callback calls or @c EINA_TRUE otherwise.
806 EAPI Eina_Bool eo_event_callback_call(Eo *obj, const Eo_Event_Description *desc, const void *event_info);
813 * @addtogroup Eo_Class_Base Eo's Base class.
819 * The class type for the Eo base class.
821 #define EO_BASE_CLASS eo_base_class_get()
823 * @brief Use #EO_BASE_CLASS
826 EAPI const Eo_Class *eo_base_class_get(void) EINA_CONST;
829 * @typedef eo_base_data_free_func
830 * Data free func prototype.
832 typedef void (*eo_base_data_free_func)(void *);
835 * @var EO_BASE_BASE_ID
836 * #EO_BASE_CLASS 's base id.
838 extern EAPI Eo_Op EO_BASE_BASE_ID;
841 EO_BASE_SUB_ID_DATA_SET,
842 EO_BASE_SUB_ID_DATA_GET,
843 EO_BASE_SUB_ID_DATA_DEL,
844 EO_BASE_SUB_ID_WREF_ADD,
845 EO_BASE_SUB_ID_WREF_DEL,
850 * @def EO_BASE_ID(sub_id)
851 * Helper macro to get the full Op ID out of the sub_id for EO_BASE.
852 * @param sub_id the sub id inside EO_BASE.
854 #define EO_BASE_ID(sub_id) (EO_BASE_BASE_ID + sub_id)
857 * @def eo_base_data_set(key, data, free_func)
858 * Set generic data to object.
859 * @param[in] key the key associated with the data
860 * @param[in] data the data to set.
861 * @param[in] free_func the func to free data with (NULL means "do nothing").
863 * @see #eo_base_data_get
864 * @see #eo_base_data_del
866 #define eo_base_data_set(key, data, free_func) EO_BASE_ID(EO_BASE_SUB_ID_DATA_SET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(const void *, data), EO_TYPECHECK(eo_base_data_free_func, free_func)
869 * @def eo_base_data_get(key, data)
870 * Get generic data from object.
871 * @param[in] key the key associated with the data
872 * @param[out] data the data for the key
874 * @see #eo_base_data_set
875 * @see #eo_base_data_del
877 #define eo_base_data_get(key, data) EO_BASE_ID(EO_BASE_SUB_ID_DATA_GET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(void **, data)
880 * @def eo_base_data_del(key)
881 * Del generic data from object.
882 * @param[in] key the key associated with the data
884 * @see #eo_base_data_set
885 * @see #eo_base_data_get
887 #define eo_base_data_del(key) EO_BASE_ID(EO_BASE_SUB_ID_DATA_DEL), EO_TYPECHECK(const char *, key)
891 * @brief Add a new weak reference to obj.
892 * @param wref The pointer to use for the weak ref.
894 * This function registers the object handle pointed by wref to obj so when
895 * obj is deleted it'll be updated to NULL. This functions should be used
896 * when you want to keep track of an object in a safe way, but you don't want
897 * to prevent it from being freed.
901 #define eo_wref_add(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_ADD), EO_TYPECHECK(Eo **, wref)
905 * @brief Delete the weak reference passed.
906 * @param wref the weak reference to free.
910 #define eo_wref_del(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_DEL), EO_TYPECHECK(Eo **, wref)
913 * @def eo_wref_del_safe
914 * @brief Delete the weak reference passed.
915 * @param wref the weak reference to free.
917 * Same as eo_wref_del(), with the different that it's not called from eobj_do()
918 * so you don't need to check if *wref is not NULL.
922 #define eo_wref_del_safe(wref) \
924 if (*wref) eo_do(*wref, eo_wref_del(wref)); \
928 * @var _EO_EV_CALLBACK_ADD
929 * see EO_EV_CALLBACK_ADD
931 EAPI extern const Eo_Event_Description _EO_EV_CALLBACK_ADD;
934 * @def EO_EV_CALLBACK_ADD
935 * The event description (of type #Eo_Event_Description) for
936 * The "Callback listener added" event.
938 #define EO_EV_CALLBACK_ADD (&(_EO_EV_CALLBACK_ADD))
941 * @var _EO_EV_CALLBACK_DEL
942 * see EO_EV_CALLBACK_DEL
944 EAPI extern const Eo_Event_Description _EO_EV_CALLBACK_DEL;
947 * @def EO_EV_CALLBACK_DEL
948 * The event description (of type #Eo_Event_Description) for
949 * The "Callback listener deleted" event.
951 #define EO_EV_CALLBACK_DEL (&(_EO_EV_CALLBACK_DEL))
957 EAPI extern const Eo_Event_Description _EO_EV_FREE;
961 * Object is being freed.
963 #define EO_EV_FREE (&(_EO_EV_FREE))
969 EAPI extern const Eo_Event_Description _EO_EV_DEL;
973 * Object is being deleted.
975 #define EO_EV_DEL (&(_EO_EV_DEL))