Data Structures | Macros | Typedefs | Enumerations | Functions
Efl Class

Data Structures

struct  _Efl_Op_Description
 
struct  _Efl_Object_Ops
 This structure holds the ops and the size of the ops. More...
 
struct  _Efl_Class_Description
 This structure holds the class description. More...
 
struct  _Efl_Object_Property_Reflection
 This structure holds one line of the reflection table. More...
 
struct  _Efl_Object_Property_Reflection_Ops
 This structure holds the reflection table and the size of this table. More...
 

Macros

#define EFL_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...)
 A convenient macro to be used for creating the class_get function. More...
 
#define EO_VERSION   2
 The current version of EO.
 
#define EFL_OPS_DEFINE(ops, ...)
 Define an array of override functions for efl_object_override. More...
 

Typedefs

typedef enum _Efl_Class_Type Efl_Class_Type
 A convenience typedef for _Efl_Class_Type.
 
typedef struct _Efl_Op_Description Efl_Op_Description
 
typedef struct _Efl_Object_Ops Efl_Object_Ops
 
typedef Eina_Error(* Efl_Object_Property_Reflection_Setter) (Eo *obj, Eina_Value value)
 Setter type which is used to set an Eina_Value, this function should access one particular property field.
 
typedef Eina_Value(* Efl_Object_Property_Reflection_Getter) (const Eo *obj)
 Getter type which is used to get an Eina_Value, this function should access one particular property field.
 
typedef struct _Efl_Object_Property_Reflection Efl_Object_Property_Reflection
 
typedef struct _Efl_Object_Property_Reflection_Ops Efl_Object_Property_Reflection_Ops
 
typedef struct _Efl_Class_Description Efl_Class_Description
 A convenience typedef for _Efl_Class_Description.
 

Enumerations

enum  _Efl_Class_Type {
  EFL_CLASS_TYPE_REGULAR = 0,
  EFL_CLASS_TYPE_REGULAR_NO_INSTANT,
  EFL_CLASS_TYPE_INTERFACE,
  EFL_CLASS_TYPE_MIXIN,
  EFL_CLASS_TYPE_INVALID
}
 An enum representing the possible types of an Eo class. More...
 

Functions

EAPI const Efl_Classefl_class_new (const Efl_Class_Description *desc, const Efl_Class *parent,...)
 Create a new class. More...
 
EAPI Eina_Bool efl_class_functions_set (const Efl_Class *klass_id, const Efl_Object_Ops *object_ops, const Efl_Object_Property_Reflection_Ops *reflection_table)
 Set the functions of a class. More...
 
EAPI Eina_Bool efl_object_override (Eo *obj, const Efl_Object_Ops *ops)
 Override Eo functions of this object. More...
 
EAPI Eina_Bool efl_isa (const Eo *obj, const Efl_Class *klass)
 Check if an object "is a" klass. More...
 
EAPI const char * efl_class_name_get (const Efl_Class *klass)
 Gets the name of the passed class. More...
 
EAPI size_t efl_class_memory_size_get (const Efl_Class *klass)
 Gets the amount of memory this class object would use. More...
 
EAPI const char * efl_debug_name_get (const Eo *obj_id)
 Gets a debug name for this object. More...
 

Detailed Description

Macro Definition Documentation

◆ EFL_DEFINE_CLASS

