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((Eo *) EO_TYPECHECK(const Eo *, 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(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()
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.
598 EAPI Eo *eo_xref_internal(Eo *obj, const Eo *ref_obj, const char *file, int line);
601 * @brief Decrement the object's reference count by 1 and free it if needed. Will free the ref associated with ref_obj).
602 * @param obj the object to work on.
603 * @param ref_obj the object that references obj.
605 * This function only enforces the checks for object association. I.e don't rely
606 * on it. If such enforces are compiled out, this function behaves the same as
609 * @see eo_xref_internal()
611 EAPI void eo_xunref(Eo *obj, const Eo *ref_obj);
614 * @brief Delete the object passed (disregarding ref count).
615 * @param obj the object to work on.
619 EAPI void eo_del(Eo *obj);
622 * @addtogroup Eo_Composite_Objects Composite Objects.
627 * @brief Make an object a composite object of another.
628 * @param obj the "parent" object.
629 * @param comp_obj the object that will be used to composite obj.
631 * @see eo_composite_object_detach()
632 * @see eo_composite_is()
634 EAPI void eo_composite_object_attach(Eo *obj, Eo *comp_obj);
637 * @brief Detach a composite object from another object.
638 * @param obj the "parent" object.
639 * @param comp_obj the object attached to obj.
641 * @see eo_composite_object_attach()
642 * @see eo_composite_is()
644 EAPI void eo_composite_object_detach(Eo *obj, Eo *comp_obj);
647 * @brief Check if an object is a composite object.
648 * @param comp_obj the object to be checked.
649 * @return @c EINA_TRUE if it is, @c EINA_FALSE otherwise.
651 * @see eo_composite_object_attach()
652 * @see eo_composite_object_detach()
654 EAPI Eina_Bool eo_composite_is(Eo *comp_obj);
661 * @addtogroup Eo_Events Eo's Event Handling
666 * @def EO_CALLBACK_PRIORITY_BEFORE
667 * Slightly more prioritized than default.
669 #define EO_CALLBACK_PRIORITY_BEFORE -100
671 * @def EO_CALLBACK_PRIORITY_DEFAULT
672 * Default callback priority level
674 #define EO_CALLBACK_PRIORITY_DEFAULT 0
676 * @def EO_CALLBACK_PRIORITY_AFTER
677 * Slightly less prioritized than default.
679 #define EO_CALLBACK_PRIORITY_AFTER 100
682 * @typedef Eo_Callback_Priority
684 * Callback priority value. Range is -32k - 32k. The lower the number, the
685 * higher the priority.
687 * @see EO_CALLBACK_PRIORITY_AFTER
688 * @see EO_CALLBACK_PRIORITY_BEFORE
689 * @see EO_CALLBACK_PRIORITY_DEFAULT
691 typedef short Eo_Callback_Priority;
694 * @def EO_CALLBACK_STOP
695 * Stop calling callbacks for the even of which the callback was called for.
696 * @see EO_CALLBACK_CONTINUE
698 #define EO_CALLBACK_STOP EINA_FALSE
701 * @def EO_CALLBACK_CONTINUE
702 * Continue calling callbacks for the even of which the callback was called for.
703 * @see EO_CALLBACK_STOP
705 #define EO_CALLBACK_CONTINUE EINA_TRUE
708 * @typedef Eo_Event_Cb
710 * An event callback prototype.
712 * @param data The user data registered with the callback.
713 * @param obj The object which initiated the event.
714 * @param desc The event's description.
715 * @param event_info additional data passed with the event.
716 * @return #EO_CALLBACK_STOP to stop calling additional callbacks for the event, #EO_CALLBACK_CONTINUE to continue.
718 typedef Eina_Bool (*Eo_Event_Cb)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
721 * @brief Add an event callback forwarder for an event and an object.
722 * @param obj The object to listen to events on.
723 * @param desc The description of the event to listen to.
724 * @param new_obj The object to emit events from.
725 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
727 * @see eo_event_callback_forwarder_del()
729 EAPI Eina_Bool eo_event_callback_forwarder_add(Eo *obj, const Eo_Event_Description *desc, Eo *new_obj);
732 * @brief Remove an event callback forwarder for an event and an object.
733 * @param obj The object to listen to events on.
734 * @param desc The description of the event to listen to.
735 * @param new_obj The object to emit events from.
736 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
738 * @see eo_event_callback_forwarder_add()
740 EAPI Eina_Bool eo_event_callback_forwarder_del(Eo *obj, const Eo_Event_Description *desc, Eo *new_obj);
743 * @def eo_event_callback_add(obj, desc, cb, data)
744 * Add a callback for an event.
745 * @param obj The object to listen to events on.
746 * @param desc The description of the event to listen to.
747 * @param cb the callback to call.
748 * @param data additional data to pass to the callback.
749 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
751 * callbacks of the same priority are called in reverse order of creation.
753 * @see eo_event_callback_priority_add()
755 #define eo_event_callback_add(obj, desc, cb, data) \
756 eo_event_callback_priority_add(obj, desc, \
757 EO_CALLBACK_PRIORITY_DEFAULT, cb, data)
760 * @brief Add a callback for an event with a specific priority.
761 * @param obj The object to listen to events on.
762 * @param desc The description of the event to listen to.
763 * @param priority The priority of the callback.
764 * @param cb the callback to call.
765 * @param data additional data to pass to the callback.
766 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
768 * callbacks of the same priority are called in reverse order of creation.
770 * @see #eo_event_callback_add
772 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);
775 * @brief Del a callback for an event
776 * @param obj The object to listen to delete from.
777 * @param desc The description of the event to listen to.
778 * @param func the callback to delete.
779 * @return The additional data that was set to be passed to the callback.
781 * @see eo_event_callback_del()
783 EAPI void *eo_event_callback_del_lazy(Eo *obj, const Eo_Event_Description *desc, Eo_Event_Cb func);
786 * @brief Del a callback with a specific data associated to it for an event.
787 * @param obj The object to listen to delete from.
788 * @param desc The description of the event to listen to.
789 * @param func the callback to delete.
790 * @param user_data The data to compare.
791 * @return The additional data that was set to be passed to the callback.
793 * @see eo_event_callback_del_lazy()
795 EAPI void *eo_event_callback_del(Eo *obj, const Eo_Event_Description *desc, Eo_Event_Cb func, const void *user_data);
798 * @brief Call the callbacks for an event of an object.
799 * @param obj The object to work on.
800 * @param desc The description of the event to call.
801 * @param event_info Extra event info to pass to the callbacks.
802 * @return @c EINA_FALSE if one of the callbacks aborted the callback calls or @c EINA_TRUE otherwise.
804 EAPI Eina_Bool eo_event_callback_call(Eo *obj, const Eo_Event_Description *desc, const void *event_info);
811 * @addtogroup Eo_Class_Base Eo's Base class.
817 * The class type for the Eo base class.
819 #define EO_BASE_CLASS eo_base_class_get()
821 * @brief Use #EO_BASE_CLASS
824 EAPI const Eo_Class *eo_base_class_get(void) EINA_CONST;
827 * @typedef eo_base_data_free_func
828 * Data free func prototype.
830 typedef void (*eo_base_data_free_func)(void *);
833 * @var EO_BASE_BASE_ID
834 * #EO_BASE_CLASS 's base id.
836 extern EAPI Eo_Op EO_BASE_BASE_ID;
839 EO_BASE_SUB_ID_DATA_SET,
840 EO_BASE_SUB_ID_DATA_GET,
841 EO_BASE_SUB_ID_DATA_DEL,
842 EO_BASE_SUB_ID_WREF_ADD,
843 EO_BASE_SUB_ID_WREF_DEL,
848 * @def EO_BASE_ID(sub_id)
849 * Helper macro to get the full Op ID out of the sub_id for EO_BASE.
850 * @param sub_id the sub id inside EO_BASE.
852 #define EO_BASE_ID(sub_id) (EO_BASE_BASE_ID + sub_id)
855 * @def eo_base_data_set(key, data, free_func)
856 * Set generic data to object.
857 * @param[in] key the key associated with the data
858 * @param[in] data the data to set.
859 * @param[in] free_func the func to free data with (NULL means "do nothing").
861 * @see #eo_base_data_get
862 * @see #eo_base_data_del
864 #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)
867 * @def eo_base_data_get(key, data)
868 * Get generic data from object.
869 * @param[in] key the key associated with the data
870 * @param[out] data the data for the key
872 * @see #eo_base_data_set
873 * @see #eo_base_data_del
875 #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)
878 * @def eo_base_data_del(key)
879 * Del generic data from object.
880 * @param[in] key the key associated with the data
882 * @see #eo_base_data_set
883 * @see #eo_base_data_get
885 #define eo_base_data_del(key) EO_BASE_ID(EO_BASE_SUB_ID_DATA_DEL), EO_TYPECHECK(const char *, key)
889 * @brief Add a new weak reference to obj.
890 * @param wref The pointer to use for the weak ref.
892 * This function registers the object handle pointed by wref to obj so when
893 * obj is deleted it'll be updated to NULL. This functions should be used
894 * when you want to keep track of an object in a safe way, but you don't want
895 * to prevent it from being freed.
899 #define eo_wref_add(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_ADD), EO_TYPECHECK(Eo **, wref)
903 * @brief Delete the weak reference passed.
904 * @param wref the weak reference to free.
908 #define eo_wref_del(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_DEL), EO_TYPECHECK(Eo **, wref)
911 * @var _EO_EV_CALLBACK_ADD
912 * see EO_EV_CALLBACK_ADD
914 EAPI extern const Eo_Event_Description _EO_EV_CALLBACK_ADD;
917 * @def EO_EV_CALLBACK_ADD
918 * The event description (of type #Eo_Event_Description) for
919 * The "Callback listener added" event.
921 #define EO_EV_CALLBACK_ADD (&(_EO_EV_CALLBACK_ADD))
924 * @var _EO_EV_CALLBACK_DEL
925 * see EO_EV_CALLBACK_DEL
927 EAPI extern const Eo_Event_Description _EO_EV_CALLBACK_DEL;
930 * @def EO_EV_CALLBACK_DEL
931 * The event description (of type #Eo_Event_Description) for
932 * The "Callback listener deleted" event.
934 #define EO_EV_CALLBACK_DEL (&(_EO_EV_CALLBACK_DEL))
940 EAPI extern const Eo_Event_Description _EO_EV_FREE;
944 * Object is being freed.
946 #define EO_EV_FREE (&(_EO_EV_FREE))
952 EAPI extern const Eo_Event_Description _EO_EV_DEL;
956 * Object is being deleted.
958 #define EO_EV_DEL (&(_EO_EV_DEL))