forked from enlightenment/efl
eo2: add virtual func support
This commit is contained in:
parent
ca5221e0f9
commit
1aa3b1536f
|
@ -659,10 +659,12 @@ typedef struct _Eo2_Op_Call_Data
|
||||||
|
|
||||||
// OP ID of an overriding function
|
// OP ID of an overriding function
|
||||||
#define EO2_OP_OVERRIDE ((Eo_Op) -1)
|
#define EO2_OP_OVERRIDE ((Eo_Op) -1)
|
||||||
|
#define EO2_OP_VIRTUAL ((Eo_Op) -2)
|
||||||
|
|
||||||
#define EO2_OP_FUNC(_private, _api, _doc) {_private, _api, EO_NOOP, EO_OP_TYPE_REGULAR, _doc}
|
#define EO2_OP_FUNC(_private, _api, _doc) {_private, _api, EO_NOOP, EO_OP_TYPE_REGULAR, _doc}
|
||||||
#define EO2_OP_CLASS_FUNC(_private, _api, _doc) {_private, _api, EO_NOOP, EO_OP_TYPE_CLASS, _doc}
|
#define EO2_OP_CLASS_FUNC(_private, _api, _doc) {_private, _api, EO_NOOP, EO_OP_TYPE_CLASS, _doc}
|
||||||
#define EO2_OP_FUNC_OVERRIDE(_private, _api) {_private, _api, EO2_OP_OVERRIDE, EO_OP_TYPE_REGULAR, NULL}
|
#define EO2_OP_FUNC_OVERRIDE(_private, _api) {_private, _api, EO2_OP_OVERRIDE, EO_OP_TYPE_REGULAR, NULL}
|
||||||
|
#define EO2_OP_FUNC_VIRTUAL(_api, _doc) {NULL, _api, EO2_OP_VIRTUAL, EO_OP_TYPE_REGULAR, _doc}
|
||||||
#define EO2_OP_SENTINEL { NULL, NULL, 0, EO_OP_TYPE_INVALID, NULL}
|
#define EO2_OP_SENTINEL { NULL, NULL, 0, EO_OP_TYPE_INVALID, NULL}
|
||||||
|
|
||||||
// returns the OP id corresponding to the given api_func
|
// returns the OP id corresponding to the given api_func
|
||||||
|
|
|
@ -382,9 +382,17 @@ eo2_call_resolve_internal(const Eo_Class *klass_id, Eo_Op op, Eo2_Op_Call_Data *
|
||||||
else
|
else
|
||||||
klass = fptr->cur_klass;
|
klass = fptr->cur_klass;
|
||||||
|
|
||||||
func = _eo_kls_itr_func_get(klass, op);
|
if (!klass)
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
func = _dich_func_get(klass, op);
|
||||||
if (EINA_LIKELY(func != NULL))
|
if (EINA_LIKELY(func != NULL))
|
||||||
{
|
{
|
||||||
|
if (func->func == NULL)
|
||||||
|
{
|
||||||
|
ERR("you called a pure virtual func");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
call->obj_id = fptr->obj_id;
|
call->obj_id = fptr->obj_id;
|
||||||
call->func = func->func;
|
call->func = func->func;
|
||||||
|
|
||||||
|
@ -496,6 +504,11 @@ eo2_class_funcs_set(Eo_Class *klass_id)
|
||||||
op_desc->op = op_id;
|
op_desc->op = op_id;
|
||||||
op_id++;
|
op_id++;
|
||||||
}
|
}
|
||||||
|
else if (op_desc->op == EO2_OP_VIRTUAL)
|
||||||
|
{
|
||||||
|
op_desc->op = op_id;
|
||||||
|
op_id++;
|
||||||
|
}
|
||||||
else if (op_desc->op == EO2_OP_OVERRIDE)
|
else if (op_desc->op == EO2_OP_OVERRIDE)
|
||||||
{
|
{
|
||||||
if (klass->parent == NULL)
|
if (klass->parent == NULL)
|
||||||
|
|
Loading…
Reference in New Issue