#define EFL_DEFINE_CLASS (   class_get_func_name,
  class_desc,
  parent_class,
  ... 
)
Value:
const Efl_Class * \
class_get_func_name(void) \
{ \
const Efl_Class *_tmp_parent_class; \
static const Efl_Class * volatile _my_class = NULL; \
static unsigned int _my_init_generation = 1; \
if (EINA_UNLIKELY(_efl_object_init_generation != _my_init_generation)) \
{ \
_my_class = NULL; /* It's freed in efl_object_shutdown(). */ \
} \
if (EINA_LIKELY(!!_my_class)) return _my_class; \
if (!!_my_class) \
{ \
eina_lock_release(&_efl_class_creation_lock); \
return _my_class; \
} \
_tmp_parent_class = parent_class; \
_my_class = efl_class_new(class_desc, _tmp_parent_class, __VA_ARGS__); \
_my_init_generation = _efl_object_init_generation; \
eina_lock_release(&_efl_class_creation_lock); \
\
return _my_class; \
}
EAPI const Efl_Class * efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent,...)
Create a new class.
Definition: eo.c:1479
EAPI Eina_Lock _efl_class_creation_lock
This variable is used for locking purposes in the class_get function defined in EFL_DEFINE_CLASS.
Definition: eo.c:41
#define EINA_UNLIKELY(exp)
Definition: eina_types.h:398
EAPI unsigned int _efl_object_init_generation
This variable stores the current eo init generation.
Definition: eo.c:42
#define EINA_LIKELY(exp)
Definition: eina_types.h:404
static Eina_Lock_Result eina_lock_take(Eina_Lock *mutex)
Attempts to take a lock.
Eo Efl_Class
The basic class type - should be removed, for compatibility reasons.
Definition: Eo.h:179

A convenient macro to be used for creating the class_get function.

This macro is fairly simple and makes for better code.

Parameters
class_get_func_namethe name of the wanted class_get function name.
class_descthe class description.
parent_classThe parent class for the function. See efl_class_new() for more information.
...List of extensions. See efl_class_new() for more information.

You must use this macro if you want thread safety in class creation.

◆ EFL_OPS_DEFINE

#define EFL_OPS_DEFINE (   ops,
  ... 
)
Value:
const Efl_Op_Description _##ops##_descs[] = { __VA_ARGS__ }; \
const Efl_Object_Ops ops = { _##ops##_descs, EINA_C_ARRAY_LENGTH(_##ops##_descs) }
#define EINA_C_ARRAY_LENGTH(arr)
Macro to return the array length of a standard c array.
Definition: eina_types.h:576
Definition: Eo.h:839
This structure holds the ops and the size of the ops.
Definition: Eo.h:850

Define an array of override functions for efl_object_override.

Parameters
opsA name for the Efl_Object_Ops local variable to define
...A comma separated list of Efl_Object_Op overrides, using #EFL_OBJECT_OP_FUNC or #EFL_OBJECT_OP_CLASS_FUNC

This can be used as follows:

EFL_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC(public_func, _my_func));
See also
efl_object_override

Enumeration Type Documentation

◆ _Efl_Class_Type

An enum representing the possible types of an Eo class.

Enumerator
EFL_CLASS_TYPE_REGULAR 

Regular class.

EFL_CLASS_TYPE_REGULAR_NO_INSTANT 

Regular non instant-able class.

EFL_CLASS_TYPE_INTERFACE 

Interface.

EFL_CLASS_TYPE_MIXIN 

Mixin.

Function Documentation

◆ efl_class_new()

EAPI const Efl_Class* efl_class_new ( const Efl_Class_Description desc,
const Efl_Class parent,
  ... 
)

Create a new class.

Parameters
descthe class description to create the class with.
parentthe class to inherit from.
...A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects).
Returns
The new class' handle on success or NULL otherwise.
Note
There are two types of extensions, mixins and none-mixins. Mixins are inheriting both the API AND the implementation. Non-mixins only inherit the API, so a class which inherits a non-mixin as an extension must implement the api.

Use EFL_DEFINE_CLASS. This will provide thread safety and other features easily.

See also
EFL_DEFINE_CLASS

References _efl_class_creation_lock, _Efl_Class_Description::data_size, DBG, efl_class_functions_set(), EFL_CLASS_TYPE_INTERFACE, EFL_CLASS_TYPE_MIXIN, EFL_CLASS_TYPE_REGULAR, EFL_CLASS_TYPE_REGULAR_NO_INSTANT, EINA_LIKELY, eina_list_append(), eina_list_count(), EINA_LIST_FOREACH, eina_list_free(), EINA_LIST_FREE, eina_list_prepend(), eina_list_remove(), eina_lock_release(), eina_lock_take(), EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_NULL_RETURN_VAL, eina_spinlock_new(), ERR, _Efl_Class_Description::name, and _Efl_Class_Description::type.

