2012-05-01 00:40:14 -07:00
|
|
|
#ifndef EO_H
|
|
|
|
#define EO_H
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <Eina.h>
|
|
|
|
|
|
|
|
#ifdef EAPI
|
|
|
|
# undef EAPI
|
|
|
|
#endif
|
|
|
|
|
2014-02-25 07:27:38 -08:00
|
|
|
#define EOLIAN
|
|
|
|
|
2014-06-09 06:08:33 -07:00
|
|
|
/* When used, it indicates that the function is an Eo API. */
|
2016-04-06 23:46:47 -07:00
|
|
|
#define EOAPI EAPI EAPI_WEAK
|
2014-06-09 06:08:33 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
# ifdef EFL_EO_BUILD
|
|
|
|
# ifdef DLL_EXPORT
|
|
|
|
# define EAPI __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif /* ! DLL_EXPORT */
|
|
|
|
# else
|
|
|
|
# define EAPI __declspec(dllimport)
|
|
|
|
# endif /* ! EFL_EO_BUILD */
|
|
|
|
#else
|
|
|
|
# ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
|
|
|
# define EAPI __attribute__ ((visibility("default")))
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
|
|
|
#endif /* ! _WIN32 */
|
|
|
|
|
2012-05-16 23:22:50 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
/**
|
2012-12-28 15:26:05 -08:00
|
|
|
* @page eo_main Eo
|
|
|
|
*
|
|
|
|
* @date 2012 (created)
|
|
|
|
*
|
|
|
|
* @section toc Table of Contents
|
|
|
|
*
|
|
|
|
* @li @ref eo_main_intro
|
|
|
|
* @li @ref eo_main_compiling
|
|
|
|
* @li @ref eo_main_next_steps
|
|
|
|
* @li @ref eo_main_intro_example
|
|
|
|
*
|
|
|
|
* @section eo_main_intro Introduction
|
2012-05-01 00:40:14 -07:00
|
|
|
*
|
|
|
|
* The Eo generic object system. It was designed to be the base object
|
|
|
|
* system for the EFL.
|
2012-12-28 15:26:05 -08:00
|
|
|
|
|
|
|
* @section eo_main_compiling How to compile
|
|
|
|
*
|
|
|
|
* Eo is a library your application links to. The procedure for this is
|
|
|
|
* very simple. You simply have to compile your application with the
|
|
|
|
* appropriate compiler flags that the @c pkg-config script outputs. For
|
|
|
|
* example:
|
|
|
|
*
|
|
|
|
* Compiling C or C++ files into object files:
|
|
|
|
*
|
|
|
|
* @verbatim
|
|
|
|
gcc -c -o main.o main.c `pkg-config --cflags eo`
|
|
|
|
@endverbatim
|
|
|
|
*
|
|
|
|
* Linking object files into a binary executable:
|
|
|
|
*
|
|
|
|
* @verbatim
|
|
|
|
gcc -o my_application main.o `pkg-config --libs eo`
|
|
|
|
@endverbatim
|
|
|
|
*
|
|
|
|
* See @ref pkgconfig
|
|
|
|
*
|
|
|
|
* @section eo_main_next_steps Next Steps
|
|
|
|
*
|
|
|
|
* After you understood what Eo is and installed it in your system
|
|
|
|
* you should proceed understanding the programming interface.
|
|
|
|
*
|
|
|
|
* Recommended reading:
|
|
|
|
*
|
2016-08-09 06:10:05 -07:00
|
|
|
* @li @ref Efl_Class_Base
|
|
|
|
* @li @ref Efl_Class
|
2016-08-30 05:34:10 -07:00
|
|
|
* @li @ref Efl_Events
|
2012-12-28 15:26:05 -08:00
|
|
|
* @li @ref Eo_Composite_Objects
|
|
|
|
*
|
|
|
|
* @section eo_main_intro_example Introductory Example
|
|
|
|
*
|
|
|
|
* @ref Eo_Tutorial
|
|
|
|
|
|
|
|
*
|
2012-05-01 00:40:14 -07:00
|
|
|
*
|
2012-12-28 15:26:05 -08:00
|
|
|
* @addtogroup Eo
|
2012-05-01 00:40:14 -07:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2015-11-09 03:45:04 -08:00
|
|
|
typedef struct _Eo_Object _Eo_Object;
|
|
|
|
|
2013-10-12 14:56:54 -07:00
|
|
|
/**
|
|
|
|
* @typedef Eo
|
|
|
|
* The basic Object type.
|
|
|
|
*/
|
|
|
|
typedef struct _Eo_Opaque Eo;
|
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @typedef Efl_Class
|
2013-10-12 14:56:54 -07:00
|
|
|
* The basic class type - should be removed, just for compat.
|
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
typedef Eo Efl_Class;
|
|
|
|
#define _EFL_CLASS_EO_CLASS_TYPE
|
2013-10-12 14:56:54 -07:00
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
typedef Eo Efl_Object;
|
2016-08-12 03:51:59 -07:00
|
|
|
#define _EFL_OBJECT_EO_CLASS_TYPE
|
2016-08-02 08:14:12 -07:00
|
|
|
|
|
|
|
#ifdef EFL_BETA_API_SUPPORT
|
|
|
|
|
2013-10-12 14:56:54 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @var _efl_class_creation_lock
|
2013-10-12 14:56:54 -07:00
|
|
|
* This variable is used for locking purposes in the class_get function
|
2016-08-15 06:44:41 -07:00
|
|
|
* defined in #EFL_DEFINE_CLASS.
|
2013-10-12 14:56:54 -07:00
|
|
|
* This is just to work around the fact that we need to init locks before
|
|
|
|
* using them.
|
|
|
|
* Don't touch it if you don't know what you are doing.
|
|
|
|
* @internal
|
|
|
|
*/
|
2016-09-08 03:14:32 -07:00
|
|
|
EAPI extern Eina_Lock _efl_class_creation_lock;
|
2013-10-12 14:56:54 -07:00
|
|
|
|
2016-02-03 08:14:07 -08:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @var _efl_object_init_generation
|
2016-02-03 08:14:07 -08:00
|
|
|
* This variable stores the current eo init generation. That is, how many times
|
|
|
|
* we have completed full init/shutdown cycles. Starts at 1 and incremeted on
|
|
|
|
* every call to shutdown that actually shuts down eo.
|
|
|
|
* @internal
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI extern unsigned int _efl_object_init_generation;
|
2016-02-03 08:14:07 -08:00
|
|
|
|
2013-10-12 14:56:54 -07:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* An enum representing the possible types of an Op.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
enum _Efl_Object_Op_Type
|
2013-10-12 14:56:54 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_OBJECT_OP_TYPE_INVALID = -1, /**< Invalid op. */
|
|
|
|
EFL_OBJECT_OP_TYPE_REGULAR = 0, /**< Regular op. */
|
|
|
|
EFL_OBJECT_OP_TYPE_CLASS, /**< Class op - a class op. Like static in Java/C++. */
|
|
|
|
EFL_OBJECT_OP_TYPE_REGULAR_OVERRIDE, /**< Regular op override (previously defined) */
|
|
|
|
EFL_OBJECT_OP_TYPE_CLASS_OVERRIDE, /**< Class op override (previously defined) */
|
2013-10-12 14:56:54 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
2016-08-15 06:44:41 -07:00
|
|
|
* @typedef Efl_Object_Op_Type
|
|
|
|
* A convenience typedef for #_Efl_Object_Op_Type.
|
2013-10-12 14:56:54 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef enum _Efl_Object_Op_Type Efl_Object_Op_Type;
|
2013-10-12 14:56:54 -07:00
|
|
|
|
2016-03-07 23:57:22 -08:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @typedef Efl_Del_Intercept
|
2016-03-07 23:57:22 -08:00
|
|
|
*
|
|
|
|
* A function to be called on object deletion/destruction instead of normal
|
|
|
|
* destruction taking place.
|
|
|
|
*
|
|
|
|
* @param obj_id The object needing destruction
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef void (*Efl_Del_Intercept) (Eo *obj_id);
|
2016-03-07 23:57:22 -08:00
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
#include "efl_object_override.eo.h"
|
|
|
|
#include "efl_object.eo.h"
|
|
|
|
#include "efl_interface.eo.h"
|
|
|
|
#define EO_CLASS EFL_OBJECT_CLASS
|
2013-01-29 08:36:01 -08:00
|
|
|
|
|
|
|
/**
|
2015-05-29 02:32:48 -07:00
|
|
|
* @addtogroup Eo_Debug_Information Eo's Debug information helper.
|
|
|
|
* @{
|
2013-01-29 08:36:01 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @var EFL_DBG_INFO_TYPE
|
2013-01-29 08:36:01 -08:00
|
|
|
* The Eina_Value_Type for the debug info.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI extern const Eina_Value_Type *EFL_DBG_INFO_TYPE;
|
2013-01-29 08:36:01 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a list inside debug info list.
|
2013-03-05 01:25:45 -08:00
|
|
|
* @param[in] list list where to append
|
|
|
|
* @param[in] name name of the list
|
2013-01-29 08:36:01 -08:00
|
|
|
* @return the new list
|
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
static inline Efl_Dbg_Info *
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_DBG_INFO_LIST_APPEND(Efl_Dbg_Info *list, const char *name)
|
2013-03-05 01:25:45 -08:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Dbg_Info *tmp = (Efl_Dbg_Info *)calloc(1, sizeof(*tmp));
|
2015-06-11 01:46:36 -07:00
|
|
|
|
|
|
|
if (!tmp) return NULL;
|
2013-03-05 01:25:45 -08:00
|
|
|
tmp->name = eina_stringshare_add(name);
|
2016-08-15 06:44:41 -07:00
|
|
|
eina_value_list_setup(&(tmp->value), EFL_DBG_INFO_TYPE);
|
2013-03-05 01:25:45 -08:00
|
|
|
if (list)
|
|
|
|
{
|
|
|
|
eina_value_list_pappend(&(list->value), tmp);
|
|
|
|
}
|
|
|
|
return tmp;
|
|
|
|
}
|
2013-01-29 08:36:01 -08:00
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def EFL_DBG_INFO_APPEND
|
2013-01-29 08:36:01 -08:00
|
|
|
* Creates a new debug info into a list
|
2016-08-09 06:10:05 -07:00
|
|
|
* @param[in] LIST list where to append (Efl_Dbg_Info *)
|
2013-01-29 08:36:01 -08:00
|
|
|
* @param[in] NAME name of the parameter (const char *)
|
|
|
|
* @param[in] TYPE type of the parameter (Eina_Value_Type *)
|
|
|
|
* @param[in] VALUE value of the parameter
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_DBG_INFO_APPEND(LIST, NAME, TYPE, VALUE) \
|
2013-01-29 08:36:01 -08:00
|
|
|
do { \
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Dbg_Info *List = LIST; \
|
2013-01-29 08:36:01 -08:00
|
|
|
if (List) \
|
|
|
|
{ \
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Dbg_Info *Tmp = calloc(1, sizeof(*Tmp)); \
|
2015-06-11 01:46:36 -07:00
|
|
|
\
|
|
|
|
if (!Tmp) break; \
|
2013-05-14 05:54:43 -07:00
|
|
|
Tmp->name = eina_stringshare_add(NAME); \
|
|
|
|
eina_value_setup(&(Tmp->value), TYPE); \
|
|
|
|
eina_value_set(&(Tmp->value), VALUE); \
|
2013-01-29 08:36:01 -08:00
|
|
|
eina_value_list_pappend(&(List->value), Tmp); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* Frees the Efl_Dbg_Info tree. (The whole tree recursively).
|
2013-01-29 08:36:01 -08:00
|
|
|
* @param[in] info The tree to delete.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void efl_dbg_info_free(Efl_Dbg_Info *info);
|
2013-01-29 08:36:01 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @typedef Efl_Object_Op
|
2012-05-01 00:40:14 -07:00
|
|
|
* The Eo operation type id.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef unsigned int Efl_Object_Op;
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def EFL_NOOP
|
|
|
|
* A special #Efl_Object_Op meaning "No operation".
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_NOOP ((Efl_Object_Op) 0)
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-30 05:34:10 -07:00
|
|
|
* @addtogroup Efl_Events Eo's Event Handling
|
2012-05-01 00:40:14 -07:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @def EFL_EVENT_DESCRIPTION(name)
|
|
|
|
* An helper macro to help populating #Efl_Event_Description
|
2012-05-01 00:40:14 -07:00
|
|
|
* @param name The name of the event.
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see Efl_Event_Description
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
#define EFL_EVENT_DESCRIPTION(name) { name, EINA_FALSE, EINA_FALSE, EINA_FALSE }
|
2013-05-20 02:16:39 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @def EFL_EVENT_DESCRIPTION_HOT(name)
|
|
|
|
* An helper macro to help populating #Efl_Event_Description and make
|
2013-05-20 02:16:39 -07:00
|
|
|
* the event impossible to freeze.
|
|
|
|
* @param name The name of the event.
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see Efl_Event_Description
|
|
|
|
* @see EFL_EVENT_DESCRIPTION
|
2013-05-20 02:16:39 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
#define EFL_EVENT_DESCRIPTION_HOT(name) { name, EINA_TRUE, EINA_FALSE, EINA_FALSE }
|
2016-04-20 15:50:46 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @def EFL_EVENT_DESCRIPTION(name)
|
|
|
|
* An helper macro to help populating #Efl_Event_Description
|
2016-04-20 15:50:46 -07:00
|
|
|
* @param name The name of the event.
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see Efl_Event_Description
|
2016-04-20 15:50:46 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
#define EFL_EVENT_DESCRIPTION_RESTART(name) { name, EINA_FALSE, EINA_FALSE, EINA_TRUE }
|
2016-04-20 15:50:46 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @def EFL_EVENT_DESCRIPTION_HOT(name)
|
|
|
|
* An helper macro to help populating #Efl_Event_Description and make
|
2016-04-20 15:50:46 -07:00
|
|
|
* the event impossible to freeze.
|
|
|
|
* @param name The name of the event.
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see Efl_Event_Description
|
|
|
|
* @see EFL_EVENT_DESCRIPTION
|
2016-04-20 15:50:46 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
#define EFL_EVENT_DESCRIPTION_HOT_RESTART(name) { name, EINA_TRUE, EINA_FALSE, EINA_TRUE }
|
2013-05-20 02:16:39 -07:00
|
|
|
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @addtogroup Efl_Class Efl Class
|
2012-05-01 00:40:14 -07:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def EFL_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...)
|
2012-05-01 00:40:14 -07:00
|
|
|
* A convenience macro to be used for creating the class_get function. This
|
|
|
|
* macro is fairly simple but should still be used as it'll let us improve
|
|
|
|
* things easily.
|
|
|
|
* @param class_get_func_name the name of the wanted class_get function name.
|
|
|
|
* @param class_desc the class description.
|
2016-08-15 06:44:41 -07:00
|
|
|
* @param parent_class The parent class for the function. Look at efl_class_new() for more information.
|
|
|
|
* @param ... List of extensions. Look at efl_class_new() for more information.
|
2012-05-01 00:40:14 -07:00
|
|
|
*
|
|
|
|
* You must use this macro if you want thread safety in class creation.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) \
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Class * \
|
2012-05-01 00:40:14 -07:00
|
|
|
class_get_func_name(void) \
|
|
|
|
{ \
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Class *_tmp_parent_class; \
|
|
|
|
static const Efl_Class * volatile _my_class = NULL; \
|
2016-02-03 08:14:07 -08:00
|
|
|
static unsigned int _my_init_generation = 1; \
|
2016-08-15 06:44:41 -07:00
|
|
|
if (EINA_UNLIKELY(_efl_object_init_generation != _my_init_generation)) \
|
2016-02-03 08:14:07 -08:00
|
|
|
{ \
|
2016-08-15 06:44:41 -07:00
|
|
|
_my_class = NULL; /* It's freed in efl_object_shutdown(). */ \
|
2016-02-03 08:14:07 -08:00
|
|
|
} \
|
2012-05-01 00:40:14 -07:00
|
|
|
if (EINA_LIKELY(!!_my_class)) return _my_class; \
|
|
|
|
\
|
2016-09-08 03:14:32 -07:00
|
|
|
eina_lock_take(&_efl_class_creation_lock); \
|
|
|
|
if (!!_my_class) \
|
2012-05-01 00:40:14 -07:00
|
|
|
{ \
|
2016-09-08 03:14:32 -07:00
|
|
|
eina_lock_release(&_efl_class_creation_lock); \
|
2012-05-01 00:40:14 -07:00
|
|
|
return _my_class; \
|
|
|
|
} \
|
2012-08-23 07:24:32 -07:00
|
|
|
_tmp_parent_class = parent_class; \
|
2016-08-15 06:44:41 -07:00
|
|
|
_my_class = efl_class_new(class_desc, _tmp_parent_class, __VA_ARGS__); \
|
|
|
|
_my_init_generation = _efl_object_init_generation; \
|
2016-09-08 03:14:32 -07:00
|
|
|
eina_lock_release(&_efl_class_creation_lock); \
|
2012-05-01 00:40:14 -07:00
|
|
|
\
|
|
|
|
return _my_class; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An enum representing the possible types of an Eo class.
|
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
enum _Efl_Class_Type
|
2012-05-01 00:40:14 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CLASS_TYPE_REGULAR = 0, /**< Regular class. */
|
|
|
|
EFL_CLASS_TYPE_REGULAR_NO_INSTANT, /**< Regular non instant-able class. */
|
|
|
|
EFL_CLASS_TYPE_INTERFACE, /**< Interface */
|
|
|
|
EFL_CLASS_TYPE_MIXIN /**< Mixin */
|
2012-05-01 00:40:14 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @typedef Efl_Class_Type
|
|
|
|
* A convenience typedef for #_Efl_Class_Type.
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
typedef enum _Efl_Class_Type Efl_Class_Type;
|
2012-05-01 00:40:14 -07:00
|
|
|
|
2012-07-09 02:09:46 -07:00
|
|
|
/**
|
|
|
|
* @def EO_VERSION
|
|
|
|
* The current version of EO.
|
|
|
|
*/
|
2014-04-01 08:21:13 -07:00
|
|
|
#define EO_VERSION 2
|
2012-07-09 02:09:46 -07:00
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
typedef struct _Efl_Op_Description
|
2013-12-25 05:51:52 -08:00
|
|
|
{
|
2015-09-28 07:26:51 -07:00
|
|
|
void *api_func; /**< The EAPI function offering this op. (The name of the func on windows) */
|
2013-11-11 05:27:36 -08:00
|
|
|
void *func; /**< The static function to call for the op. */
|
2016-08-15 06:44:41 -07:00
|
|
|
Efl_Object_Op_Type op_type; /**< The type of the Op. */
|
2016-08-09 06:10:05 -07:00
|
|
|
} Efl_Op_Description;
|
2013-12-25 05:51:52 -08:00
|
|
|
|
2016-05-19 03:33:17 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @struct _Efl_Object_Ops
|
2016-05-19 03:33:17 -07:00
|
|
|
*
|
|
|
|
* This struct holds the ops and the size of the ops.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef struct _Efl_Object_Ops
|
2016-05-19 03:33:17 -07:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Op_Description *descs; /**< The op descriptions array of size count. */
|
2016-05-19 03:33:17 -07:00
|
|
|
size_t count; /**< Number of op descriptions. */
|
2016-08-15 06:44:41 -07:00
|
|
|
} Efl_Object_Ops;
|
2016-05-19 03:33:17 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @struct _Efl_Class_Description
|
2012-05-01 00:40:14 -07:00
|
|
|
* This struct holds the description of a class.
|
2016-08-15 06:44:41 -07:00
|
|
|
* This description should be passed to efl_class_new.
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
struct _Efl_Class_Description
|
2012-05-01 00:40:14 -07:00
|
|
|
{
|
2012-07-09 02:09:46 -07:00
|
|
|
unsigned int version; /**< The current version of eo, use #EO_VERSION */
|
2012-05-01 00:40:14 -07:00
|
|
|
const char *name; /**< The name of the class. */
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Class_Type type; /**< The type of the class. */
|
2012-05-01 00:40:14 -07:00
|
|
|
size_t data_size; /**< The size of data (private + protected + public) this class needs per object. */
|
Efl object: change the way we set class's functions.
This is another follow up to the investigations of T4227. As stated
there, in any PIE (a shared library is one), structures, even const ones
end up being written to because of dynamic relocation. This means that
using static const structures has actually lead to no savings, only
waste. Since we never really needed them, using them made things even
worse than just having a different API that doesn't save them.
Thus, this commit changes the way we set the functions. Instead of
passing a pre-populated struct, we now just have an initialiser function
where you set the functions. This on its own doesn't significantly reduce
the amount of dirty memory pages for a reason I have yet to uncover,
though I believe it's done as a misguided compiler optimisation.
However, this design is flexible enough so we can change to another one
that is quite ugly, but I have already tested and proven that does that.
This patch series doesn't include the better improvement (passing
everything on the stack as va_args) because the API was too ugly
for me to bear, and I would rather first make sure there is no way to
force the compiler to do the right thing here.
Unfortunately this commit gives up on useless stricter validation.
Before this commit we would make sure that we are only overriding
functions correctly defined in our hierarchy. With this one, we don't
anymore. This is not a big problem though because this is a check that
is also enforced by Eolian. So as long as you are using Eolian, you
should be fine.
Breaks API and ABI!
@feature
2016-08-24 07:59:28 -07:00
|
|
|
Eina_Bool (*class_initializer)(Efl_Class *klass); /**< The initializer for the class */
|
2016-08-09 06:10:05 -07:00
|
|
|
void (*class_constructor)(Efl_Class *klass); /**< The constructor of the class. */
|
|
|
|
void (*class_destructor)(Efl_Class *klass); /**< The destructor of the class. */
|
2012-05-01 00:40:14 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @typedef Efl_Class_Description
|
|
|
|
* A convenience typedef for #_Efl_Class_Description
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
typedef struct _Efl_Class_Description Efl_Class_Description;
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Create a new class.
|
|
|
|
* @param desc the class description to create the class with.
|
|
|
|
* @param parent the class to inherit from.
|
|
|
|
* @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects).
|
|
|
|
* @return The new class's handle on success, or NULL otherwise.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* You should use #EFL_DEFINE_CLASS. It'll provide thread safety and other
|
2012-05-01 00:40:14 -07:00
|
|
|
* features easily.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see #EFL_DEFINE_CLASS
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI const Efl_Class *efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent, ...);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
Efl object: change the way we set class's functions.
This is another follow up to the investigations of T4227. As stated
there, in any PIE (a shared library is one), structures, even const ones
end up being written to because of dynamic relocation. This means that
using static const structures has actually lead to no savings, only
waste. Since we never really needed them, using them made things even
worse than just having a different API that doesn't save them.
Thus, this commit changes the way we set the functions. Instead of
passing a pre-populated struct, we now just have an initialiser function
where you set the functions. This on its own doesn't significantly reduce
the amount of dirty memory pages for a reason I have yet to uncover,
though I believe it's done as a misguided compiler optimisation.
However, this design is flexible enough so we can change to another one
that is quite ugly, but I have already tested and proven that does that.
This patch series doesn't include the better improvement (passing
everything on the stack as va_args) because the API was too ugly
for me to bear, and I would rather first make sure there is no way to
force the compiler to do the right thing here.
Unfortunately this commit gives up on useless stricter validation.
Before this commit we would make sure that we are only overriding
functions correctly defined in our hierarchy. With this one, we don't
anymore. This is not a big problem though because this is a check that
is also enforced by Eolian. So as long as you are using Eolian, you
should be fine.
Breaks API and ABI!
@feature
2016-08-24 07:59:28 -07:00
|
|
|
/**
|
|
|
|
* @brief Set the functions of a class
|
|
|
|
* @param klass_id the class whose functions we are setting.
|
|
|
|
* @param ops The function structure we are setting.
|
|
|
|
* @return True on success, False otherwise.
|
|
|
|
*
|
|
|
|
* This should only be called from within the initializer function.
|
|
|
|
*
|
|
|
|
* @see #EFL_DEFINE_CLASS
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool efl_class_functions_set(const Efl_Class *klass_id, const Efl_Object_Ops *ops);
|
|
|
|
|
2016-05-19 03:33:17 -07:00
|
|
|
/**
|
|
|
|
* @brief Override Eo functions of this object.
|
|
|
|
* @param ops The op description to override with.
|
|
|
|
* @return true on success, false otherwise.
|
|
|
|
*
|
|
|
|
* This lets you override all of the Eo functions of this object (this
|
|
|
|
* one included) and repalce them with ad-hoc implementation.
|
|
|
|
* The contents of the array are copied so they can for example reside
|
|
|
|
* on the stack.
|
|
|
|
*
|
|
|
|
* You are only allowed to override functions that are defined in the
|
2016-08-15 06:44:41 -07:00
|
|
|
* class or any of its interfaces (that is, efl_isa returning true).
|
2016-07-19 01:21:36 -07:00
|
|
|
*
|
|
|
|
* If @p ops is #NULL, this will revert the @p obj to its original class
|
|
|
|
* without any function overrides.
|
2016-07-20 21:42:37 -07:00
|
|
|
*
|
|
|
|
* It is not possible to override a function table of an object when it's
|
2016-08-15 06:44:41 -07:00
|
|
|
* already been overridden. Call efl_object_override(obj, NULL) first if you really
|
2016-07-20 21:42:37 -07:00
|
|
|
* need to do that.
|
2016-05-19 03:33:17 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eina_Bool efl_object_override(Eo *obj, const Efl_Object_Ops *ops);
|
2016-05-19 03:33:17 -07:00
|
|
|
|
2016-07-19 01:21:36 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @brief Define an array of override functions for @ref efl_object_override
|
|
|
|
* @param ops A name for the Efl_Object_Ops local variable to define
|
|
|
|
* @param ... A comma separated list of Efl_Object_Op overrides, using
|
|
|
|
* #EFL_OBJECT_OP_FUNC_OVERRIDE or #EFL_OBJECT_OP_CLASS_FUNC_OVERRIDE
|
2016-07-19 01:21:36 -07:00
|
|
|
*
|
|
|
|
* This can be used as follows:
|
|
|
|
* @code
|
2016-09-01 06:34:55 -07:00
|
|
|
* EFL_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC_OVERRIDE(public_func, _my_func));
|
2016-08-15 06:44:41 -07:00
|
|
|
* efl_object_override(obj, &ops);
|
2016-07-19 01:21:36 -07:00
|
|
|
* @endcode
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_object_override
|
2016-07-19 01:21:36 -07:00
|
|
|
*/
|
2016-09-01 06:34:55 -07:00
|
|
|
#define EFL_OPS_DEFINE(ops, ...) \
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Op_Description _##ops##_descs[] = { __VA_ARGS__ }; \
|
2016-08-15 06:44:41 -07:00
|
|
|
const Efl_Object_Ops ops = { _##ops##_descs, EINA_C_ARRAY_LENGTH(_##ops##_descs) }
|
2016-05-20 08:16:14 -07:00
|
|
|
|
2012-06-13 04:39:12 -07:00
|
|
|
/**
|
|
|
|
* @brief Check if an object "is a" klass.
|
|
|
|
* @param obj The object to check
|
|
|
|
* @param klass The klass to check against.
|
|
|
|
* @return @c EINA_TRUE if obj implements klass, @c EINA_FALSE otherwise.
|
|
|
|
*
|
|
|
|
* Notice: This function does not support composite objects.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eina_Bool efl_isa(const Eo *obj, const Efl_Class *klass);
|
2012-06-13 04:39:12 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
/**
|
|
|
|
* @brief Gets the name of the passed class.
|
|
|
|
* @param klass the class to work on.
|
|
|
|
* @return The class's name.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_class_get()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI const char *efl_class_name_get(const Efl_Class *klass);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Init the eo subsystem
|
2016-02-03 08:32:50 -08:00
|
|
|
* @return @c EINA_TRUE if eo is init, @c EINA_FALSE otherwise.
|
2012-05-01 00:40:14 -07:00
|
|
|
*
|
|
|
|
* @see eo_shutfown()
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eina_Bool efl_object_init(void);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Shutdown the eo subsystem
|
2016-02-03 08:32:50 -08:00
|
|
|
* @return @c EINA_TRUE if eo is init, @c EINA_FALSE otherwise.
|
2012-05-01 00:40:14 -07:00
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_object_init()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eina_Bool efl_object_shutdown(void);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
2016-09-07 01:53:33 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The virtual allocation domain where an object lives
|
|
|
|
*
|
|
|
|
* You cannot mix objects between domains in the object tree or as direct
|
|
|
|
* or indirect references unless you explicitly handle it and ensure the
|
|
|
|
* other domain is adopted into your local thread space
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
EFL_ID_DOMAIN_INVALID = -1, /**< Invalid */
|
|
|
|
EFL_ID_DOMAIN_MAIN = 0, /**< The main loop domain where eo_init() is called */
|
|
|
|
EFL_ID_DOMAIN_SHARED = 1, /**< A special shared domain that all threads can see but has extra locking and unlocking costs to access */
|
|
|
|
EFL_ID_DOMAIN_THREAD, /**< The normal domain for threads so they can adopt the main loop domain at times */
|
|
|
|
EFL_ID_DOMAIN_OTHER /**< A 'spare extra domain that regular threads can talk to or even set themselves to be */
|
|
|
|
} Efl_Id_Domain;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @typedef Efl_Domain_Data
|
|
|
|
* An opaque handle for private domain data
|
|
|
|
*/
|
|
|
|
typedef struct _Efl_Domain_Data Efl_Domain_Data;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the native domain for the current thread
|
|
|
|
*
|
|
|
|
* @return The native domain
|
|
|
|
*
|
|
|
|
* This will return the native eo object allocation domain for the current
|
|
|
|
* thread. This can only be changed with efl_domain_switch() and this can
|
|
|
|
* only be called before any objects are created/allocated on the thread
|
|
|
|
* where it is called. Calling it after this point will result in
|
|
|
|
* undefined behavior, so be sure to call this immediaetly after a thread
|
|
|
|
* begins to execute, before anything else. You must not change the domain
|
|
|
|
* of the main thread.
|
|
|
|
*
|
|
|
|
* @see efl_domain_switch()
|
|
|
|
* @see efl_domain_current_get()
|
|
|
|
* @see efl_domain_current_set()
|
|
|
|
* @see efl_domain_current_push()
|
|
|
|
* @see efl_domain_current_pop()
|
|
|
|
* @see efl_domain_data_get()
|
|
|
|
* @see efl_domain_data_adopt()
|
|
|
|
* @see efl_domain_data_return()
|
|
|
|
* @see efl_compatible()
|
|
|
|
*/
|
|
|
|
EAPI Efl_Id_Domain efl_domain_get(void);
|
|
|
|
|
|
|
|
/**
|
2016-09-07 07:55:36 -07:00
|
|
|
* @brief Switch the native domain for the current thread
|
2016-09-07 01:53:33 -07:00
|
|
|
* @param domain The domain to switch to
|
|
|
|
* @return EINA_TRUE if the switch succeeds, and EINA_FALSE if it fails
|
|
|
|
*
|
2016-09-07 07:55:36 -07:00
|
|
|
* Permanently switch the native domain for new objects for the calling
|
2016-09-07 01:53:33 -07:00
|
|
|
* thread. All objects created on this thread UNLESS it has switched to a
|
|
|
|
* new domain temporarily with efl_domain_current_set(),
|
|
|
|
* efl_domain_current_push() or efl_domain_current_pop(),
|
|
|
|
* efl_domain_data_adopt() and efl_domain_data_return().
|
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool efl_domain_switch(Efl_Id_Domain domain);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the current domain used for allocating new objects
|
|
|
|
* @return The current domain
|
|
|
|
*
|
|
|
|
* Get the currently used domain that is at the top of the domain stack.
|
|
|
|
* There is actually a stack of domans to use you can alter via
|
|
|
|
* efl_domain_current_push() and efl_domain_current_pop(). This only gets
|
|
|
|
* the domain for the current thread.
|
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI Efl_Id_Domain efl_domain_current_get(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set the current domain used for allocating new objects
|
|
|
|
* @return EINA_TRUE if it succeeds, and EINA_FALSE on failure
|
|
|
|
*
|
|
|
|
* Temporarily switch the current domain being used for allocation. There
|
|
|
|
* is actually a stack of domans to use you can alter via
|
2016-09-07 07:55:36 -07:00
|
|
|
* efl_domain_current_push() and efl_domain_current_pop(). The current
|
|
|
|
* domain is the one ont he top of the stack, so this entry is altered
|
|
|
|
* without pushing or popping. This only applies to the calling thread.
|
2016-09-07 01:53:33 -07:00
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool efl_domain_current_set(Efl_Id_Domain domain);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Push a new domain onto the domain stack
|
|
|
|
* @param domain The domain to push
|
|
|
|
* @return EINA_TRUE if it succeeds, and EINA_FALSE on failure
|
|
|
|
*
|
|
|
|
* This pushes a domain on the domain stack that can be popped later with
|
|
|
|
* efl_domain_current_pop(). If the stack is full this may fail and return
|
|
|
|
* EINA_FALSE in that case. This applies only to the calling thread.
|
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool efl_domain_current_push(Efl_Id_Domain domain);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Pop a previously pushed domain from the domain stack
|
|
|
|
*
|
|
|
|
* This pops the top domain off the domain stack for the calling thread
|
|
|
|
* that was pushed with efl_domain_current_push().
|
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI void efl_domain_current_pop(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get an opaque handle to the local native domain eoid data
|
|
|
|
* @return A handle to the local native domain data or NULl on failure
|
|
|
|
*
|
|
|
|
* This gets a handle to the domain data for the current thread, intended
|
|
|
|
* to be used by another thread to adopt with efl_domain_data_adopt().
|
|
|
|
* Once you use efl_domain_data_adopt() the thread that called
|
|
|
|
* efl_domain_data_get() should suspend and not execute anything
|
|
|
|
* related to eo or efl objects until the thread that adopted the data
|
|
|
|
* called efl_domain_data_return() to return the data to its owner and
|
|
|
|
* stop making it available to that thread.
|
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI Efl_Domain_Data *efl_domain_data_get(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Adopt a single extra domain to be the current domain
|
|
|
|
* @param datas_in The domain data to adopt
|
|
|
|
* @return The domain that was adopted or EFL_ID_DOMAIN_INVALID on failure
|
|
|
|
*
|
|
|
|
* This will adopt the given domain data pointed to by @p data_in
|
|
|
|
* as an extra domain locally. The adopted domain must have a domain ID
|
|
|
|
* that is not the same as the current thread domain or local domain. You
|
|
|
|
* may not adopt a domain that clashes with the current domain. If you
|
|
|
|
* set, push or pop domains so these might clash (be the same) then
|
|
|
|
* undefined behaviour will occur.
|
|
|
|
*
|
|
|
|
* This will also push the adopted domain as the current domain so that
|
|
|
|
* all newly created objects (unless their parent is of a differing domain)
|
|
|
|
* will be part of this adopted domain. You can still access objects from
|
|
|
|
* your local domain as well, but be aware that creation will require
|
|
|
|
* some switch of domain by push, pop or set. Return the domain with
|
|
|
|
* efl_domain_data_return() when done.
|
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI Efl_Id_Domain efl_domain_data_adopt(Efl_Domain_Data *data_in);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Return a domain to its original owning thread
|
|
|
|
* @param domain The domain to return
|
|
|
|
* @return EINA_TRUE on success EINA_FALSE on failure
|
|
|
|
*
|
|
|
|
* This returns the domain specified by @p domain to the thread it came
|
|
|
|
* from, allowing that thread after this to continue execution. This
|
|
|
|
* will implicitly pop the current domain from the stack, assuming that
|
|
|
|
* the current domain is the same one pushed implicitly by
|
|
|
|
* efl_domain_data_adopt(). You cannot return your own native local
|
|
|
|
* domain, only the one that was adopted by efl_domain_data_adopt().
|
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool efl_domain_data_return(Efl_Id_Domain domain);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @prief Check if 2 objects are compatible
|
|
|
|
* @param obj The basic object
|
|
|
|
* @param obj_target The alternat object that may be referenced by @p obj
|
|
|
|
* @return EINA_TRUE if compatible, EINA_FALSE if not
|
|
|
|
*
|
|
|
|
* This checks to see if 2 objects are compatible and could be parent or
|
2016-09-07 07:55:36 -07:00
|
|
|
* children of eachother, could reference eachother etc.. There is only a
|
2016-09-07 01:53:33 -07:00
|
|
|
* need to call this if you got objects from multiple domains (an
|
|
|
|
* adopted domain with efl_domain_data_adopt() or the shared domain
|
|
|
|
* EFL_ID_DOMAIN_SHARED where objects may be accessed by any thread).
|
|
|
|
*
|
|
|
|
* @see efl_domain_get()
|
|
|
|
*/
|
|
|
|
EAPI Eina_Bool efl_compatible(const Eo *obj, const Eo *obj_target);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-18 00:10:07 -07:00
|
|
|
// to fetch internal function and object data at once
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef struct _Efl_Object_Op_Call_Data
|
2013-07-10 00:24:59 -07:00
|
|
|
{
|
2016-09-07 07:13:11 -07:00
|
|
|
Eo *eo_id;
|
|
|
|
_Eo_Object *obj;
|
|
|
|
void *func;
|
|
|
|
void *data;
|
|
|
|
void *lock_data;
|
|
|
|
void *extn1; // for the future to avoid ABI issues
|
|
|
|
void *extn2; // for the future to avoid ABI issues
|
|
|
|
void *extn3; // for the future to avoid ABI issues
|
|
|
|
void *extn4; // for the future to avoid ABI issues
|
2016-08-15 06:44:41 -07:00
|
|
|
} Efl_Object_Op_Call_Data;
|
2013-07-10 00:24:59 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_OBJECT_CALL_CACHE_SIZE 1
|
2013-08-01 02:49:27 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef struct _Efl_Object_Call_Cache_Index
|
2015-10-21 04:06:23 -07:00
|
|
|
{
|
|
|
|
const void *klass;
|
2016-08-15 06:44:41 -07:00
|
|
|
} Efl_Object_Call_Cache_Index;
|
2013-08-01 02:49:27 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef struct _Efl_Object_Call_Cache_Entry
|
2015-10-21 04:06:23 -07:00
|
|
|
{
|
|
|
|
const void *func;
|
2016-08-15 06:44:41 -07:00
|
|
|
} Efl_Object_Call_Cache_Entry;
|
2015-10-21 04:06:23 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef struct _Efl_Object_Call_Cache_Off
|
2015-10-21 04:06:23 -07:00
|
|
|
{
|
|
|
|
int off;
|
2016-08-15 06:44:41 -07:00
|
|
|
} Efl_Object_Call_Cache_Off;
|
2013-08-01 02:49:27 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
typedef struct _Efl_Object_Call_Cache
|
2015-10-21 04:06:23 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
#if EFL_OBJECT_CALL_CACHE_SIZE > 0
|
|
|
|
Efl_Object_Call_Cache_Index index[EFL_OBJECT_CALL_CACHE_SIZE];
|
|
|
|
Efl_Object_Call_Cache_Entry entry[EFL_OBJECT_CALL_CACHE_SIZE];
|
|
|
|
Efl_Object_Call_Cache_Off off [EFL_OBJECT_CALL_CACHE_SIZE];
|
|
|
|
# if EFL_OBJECT_CALL_CACHE_SIZE > 1
|
2015-10-21 06:23:18 -07:00
|
|
|
int next_slot;
|
|
|
|
# endif
|
2015-10-21 04:06:23 -07:00
|
|
|
#endif
|
2016-08-15 06:44:41 -07:00
|
|
|
Efl_Object_Op op;
|
2016-04-05 22:02:05 -07:00
|
|
|
unsigned int generation;
|
2016-08-15 06:44:41 -07:00
|
|
|
} Efl_Object_Call_Cache;
|
2013-08-01 02:49:27 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
// to pass the internal function call to EFL_FUNC_BODY (as Func parameter)
|
|
|
|
#define EFL_FUNC_CALL(...) __VA_ARGS__
|
2013-07-09 05:11:05 -07:00
|
|
|
|
2015-09-28 07:26:51 -07:00
|
|
|
#ifndef _WIN32
|
2016-08-15 06:44:41 -07:00
|
|
|
# define EFL_FUNC_COMMON_OP_FUNC(Name) ((const void *) Name)
|
2015-06-18 04:30:13 -07:00
|
|
|
#else
|
2016-08-15 06:44:41 -07:00
|
|
|
# define EFL_FUNC_COMMON_OP_FUNC(Name) ((const void *) #Name)
|
2015-06-18 04:30:13 -07:00
|
|
|
#endif
|
|
|
|
|
2016-09-07 04:52:50 -07:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
# define EFL_FUNC_TLS __declspec(thread)
|
|
|
|
#else
|
|
|
|
# define EFL_FUNC_TLS __thread
|
|
|
|
#endif
|
|
|
|
|
2013-07-18 00:10:07 -07:00
|
|
|
// cache OP id, get real fct and object data then do the call
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_FUNC_COMMON_OP(Obj, Name, DefRet) \
|
2016-09-07 04:52:50 -07:00
|
|
|
static EFL_FUNC_TLS Efl_Object_Call_Cache ___cache; /* static 0 by default */ \
|
2016-08-15 06:44:41 -07:00
|
|
|
Efl_Object_Op_Call_Data ___call; \
|
|
|
|
if (EINA_UNLIKELY((___cache.op == EFL_NOOP) || \
|
|
|
|
(___cache.generation != _efl_object_init_generation))) \
|
2015-10-15 10:03:27 -07:00
|
|
|
{ \
|
2016-08-15 06:44:41 -07:00
|
|
|
___cache.op = _efl_object_api_op_id_get(EFL_FUNC_COMMON_OP_FUNC(Name)); \
|
|
|
|
if (___cache.op == EFL_NOOP) return DefRet; \
|
|
|
|
___cache.generation = _efl_object_init_generation; \
|
2015-10-15 10:03:27 -07:00
|
|
|
} \
|
2016-08-15 06:44:41 -07:00
|
|
|
if (!_efl_object_call_resolve((Eo *) Obj, #Name, &___call, &___cache, \
|
2015-10-21 04:06:23 -07:00
|
|
|
__FILE__, __LINE__)) return DefRet; \
|
2015-04-03 07:14:19 -07:00
|
|
|
_Eo_##Name##_func _func_ = (_Eo_##Name##_func) ___call.func; \
|
2013-07-30 06:02:35 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
#define _EFL_OBJECT_API_BEFORE_HOOK
|
|
|
|
#define _EFL_OBJECT_API_AFTER_HOOK
|
|
|
|
#define _EFL_OBJECT_API_CALL_HOOK(x) x
|
2016-03-11 12:22:59 -08:00
|
|
|
|
2013-07-18 00:10:07 -07:00
|
|
|
// to define an EAPI function
|
2016-08-15 06:44:41 -07:00
|
|
|
#define _EFL_OBJECT_FUNC_BODY(Name, ObjType, Ret, DefRet) \
|
2013-07-18 00:10:07 -07:00
|
|
|
Ret \
|
2015-11-09 03:45:04 -08:00
|
|
|
Name(ObjType obj) \
|
2013-07-18 00:10:07 -07:00
|
|
|
{ \
|
2015-04-03 07:14:19 -07:00
|
|
|
typedef Ret (*_Eo_##Name##_func)(Eo *, void *obj_data); \
|
2013-12-26 14:46:50 -08:00
|
|
|
Ret _r; \
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_FUNC_COMMON_OP(obj, Name, DefRet); \
|
|
|
|
_EFL_OBJECT_API_BEFORE_HOOK \
|
|
|
|
_r = _EFL_OBJECT_API_CALL_HOOK(_func_(___call.eo_id, ___call.data)); \
|
|
|
|
_efl_object_call_end(&___call); \
|
|
|
|
_EFL_OBJECT_API_AFTER_HOOK \
|
2013-08-01 02:49:27 -07:00
|
|
|
return _r; \
|
2013-12-25 05:34:26 -08:00
|
|
|
}
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
#define _EFL_OBJECT_VOID_FUNC_BODY(Name, ObjType) \
|
2013-08-01 02:49:27 -07:00
|
|
|
void \
|
2015-11-09 03:45:04 -08:00
|
|
|
Name(ObjType obj) \
|
2013-08-01 02:49:27 -07:00
|
|
|
{ \
|
2015-04-03 07:14:19 -07:00
|
|
|
typedef void (*_Eo_##Name##_func)(Eo *, void *obj_data); \
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_FUNC_COMMON_OP(obj, Name, ); \
|
|
|
|
_EFL_OBJECT_API_BEFORE_HOOK \
|
|
|
|
_EFL_OBJECT_API_CALL_HOOK(_func_(___call.eo_id, ___call.data)); \
|
|
|
|
_efl_object_call_end(&___call); \
|
|
|
|
_EFL_OBJECT_API_AFTER_HOOK \
|
2013-08-01 02:49:27 -07:00
|
|
|
}
|
2013-12-25 06:09:16 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
#define _EFL_OBJECT_FUNC_BODYV(Name, ObjType, Ret, DefRet, Arguments, ...) \
|
2013-12-25 05:51:52 -08:00
|
|
|
Ret \
|
2015-11-09 03:45:04 -08:00
|
|
|
Name(ObjType obj, __VA_ARGS__) \
|
2013-12-25 05:51:52 -08:00
|
|
|
{ \
|
2014-04-02 01:46:34 -07:00
|
|
|
typedef Ret (*_Eo_##Name##_func)(Eo *, void *obj_data, __VA_ARGS__); \
|
2013-12-26 14:46:50 -08:00
|
|
|
Ret _r; \
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_FUNC_COMMON_OP(obj, Name, DefRet); \
|
|
|
|
_EFL_OBJECT_API_BEFORE_HOOK \
|
|
|
|
_r = _EFL_OBJECT_API_CALL_HOOK(_func_(___call.eo_id, ___call.data, Arguments)); \
|
|
|
|
_efl_object_call_end(&___call); \
|
|
|
|
_EFL_OBJECT_API_AFTER_HOOK \
|
2013-08-01 02:49:27 -07:00
|
|
|
return _r; \
|
2013-12-25 05:34:26 -08:00
|
|
|
}
|
2013-12-25 06:09:16 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
#define _EFL_OBJECT_VOID_FUNC_BODYV(Name, ObjType, Arguments, ...) \
|
2013-08-01 02:49:27 -07:00
|
|
|
void \
|
2015-11-09 03:45:04 -08:00
|
|
|
Name(ObjType obj, __VA_ARGS__) \
|
2013-08-01 02:49:27 -07:00
|
|
|
{ \
|
2014-04-02 01:46:34 -07:00
|
|
|
typedef void (*_Eo_##Name##_func)(Eo *, void *obj_data, __VA_ARGS__); \
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_FUNC_COMMON_OP(obj, Name, ); \
|
|
|
|
_EFL_OBJECT_API_BEFORE_HOOK \
|
|
|
|
_EFL_OBJECT_API_CALL_HOOK(_func_(___call.eo_id, ___call.data, Arguments)); \
|
|
|
|
_efl_object_call_end(&___call); \
|
|
|
|
_EFL_OBJECT_API_AFTER_HOOK \
|
2013-08-01 02:49:27 -07:00
|
|
|
}
|
2013-07-08 08:31:36 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_FUNC_BODY(Name, Ret, DefRet) _EFL_OBJECT_FUNC_BODY(Name, Eo *, Ret, DefRet)
|
|
|
|
#define EFL_VOID_FUNC_BODY(Name) _EFL_OBJECT_VOID_FUNC_BODY(Name, Eo *)
|
|
|
|
#define EFL_FUNC_BODYV(Name, Ret, DefRet, Arguments, ...) _EFL_OBJECT_FUNC_BODYV(Name, Eo *, Ret, DefRet, EFL_FUNC_CALL(Arguments), __VA_ARGS__)
|
|
|
|
#define EFL_VOID_FUNC_BODYV(Name, Arguments, ...) _EFL_OBJECT_VOID_FUNC_BODYV(Name, Eo *, EFL_FUNC_CALL(Arguments), __VA_ARGS__)
|
2016-03-08 06:23:57 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_FUNC_BODY_CONST(Name, Ret, DefRet) _EFL_OBJECT_FUNC_BODY(Name, const Eo *, Ret, DefRet)
|
|
|
|
#define EFL_VOID_FUNC_BODY_CONST(Name) _EFL_OBJECT_VOID_FUNC_BODY(Name, const Eo *)
|
|
|
|
#define EFL_FUNC_BODYV_CONST(Name, Ret, DefRet, Arguments, ...) _EFL_OBJECT_FUNC_BODYV(Name, const Eo *, Ret, DefRet, EFL_FUNC_CALL(Arguments), __VA_ARGS__)
|
|
|
|
#define EFL_VOID_FUNC_BODYV_CONST(Name, Arguments, ...) _EFL_OBJECT_VOID_FUNC_BODYV(Name, const Eo *, EFL_FUNC_CALL(Arguments), __VA_ARGS__)
|
2016-03-08 06:23:57 -08:00
|
|
|
|
2014-05-19 05:04:32 -07:00
|
|
|
#ifndef _WIN32
|
2016-08-15 06:44:41 -07:00
|
|
|
# define _EFL_OBJECT_OP_API_ENTRY(a) (void*)a
|
2014-05-19 05:04:32 -07:00
|
|
|
#else
|
2016-08-15 06:44:41 -07:00
|
|
|
# define _EFL_OBJECT_OP_API_ENTRY(a) #a
|
2014-05-19 05:04:32 -07:00
|
|
|
#endif
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_OBJECT_OP_FUNC(_api, _private) { _EFL_OBJECT_OP_API_ENTRY(_api), (void*)_private, EFL_OBJECT_OP_TYPE_REGULAR }
|
|
|
|
#define EFL_OBJECT_OP_CLASS_FUNC(_api, _private) { _EFL_OBJECT_OP_API_ENTRY(_api), (void*)_private, EFL_OBJECT_OP_TYPE_CLASS }
|
|
|
|
#define EFL_OBJECT_OP_FUNC_OVERRIDE(_api, _private) { _EFL_OBJECT_OP_API_ENTRY(_api), (void*)_private, EFL_OBJECT_OP_TYPE_REGULAR_OVERRIDE }
|
|
|
|
#define EFL_OBJECT_OP_CLASS_FUNC_OVERRIDE(_api, _private) { _EFL_OBJECT_OP_API_ENTRY(_api), (void*)_private, EFL_OBJECT_OP_TYPE_CLASS_OVERRIDE }
|
2013-12-25 06:05:44 -08:00
|
|
|
|
2013-07-18 00:10:07 -07:00
|
|
|
// returns the OP id corresponding to the given api_func
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Efl_Object_Op _efl_object_api_op_id_get(const void *api_func);
|
2013-12-25 05:51:52 -08:00
|
|
|
|
2013-07-18 00:10:07 -07:00
|
|
|
// gets the real function pointer and the object data
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eina_Bool _efl_object_call_resolve(Eo *obj, const char *func_name, Efl_Object_Op_Call_Data *call, Efl_Object_Call_Cache *callcache, const char *file, int line);
|
2013-07-11 05:15:39 -07:00
|
|
|
|
2015-11-09 03:45:04 -08:00
|
|
|
// end of the eo call barrier, unref the obj
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void _efl_object_call_end(Efl_Object_Op_Call_Data *call);
|
2013-12-25 06:02:25 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
// end of the efl_add. Calls finalize among others
|
|
|
|
EAPI Eo * _efl_add_end(Eo *obj, Eina_Bool is_ref, Eina_Bool is_fallback);
|
Eo: Remove GCCism and make it more portable.
This affects eo_do() and eo_add() that used to use the ({}) GCCism.
Following a discussion with Peter de Ridder after my talk at FOSDEM,
we've decided to reopen the GCCism (works with other gcc compatible
compilers like clang and intelc) discussion, and after a bit of back and
forth it was decided to make things more portable, at the cost of ease
of use.
For example:
if (eo_do(obj, visible_get()))
is no longer allowed, the portable alternative
Eina_Bool tmp;
if (eo_do_ret(obj, tmp, visible_get()))
is to be used instead.
However:
eo_do(obj, a = a_get(), b = b_get(), bool_set(!bool_get))
are still allowed and OK.
eo_do(obj, if (a_get()) return;);
is no longer allowed, but:
eo_do(obj, if (a_get()) something());
is still allowed.
For clarity, this commit only incorporates the Eo changes, and not the
EFL changes to make the efl conform with this change.
Thanks again to Peter de Ridder for triggering this important discussion
which led to this change.
2015-02-23 08:06:40 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eo *efl_super(const Eo *obj, const Efl_Class *cur_klass);
|
2015-04-17 06:31:19 -07:00
|
|
|
|
2013-07-18 00:10:07 -07:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
/**
|
|
|
|
* @brief Gets the class of the object.
|
|
|
|
* @param obj The object to work on
|
|
|
|
* @return The object's class.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_class_name_get()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI const Efl_Class *efl_class_get(const Eo *obj);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
2016-09-05 08:57:35 -07:00
|
|
|
EAPI Eo *_efl_added_get(void);
|
2016-03-15 07:03:00 -07:00
|
|
|
|
2016-03-29 06:47:22 -07:00
|
|
|
/* Check if GCC compatible (both GCC and clang define this) */
|
|
|
|
#if defined(__GNUC__) && !defined(_EO_ADD_FALLBACK_FORCE)
|
|
|
|
|
2016-09-05 08:57:35 -07:00
|
|
|
# define efl_added __efl_added
|
2016-03-29 06:47:22 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
# define _efl_add_common(klass, parent, is_ref, ...) \
|
2016-03-11 04:24:11 -08:00
|
|
|
({ \
|
2016-09-05 08:57:35 -07:00
|
|
|
Eo * const __efl_added = _efl_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref, EINA_FALSE); \
|
2016-04-17 10:53:23 -07:00
|
|
|
(void) ((void)0, ##__VA_ARGS__); \
|
2016-09-05 08:57:35 -07:00
|
|
|
(Eo *) _efl_add_end(efl_added, is_ref, EINA_FALSE); \
|
2016-03-11 04:24:11 -08:00
|
|
|
})
|
Eo: Remove GCCism and make it more portable.
This affects eo_do() and eo_add() that used to use the ({}) GCCism.
Following a discussion with Peter de Ridder after my talk at FOSDEM,
we've decided to reopen the GCCism (works with other gcc compatible
compilers like clang and intelc) discussion, and after a bit of back and
forth it was decided to make things more portable, at the cost of ease
of use.
For example:
if (eo_do(obj, visible_get()))
is no longer allowed, the portable alternative
Eina_Bool tmp;
if (eo_do_ret(obj, tmp, visible_get()))
is to be used instead.
However:
eo_do(obj, a = a_get(), b = b_get(), bool_set(!bool_get))
are still allowed and OK.
eo_do(obj, if (a_get()) return;);
is no longer allowed, but:
eo_do(obj, if (a_get()) something());
is still allowed.
For clarity, this commit only incorporates the Eo changes, and not the
EFL changes to make the efl conform with this change.
Thanks again to Peter de Ridder for triggering this important discussion
which led to this change.
2015-02-23 08:06:40 -08:00
|
|
|
|
2016-03-29 06:47:22 -07:00
|
|
|
#else
|
|
|
|
|
2016-09-05 08:57:35 -07:00
|
|
|
# define efl_added _efl_added_get()
|
2016-03-29 06:47:22 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
# define _efl_add_common(klass, parent, is_ref, ...) \
|
2016-03-29 06:47:22 -07:00
|
|
|
( \
|
2016-08-15 06:44:41 -07:00
|
|
|
_efl_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref, EINA_TRUE), \
|
2016-03-29 06:47:22 -07:00
|
|
|
##__VA_ARGS__, \
|
2016-09-05 08:57:35 -07:00
|
|
|
(Eo *) _efl_add_end(efl_added, is_ref, EINA_TRUE) \
|
2016-03-29 06:47:22 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2012-08-23 03:35:14 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_add
|
2015-03-06 07:35:45 -08:00
|
|
|
* @brief Create a new object and call its constructor(If it exits).
|
2014-09-25 07:51:17 -07:00
|
|
|
*
|
2015-03-06 07:35:45 -08:00
|
|
|
* The object returned by this function will always have 1 ref
|
|
|
|
* (reference count) irrespective of whether the parent is NULL or
|
|
|
|
* not.
|
|
|
|
* If the object is created using this function, then it would
|
|
|
|
* automatically gets deleted when the parent object is deleted.
|
2016-08-15 06:44:41 -07:00
|
|
|
* There is no need to call efl_unref on the child. This is convenient
|
2015-03-06 07:35:45 -08:00
|
|
|
* in C.
|
2014-09-25 07:51:17 -07:00
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* If you want a more "consistent" behaviour, take a look at #efl_add_ref.
|
2014-09-25 07:51:17 -07:00
|
|
|
*
|
2012-08-23 03:35:14 -07:00
|
|
|
* @param klass the class of the object to create.
|
|
|
|
* @param parent the parent to set to the object.
|
|
|
|
* @param ... The ops to run.
|
|
|
|
* @return An handle to the new object on success, NULL otherwise.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_add(klass, parent, ...) _efl_add_common(klass, parent, EINA_FALSE, ##__VA_ARGS__)
|
2012-08-23 03:35:14 -07:00
|
|
|
|
2014-09-25 07:51:17 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_add_ref
|
2015-03-06 07:35:45 -08:00
|
|
|
* @brief Create a new object and call its constructor(If it exists).
|
2014-09-25 07:51:17 -07:00
|
|
|
*
|
|
|
|
* The object returned by this function has 1 ref for itself, 1 ref from the
|
|
|
|
* parent (if exists) and possible other refs if were added during construction.
|
2015-03-06 07:35:45 -08:00
|
|
|
* If a child object is created using this, then it won't get deleted
|
|
|
|
* when the parent object is deleted until you manually remove the ref
|
2016-08-15 06:44:41 -07:00
|
|
|
* by calling efl_unref().
|
2014-09-25 07:51:17 -07:00
|
|
|
*
|
|
|
|
* @param klass the class of the object to create.
|
|
|
|
* @param parent the parent to set to the object.
|
|
|
|
* @param ... The ops to run.
|
|
|
|
* @return An handle to the new object on success, NULL otherwise.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_add_ref(klass, parent, ...) _efl_add_common(klass, parent, EINA_TRUE, ##__VA_ARGS__)
|
2014-09-25 07:51:17 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eo * _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, Eo *parent, Eina_Bool ref, Eina_Bool is_fallback);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
2013-03-19 23:56:15 -07:00
|
|
|
/**
|
|
|
|
* @brief Get a pointer to the data of an object for a specific class.
|
|
|
|
* The data reference count is not incremented. The pointer must be used only
|
|
|
|
* in the scope of the function and its callees.
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* @param klass the klass associated with the data.
|
|
|
|
* @return a pointer to the data.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_data_ref()
|
|
|
|
* @see efl_data_unref()
|
2013-03-19 23:56:15 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void *efl_data_scope_get(const Eo *obj, const Efl_Class *klass);
|
2013-03-19 23:56:15 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_data_xref(obj, klass, ref_obj)
|
2013-03-19 23:56:15 -07:00
|
|
|
* Use this macro if you want to associate a referencer object.
|
2016-08-15 06:44:41 -07:00
|
|
|
* Convenience macro around efl_data_xref_internal()
|
2013-03-19 23:56:15 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_data_xref(obj, klass, ref_obj) efl_data_xref_internal(__FILE__, __LINE__, obj, klass, ref_obj)
|
2013-03-19 23:56:15 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_data_ref(obj, klass)
|
2013-03-19 23:56:15 -07:00
|
|
|
* Use this macro if you don't want to associate a referencer object.
|
2016-08-15 06:44:41 -07:00
|
|
|
* Convenience macro around efl_data_xref_internal()
|
2013-03-19 23:56:15 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_data_ref(obj, klass) efl_data_xref_internal(__FILE__, __LINE__, obj, klass, (const Eo *)obj)
|
2013-03-19 23:56:15 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get a pointer to the data of an object for a specific class and
|
|
|
|
* increment the data reference count.
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* @param klass the klass associated with the data.
|
|
|
|
* @param ref_obj the object that references the data.
|
|
|
|
* @param file the call's filename.
|
|
|
|
* @param line the call's line number.
|
|
|
|
* @return a pointer to the data.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_data_xunref_internal()
|
2013-03-19 23:56:15 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void *efl_data_xref_internal(const char *file, int line, const Eo *obj, const Efl_Class *klass, const Eo *ref_obj);
|
2013-03-19 23:56:15 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_data_xunref(obj, data, ref_obj)
|
|
|
|
* Use this function if you used efl_data_xref to reference the data.
|
|
|
|
* Convenience macro around efl_data_xunref_internal()
|
|
|
|
* @see efl_data_xref()
|
2013-03-19 23:56:15 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_data_xunref(obj, data, ref_obj) efl_data_xunref_internal(obj, data, ref_obj)
|
2013-03-19 23:56:15 -07:00
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_data_unref(obj, data)
|
|
|
|
* Use this function if you used efl_data_ref to reference the data.
|
|
|
|
* Convenience macro around efl_data_unref_internal()
|
|
|
|
* @see efl_data_ref()
|
2013-03-19 23:56:15 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_data_unref(obj, data) efl_data_xunref_internal(obj, data, obj)
|
2013-03-19 23:56:15 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Decrement the object data reference count by 1.
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* @param data a pointer to the data to unreference
|
|
|
|
* @param file the call's filename.
|
|
|
|
* @param line the call's line number.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_data_xref_internal()
|
2013-03-19 23:56:15 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void efl_data_xunref_internal(const Eo *obj, void *data, const Eo *ref_obj);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Increment the object's reference count by 1.
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* @return The object passed.
|
|
|
|
*
|
|
|
|
* It's very easy to get a refcount leak and start leaking memory because
|
2016-08-15 06:44:41 -07:00
|
|
|
* of a forgotten unref or an extra ref. That is why there are efl_xref
|
|
|
|
* and efl_xunref that will make debugging easier in such a case.
|
2012-05-01 00:40:14 -07:00
|
|
|
* Therefor, these functions should only be used in small scopes, i.e at the
|
|
|
|
* start of some section in which the object may get freed, or if you know
|
|
|
|
* what you are doing.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_unref()
|
|
|
|
* @see efl_ref_get()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eo *efl_ref(const Eo *obj);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Decrement the object's reference count by 1 and free it if needed.
|
|
|
|
* @param obj the object to work on.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_ref()
|
|
|
|
* @see efl_ref_get()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void efl_unref(const Eo *obj);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Return the ref count of the object passed.
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* @return the ref count of the object.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_ref()
|
|
|
|
* @see efl_unref()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI int efl_ref_get(const Eo *obj);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
2016-03-07 23:57:22 -08:00
|
|
|
/**
|
|
|
|
* @brief Set a deletion interceptor function
|
|
|
|
* @param obj The object to set the interceptor on
|
|
|
|
* @param del_intercept_func The interceptor function to call
|
|
|
|
*
|
|
|
|
* This sets the function @p del_intercept_func to be called when an object
|
|
|
|
* is about to go from a reference count of 1 to 0, thus triggering actual
|
|
|
|
* destruction of the object. Instead of going to a reference count of 0 and
|
|
|
|
* being destroyed, the object will stay alive with a reference count of 1
|
|
|
|
* and this intercept function will be called instead. It is the job of
|
|
|
|
* this interceptor function to handle any further deletion of of the object
|
|
|
|
* from here.
|
|
|
|
*
|
|
|
|
* Note that by default objects have no interceptor function set, and thus
|
|
|
|
* will be destroyed as normal. To return an object to this state, simply
|
|
|
|
* set the @p del_intercept_func to NULL which is the default.
|
|
|
|
*
|
|
|
|
* A good use for this feature is to ensure an object is destroyed by its
|
|
|
|
* owning main loop and not in a foreign loop. This makes it possible to
|
|
|
|
* safely unrefor delete objects from any loop as an interceptor can be set
|
|
|
|
* on an object that will abort destruction and instead queue the object
|
|
|
|
* on its owning loop to be destroyed at some time in the future and now
|
|
|
|
* set the intercept function to NULL so it is not called again on the next
|
|
|
|
* "real deletion".
|
|
|
|
*
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see efl_del_intercept_get()
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_unref()
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see efl_del()
|
2016-03-07 23:57:22 -08:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void efl_del_intercept_set(Eo *obj, Efl_Del_Intercept del_intercept_func);
|
2016-03-07 23:57:22 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the deletion interceptor function
|
|
|
|
* @param obj The object to get the interceptor of
|
|
|
|
* @return The intercept function or NULL if none is set.
|
|
|
|
*
|
2016-08-09 06:10:05 -07:00
|
|
|
* This returns the interceptor function set by efl_del_intercept_set(). Note
|
2016-03-07 23:57:22 -08:00
|
|
|
* that objects by default have no interceptor (NULL) set, but certain
|
|
|
|
* classes may set one up in a constructor, so it is important to be able
|
|
|
|
* to get the interceptor function to know if this has happend and
|
|
|
|
* if you want to override this interceptor, be sure to call it after your
|
|
|
|
* own interceptor function has finished. It would generally be a bad idea
|
|
|
|
* though to override these functions.
|
|
|
|
*
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see efl_del_intercept_set()
|
2016-03-07 23:57:22 -08:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Efl_Del_Intercept efl_del_intercept_get(const Eo *obj);
|
2016-03-07 23:57:22 -08:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_xref(obj, ref_obj)
|
|
|
|
* Convenience macro around efl_xref_internal()
|
|
|
|
* @see efl_xref()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_xref(obj, ref_obj) efl_xref_internal(__FILE__, __LINE__, obj, ref_obj)
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Increment the object's reference count by 1 (and associate the ref with ref_obj)
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* @param ref_obj the object that references obj.
|
|
|
|
* @param file the call's filename.
|
|
|
|
* @param line the call's line number.
|
|
|
|
* @return The object passed (obj)
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* People should not use this function, use #efl_xref instead.
|
2012-05-01 06:23:25 -07:00
|
|
|
* A compile flag my make it and eobj_xunref() behave the same as eobj_ref()
|
|
|
|
* and eobj_unref() respectively. So this should be used wherever possible.
|
2012-05-01 00:40:14 -07:00
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_xunref()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eo *efl_xref_internal(const char *file, int line, Eo *obj, const Eo *ref_obj);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Decrement the object's reference count by 1 and free it if needed. Will free the ref associated with ref_obj).
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* @param ref_obj the object that references obj.
|
|
|
|
*
|
|
|
|
* This function only enforces the checks for object association. I.e don't rely
|
|
|
|
* on it. If such enforces are compiled out, this function behaves the same as
|
2016-08-15 06:44:41 -07:00
|
|
|
* efl_unref().
|
2012-05-01 00:40:14 -07:00
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_xref_internal()
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void efl_xunref(Eo *obj, const Eo *ref_obj);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
2012-06-10 07:05:00 -07:00
|
|
|
/**
|
|
|
|
* @brief Enable or disable the manual free feature.
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* @param manual_free indicates if the free is manual (EINA_TRUE) or automatic (EINA_FALSE).
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* The developer is in charge to call the function efl_manual_free to free the memory allocated for this object.
|
2012-06-10 07:05:00 -07:00
|
|
|
*
|
|
|
|
* Do not use, unless you really know what you are doing. It's used by Evas
|
|
|
|
* because evas wants to keep its private data available even after the object
|
|
|
|
* is deleted. Setting this to true makes Eo destruct the object but not free
|
|
|
|
* the private data or the object itself.
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_manual_free()
|
2012-06-10 07:05:00 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI void efl_manual_free_set(Eo *obj, Eina_Bool manual_free);
|
2012-06-10 07:05:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Frees the object.
|
|
|
|
* @param obj the object to work on.
|
|
|
|
* This function must be called by the developer if the function
|
2016-08-15 06:44:41 -07:00
|
|
|
* efl_manual_free_set has been called before with the parameter EINA_TRUE.
|
2012-06-10 07:05:00 -07:00
|
|
|
* An error will be printed if this function is called when the manual
|
|
|
|
* free option is not set to EINA_TRUE or the number of refs is not 0.
|
2013-11-26 04:10:53 -08:00
|
|
|
* @return EINA_TRUE if successfully freed. EINA_FALSE otherwise.
|
2012-06-10 07:05:00 -07:00
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_manual_free_set()
|
2012-06-10 07:05:00 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eina_Bool efl_manual_free(Eo *obj);
|
2012-06-10 07:05:00 -07:00
|
|
|
|
2012-09-12 04:31:58 -07:00
|
|
|
/**
|
|
|
|
* @brief Checks if the object was already descructed (only relevant for manual_free objects).
|
|
|
|
* @param obj the object to check.
|
|
|
|
* This function checks if the object was already destructed (but not alraedy
|
|
|
|
* freed). It should only be used with objects that are supposed to be manually
|
|
|
|
* freed, but not yet freed (but possibly destructed).
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_manual_free_set()
|
2012-09-12 04:31:58 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI Eina_Bool efl_destructed_is(const Eo *obj);
|
2012-09-12 04:31:58 -07:00
|
|
|
|
2013-10-12 14:51:59 -07:00
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @addtogroup Efl_Class_Class Eo's Class class.
|
2013-10-12 14:51:59 -07:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
#include "efl_class.eo.h"
|
2013-10-12 14:51:59 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @addtogroup Efl_Class_Base Eo's Base class.
|
2012-05-01 00:40:14 -07:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @typedef efl_key_data_free_func
|
2012-05-01 00:40:14 -07:00
|
|
|
* Data free func prototype.
|
2015-05-28 09:47:33 -07:00
|
|
|
* XXX: DO NOT USE, only here for legacy.
|
2012-05-01 00:40:14 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
typedef void (*efl_key_data_free_func)(void *);
|
2012-05-01 00:40:14 -07:00
|
|
|
|
2012-12-30 04:26:25 -08:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_weak_ref
|
2012-12-30 04:26:25 -08:00
|
|
|
* @brief Reference a pointer to an Eo object
|
|
|
|
* @param wref the pointer to use for the weak ref
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_weak_unref
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see efl_wref_add
|
2012-12-30 04:26:25 -08:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_weak_ref(wref) \
|
2013-12-25 06:19:07 -08:00
|
|
|
do { \
|
2016-08-09 06:10:05 -07:00
|
|
|
if (*wref) efl_wref_add(*wref, wref); \
|
2013-12-26 11:42:18 -08:00
|
|
|
} while (0)
|
2012-12-30 04:26:25 -08:00
|
|
|
|
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def efl_weak_unref
|
2012-12-30 04:26:25 -08:00
|
|
|
* @brief Unreference a pointer to an Eo object
|
|
|
|
* @param wref the pointer to use for the weak unref
|
|
|
|
*
|
2016-08-15 06:44:41 -07:00
|
|
|
* @see efl_weak_ref
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see efl_wref_del
|
|
|
|
* @see efl_wref_del_safe
|
2012-12-30 04:26:25 -08:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_weak_unref(wref) \
|
2013-12-25 06:19:07 -08:00
|
|
|
do { \
|
2016-08-09 06:10:05 -07:00
|
|
|
if (*wref) efl_wref_del(*wref, wref); \
|
2013-12-26 11:42:18 -08:00
|
|
|
} while (0)
|
2012-12-30 04:26:25 -08:00
|
|
|
|
2012-05-01 04:25:03 -07:00
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @def efl_wref_del_safe
|
2012-05-01 04:25:03 -07:00
|
|
|
* @brief Delete the weak reference passed.
|
|
|
|
* @param wref the weak reference to free.
|
|
|
|
*
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see #efl_wref_del
|
2012-05-01 04:25:03 -07:00
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define efl_wref_del_safe(wref) efl_weak_unref(wref)
|
2012-05-01 04:25:03 -07:00
|
|
|
|
2012-05-14 00:35:19 -07:00
|
|
|
/**
|
2016-08-30 05:34:10 -07:00
|
|
|
* @addtogroup Efl_Events Eo's Event Handling
|
2012-05-14 00:35:19 -07:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2014-05-19 07:17:08 -07:00
|
|
|
/**
|
|
|
|
* Don't use.
|
2015-09-28 16:45:34 -07:00
|
|
|
* The values of the returned event structure are also internal, don't assume
|
|
|
|
* anything about them.
|
2014-05-19 07:17:08 -07:00
|
|
|
* @internal
|
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
EAPI const Efl_Event_Description *efl_object_legacy_only_event_description_get(const char *_event_name);
|
2014-05-19 07:17:08 -07:00
|
|
|
|
2012-05-14 00:35:19 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def EFL_CALLBACK_PRIORITY_BEFORE
|
2012-05-14 00:35:19 -07:00
|
|
|
* Slightly more prioritized than default.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_CALLBACK_PRIORITY_BEFORE -100
|
2012-05-14 00:35:19 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def EFL_CALLBACK_PRIORITY_DEFAULT
|
2012-05-14 00:35:19 -07:00
|
|
|
* Default callback priority level
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_CALLBACK_PRIORITY_DEFAULT 0
|
2012-05-14 00:35:19 -07:00
|
|
|
/**
|
2016-08-15 06:44:41 -07:00
|
|
|
* @def EFL_CALLBACK_PRIORITY_AFTER
|
2012-05-14 00:35:19 -07:00
|
|
|
* Slightly less prioritized than default.
|
|
|
|
*/
|
2016-08-15 06:44:41 -07:00
|
|
|
#define EFL_CALLBACK_PRIORITY_AFTER 100
|
2012-05-14 00:35:19 -07:00
|
|
|
|
2016-08-31 14:12:02 -07:00
|
|
|
/**
|
|
|
|
* Helper for sorting callbacks array. Automatically used by
|
|
|
|
* @ref EFL_CALLBACKS_ARRAY_DEFINE
|
|
|
|
*/
|
|
|
|
EAPI int efl_callbacks_cmp(const Efl_Callback_Array_Item *a, const Efl_Callback_Array_Item *b);
|
|
|
|
|
2015-05-01 07:36:13 -07:00
|
|
|
/**
|
|
|
|
* Helper for creating global callback arrays.
|
|
|
|
* The problem is on windows where you can't declare a static array with
|
|
|
|
* external symbols in it, because the addresses are only known at runtime.
|
2016-08-31 14:12:02 -07:00
|
|
|
* This also open up the possibility to automatically sort them for better
|
|
|
|
* performance.
|
2015-05-01 07:36:13 -07:00
|
|
|
*/
|
2016-08-31 14:12:02 -07:00
|
|
|
#define EFL_CALLBACKS_ARRAY_DEFINE(Name, ...) \
|
|
|
|
static Efl_Callback_Array_Item * \
|
2013-07-16 04:03:02 -07:00
|
|
|
Name(void) \
|
|
|
|
{ \
|
2016-09-05 09:51:07 -07:00
|
|
|
Efl_Callback_Array_Item tmp[] = { __VA_ARGS__ }; \
|
|
|
|
static Efl_Callback_Array_Item internal[EINA_C_ARRAY_LENGTH(tmp) + 1] = \
|
|
|
|
{ { 0, 0 } }; \
|
2013-07-16 04:03:02 -07:00
|
|
|
if (internal[0].desc == NULL) \
|
|
|
|
{ \
|
2016-09-05 09:51:07 -07:00
|
|
|
memcpy(internal, tmp, sizeof(tmp)); \
|
2016-09-05 08:25:34 -07:00
|
|
|
qsort(internal, EINA_C_ARRAY_LENGTH(internal) - 1, sizeof (internal[0]), \
|
2016-08-31 14:12:02 -07:00
|
|
|
(void*) efl_callbacks_cmp); \
|
2013-07-16 04:03:02 -07:00
|
|
|
} \
|
|
|
|
return internal; \
|
|
|
|
}
|
|
|
|
|
2012-05-14 00:35:19 -07:00
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @def efl_event_callback_add(obj, desc, cb, data)
|
2012-05-14 00:35:19 -07:00
|
|
|
* Add a callback for an event.
|
2012-05-15 07:17:10 -07:00
|
|
|
* @param[in] desc The description of the event to listen to.
|
|
|
|
* @param[in] cb the callback to call.
|
|
|
|
* @param[in] data additional data to pass to the callback.
|
2012-05-14 00:35:19 -07:00
|
|
|
*
|
|
|
|
* callbacks of the same priority are called in reverse order of creation.
|
|
|
|
*
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see efl_event_callback_priority_add()
|
2012-05-14 00:35:19 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
#define efl_event_callback_add(obj, desc, cb, data) \
|
|
|
|
efl_event_callback_priority_add(obj, desc, \
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CALLBACK_PRIORITY_DEFAULT, cb, data)
|
2012-05-14 00:35:19 -07:00
|
|
|
|
2013-04-12 03:06:30 -07:00
|
|
|
/**
|
2016-08-09 06:10:05 -07:00
|
|
|
* @def efl_event_callback_array_add(obj, desc, cb, data)
|
2016-08-31 14:12:02 -07:00
|
|
|
* Add an array of callbacks for an event.
|
|
|
|
*
|
2016-08-09 06:10:05 -07:00
|
|
|
* @param[in] array an #Efl_Callback_Array_Item of events to listen to.
|
2013-04-12 03:06:30 -07:00
|
|
|
* @param[in] data additional data to pass to the callback.
|
|
|
|
*
|
2016-08-31 14:12:02 -07:00
|
|
|
* Callbacks of the same priority are called in reverse order of creation.
|
|
|
|
* The array should have been created by @ref EFL_CALLBACKS_ARRAY_DEFINE. If
|
|
|
|
* that wasn't the case, be careful of portability issue and make sure that
|
|
|
|
* it is properly sorted with @ref efl_callbacks_cmp.
|
2013-04-12 03:06:30 -07:00
|
|
|
*
|
2016-08-09 06:10:05 -07:00
|
|
|
* @see efl_event_callback_array_priority_add()
|
2013-04-12 03:06:30 -07:00
|
|
|
*/
|
2016-08-09 06:10:05 -07:00
|
|
|
#define efl_event_callback_array_add(obj, array, data) \
|
|
|
|
efl_event_callback_array_priority_add(obj, array, \
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_CALLBACK_PRIORITY_DEFAULT, data)
|
2013-04-12 03:06:30 -07:00
|
|
|
|
2012-05-14 00:35:19 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2016-07-28 08:00:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
/* Private for EFL internal use only. Do not use these! */
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI int ___efl_ref2_get(const Eo *obj_id);
|
|
|
|
EAPI void ___efl_ref2_reset(const Eo *obj_id);
|
2016-07-28 08:00:49 -07:00
|
|
|
|
2016-08-02 08:14:12 -07:00
|
|
|
#endif
|
|
|
|
|
2013-07-28 04:16:51 -07:00
|
|
|
#ifdef __cplusplus
|
2015-04-28 07:52:13 -07:00
|
|
|
}
|
2012-05-01 00:40:14 -07:00
|
|
|
#endif
|
2013-07-22 19:26:58 -07:00
|
|
|
|
2015-04-28 07:52:13 -07:00
|
|
|
#undef EAPI
|
|
|
|
#define EAPI
|
|
|
|
|
2013-07-22 19:26:58 -07:00
|
|
|
#endif
|