◆ efl_class_functions_set()

EAPI Eina_Bool efl_class_functions_set ( const Efl_Class klass_id,
const Efl_Object_Ops object_ops,
const Efl_Object_Property_Reflection_Ops reflection_table 
)

Set the functions of a class.

Parameters
klass_idthe class whose functions we are setting.
object_opsThe function structure we are setting for object functions
class_opsThe function structure we are setting for class functions
reflection_tableThe reflection table to use within eo
Returns
True on success, False otherwise.

This should only be called from within the initializer function. The reflection_table contains a getter and setter per property name. Which are called when either efl_property_reflection_set() or efl_property_reflection_get() is called.

See also
EFL_DEFINE_CLASS

References _Efl_Object_Ops::count, EFL_CLASS_TYPE_REGULAR, efl_ref(), efl_unref(), eina_cow_alloc(), EINA_FALSE, eina_hash_find(), eina_spinlock_release(), eina_spinlock_take(), eina_trash_pop(), EINA_TRUE, EINA_UNLIKELY, and ERR.

Referenced by efl_class_new().

◆ efl_object_override()

EAPI Eina_Bool efl_object_override ( Eo obj,
const Efl_Object_Ops ops 
)

Override Eo functions of this object.

Parameters
opsThe op description to override with.
Returns
true on success, false otherwise.

This lets you override all of the Eo functions of this object (this one included) and replace them with ad-hoc implementation. The contents of the array are copied so they can reside on the stack for instance.

You are only allowed to override functions that are defined in the class or any of its interfaces (that is, efl_isa returning true).

If ops is #NULL, this will revert the obj to its original class without any function overrides.

It is not possible to override a function table of an object when it's already been overridden. Call efl_object_override(obj, NULL) first if you really need to do that.

See also
EFL_OPS_DEFINE

References EINA_FALSE, EINA_TRUE, and ERR.

Referenced by efl_reuse().

◆ efl_isa()

EAPI Eina_Bool efl_isa ( const Eo obj,
const Efl_Class klass 
)

Check if an object "is a" klass.

Parameters
objThe object to check
klassThe klass to check against.
Returns
EINA_TRUE if obj implements klass or is an Efl_Class which inherits from/implements klass, EINA_FALSE otherwise.

Notice: This function does not support composite objects. Note: that an Efl_Class is also an Efl_Object, so if you pass an Efl_Class as obj, it will check if that class contain klass.

References EFL_ID_DOMAIN_SHARED, EINA_FALSE, EINA_LIKELY, eina_lock_release(), eina_lock_take(), EINA_TRUE, EINA_UNLIKELY, and ERR.

Referenced by ecore_con_client_fd_get(), ecore_con_client_flush(), ecore_con_server_fd_get(), ecore_con_server_flush(), ecore_con_ssl_client_upgrade(), ecore_con_ssl_server_upgrade(), ecore_exe_auto_limits_set(), ecore_exe_callback_pre_free_set(), ecore_exe_close_stdin(), ecore_exe_data_get(), ecore_exe_data_set(), ecore_exe_event_data_get(), ecore_exe_flags_get(), ecore_exe_free(), ecore_exe_hup(), ecore_exe_interrupt(), ecore_exe_kill(), ecore_exe_pid_get(), ecore_exe_quit(), ecore_exe_send(), ecore_exe_signal(), ecore_exe_tag_get(), ecore_exe_tag_set(), ecore_exe_terminate(), ecore_ipc_client_ip_get(), ecore_ipc_server_ip_get(), edje_edit_object_add(), edje_edit_sound_tones_list_get(), efl_class_override_register(), efl_del(), elm_config_focus_move_policy_get(), elm_ctxpopup_add(), elm_fileselector_button_path_set(), elm_fileselector_entry_path_set(), elm_flip_perspective_set(), elm_gengrid_add(), elm_gengrid_wheel_disabled_get(), elm_genlist_add(), elm_image_async_open_set(), elm_image_smooth_get(), elm_image_smooth_set(), elm_layout_edje_get(), elm_layout_edje_object_can_access_get(), elm_layout_signal_callback_add(), elm_layout_signal_callback_del(), elm_layout_text_set(), elm_object_domain_translatable_part_text_set(), elm_object_focus_next(), elm_object_focus_next_object_set(), elm_object_focus_region_show_mode_get(), elm_object_focus_region_show_mode_set(), elm_object_focus_set(), elm_object_focused_item_get(), elm_object_focused_object_get(), elm_object_item_data_get(), elm_object_orientation_mode_disabled_get(), elm_object_orientation_mode_disabled_set(), elm_object_scroll_item_loop_enabled_get(), elm_object_scroll_item_loop_enabled_set(), elm_object_translatable_part_text_get(), elm_win_inwin_add(), elm_win_resize_object_add(), emotion_object_add(), evas_device_parent_get(), evas_event_feed_axis_update(), evas_event_feed_key_down(), evas_event_feed_key_down_with_keycode(), evas_event_feed_key_up(), evas_event_feed_key_up_with_keycode(), evas_event_feed_mouse_cancel(), evas_event_feed_mouse_down(), evas_event_feed_mouse_in(), evas_event_feed_mouse_move(), evas_event_feed_mouse_out(), evas_event_feed_mouse_up(), evas_event_feed_mouse_wheel(), evas_event_input_mouse_move(), evas_event_refeed_event(), evas_event_thaw_eval(), evas_object_box_add(), evas_object_data_del(), evas_object_data_get(), evas_object_data_set(), evas_object_del(), evas_object_grid_add(), evas_object_image_add(), evas_object_name_get(), evas_object_name_set(), evas_object_polygon_add(), evas_object_propagate_events_get(), evas_object_rectangle_add(), evas_object_smart_add(), evas_object_smart_clipped_clipper_get(), evas_object_smart_move_children_relative(), evas_object_smart_type_check(), evas_object_smart_type_check_ptr(), evas_object_table_add(), evas_object_text_add(), evas_object_textgrid_add(), evas_object_top_at_pointer_get(), and evas_textblock_text_utf8_to_markup().

◆ efl_class_name_get()

EAPI const char* efl_class_name_get ( const Efl_Class klass)

Gets the name of the passed class.

Parameters
[in]klassThe class (or object) to work on.
Returns
The class' name.
See also
efl_class_get()

Referenced by ecore_con_server_add(), ecore_con_server_connect(), efl_del(), efl_future_chain_array(), efl_object_shutdown(), elm_object_item_data_get(), and evas_object_del().

◆ efl_class_memory_size_get()

EAPI size_t efl_class_memory_size_get ( const Efl_Class klass)

◆ efl_debug_name_get()

EAPI const char* efl_debug_name_get ( const Eo obj_id)

Gets a debug name for this object.

Parameters
obj_idThe object (or class)
Returns
A name to use in logs and for other debugging purposes

Note that subclasses can override Efl.Object "debug_name_override" to provide more meaningful debug strings. The standard format includes the class name, the object ID (this obj_id), the reference count and optionally the object name (as defined by Efl.Object.name).

This might return a temporary string, as created by eina_slstr, which means that a main loop should probably be running.

Since
1.21

References efl_cast(), EFL_CLASS_TYPE_INTERFACE, EFL_CLASS_TYPE_MIXIN, EFL_CLASS_TYPE_REGULAR, EFL_CLASS_TYPE_REGULAR_NO_INSTANT, efl_super(), EINA_FALSE, eina_strbuf_append_printf(), and eina_strbuf_new().

Referenced by efl_del(), and evas_object_smart_callback_description_find().