forked from enlightenment/efl
Eobj: added default constructor/destructor.
When NULL is passed, the default one is called. SVN revision: 70001
This commit is contained in:
parent
61dc86ec9d
commit
fc75687bc7
|
@ -17,18 +17,6 @@ _prot_print(Eobj *obj, Eobj_Op op, va_list *list)
|
|||
printf("%s %d\n", __func__, pd->protected_x1);
|
||||
}
|
||||
|
||||
static void
|
||||
_constructor(Eobj *obj)
|
||||
{
|
||||
eobj_constructor_super(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_destructor(Eobj *obj)
|
||||
{
|
||||
eobj_destructor_super(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_class_constructor(Eobj_Class *klass)
|
||||
{
|
||||
|
@ -56,8 +44,8 @@ inherit_class_get(void)
|
|||
EOBJ_CLASS_DESCRIPTION_OPS(&INHERIT_BASE_ID, op_desc, INHERIT_SUB_ID_LAST),
|
||||
NULL,
|
||||
0,
|
||||
_constructor,
|
||||
_destructor,
|
||||
NULL,
|
||||
NULL,
|
||||
_class_constructor,
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -31,18 +31,6 @@ _a_set(Eobj *obj, Eobj_Op op, va_list *list)
|
|||
eobj_event_callback_call(obj, SIG_A_CHANGED, &pd->a);
|
||||
}
|
||||
|
||||
static void
|
||||
_constructor(Eobj *obj)
|
||||
{
|
||||
eobj_constructor_super(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_destructor(Eobj *obj)
|
||||
{
|
||||
eobj_destructor_super(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_class_constructor(Eobj_Class *klass)
|
||||
{
|
||||
|
@ -75,8 +63,8 @@ simple_class_get(void)
|
|||
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
||||
event_desc,
|
||||
sizeof(Private_Data),
|
||||
_constructor,
|
||||
_destructor,
|
||||
NULL,
|
||||
NULL,
|
||||
_class_constructor,
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -12,12 +12,6 @@ _constructor(Eobj *obj)
|
|||
eobj_constructor_error_set(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_destructor(Eobj *obj)
|
||||
{
|
||||
eobj_destructor_super(obj);
|
||||
}
|
||||
|
||||
const Eobj_Class *
|
||||
simple2_class_get(void)
|
||||
{
|
||||
|
@ -30,7 +24,7 @@ simple2_class_get(void)
|
|||
NULL,
|
||||
0,
|
||||
_constructor,
|
||||
_destructor,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -10,12 +10,6 @@ _constructor(Eobj *obj)
|
|||
(void) obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_destructor(Eobj *obj)
|
||||
{
|
||||
eobj_destructor_super(obj);
|
||||
}
|
||||
|
||||
const Eobj_Class *
|
||||
simple3_class_get(void)
|
||||
{
|
||||
|
@ -28,7 +22,7 @@ simple3_class_get(void)
|
|||
NULL,
|
||||
0,
|
||||
_constructor,
|
||||
_destructor,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -5,18 +5,6 @@
|
|||
|
||||
static Eobj_Class *_my_class = NULL;
|
||||
|
||||
static void
|
||||
_constructor(Eobj *obj)
|
||||
{
|
||||
eobj_constructor_super(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_destructor(Eobj *obj)
|
||||
{
|
||||
eobj_destructor_super(obj);
|
||||
}
|
||||
|
||||
const Eobj_Class *
|
||||
simple4_class_get(void)
|
||||
{
|
||||
|
@ -28,8 +16,8 @@ simple4_class_get(void)
|
|||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||
NULL,
|
||||
0,
|
||||
_constructor,
|
||||
_destructor,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -39,17 +39,6 @@ _constructor(Eobj *obj)
|
|||
eobj_evas_object_set(obj, wd->bx);
|
||||
}
|
||||
|
||||
static void
|
||||
_destructor(Eobj *obj)
|
||||
{
|
||||
eobj_destructor_super(obj);
|
||||
|
||||
//Widget_Data *wd = eobj_data_get(obj, _my_class);
|
||||
/* FIXME: Commented out because it's automatically done because our tree
|
||||
* is not made of only eobj */
|
||||
// evas_object_del(wd->bx);
|
||||
}
|
||||
|
||||
static void
|
||||
_class_constructor(Eobj_Class *klass)
|
||||
{
|
||||
|
@ -78,7 +67,7 @@ elw_box_class_get(void)
|
|||
NULL,
|
||||
sizeof(Widget_Data),
|
||||
_constructor,
|
||||
_destructor,
|
||||
NULL,
|
||||
_class_constructor,
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -87,6 +87,7 @@ EAPI Eina_Bool eobj_init(void);
|
|||
EAPI Eina_Bool eobj_shutdown(void);
|
||||
|
||||
#define eobj_do(object, ...) eobj_do_internal(object, __VA_ARGS__, NULL)
|
||||
/* FIXME: Change this to SUPER as well. */
|
||||
#define eobj_class_do(object, klass, ...) eobj_class_do_internal(object, klass, __VA_ARGS__, NULL)
|
||||
#define eobj_class_parent_do(object, klass, ...) eobj_class_do_internal(object, eobj_class_parent_get(klass), __VA_ARGS__, NULL)
|
||||
|
||||
|
|
|
@ -439,8 +439,6 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ...
|
|||
|
||||
_CLS_NEW_CHECK(desc);
|
||||
_CLS_NEW_CHECK(desc->name);
|
||||
_CLS_NEW_CHECK(desc->constructor);
|
||||
_CLS_NEW_CHECK(desc->destructor);
|
||||
|
||||
klass = calloc(1, sizeof(Eobj_Class));
|
||||
klass->parent = parent;
|
||||
|
@ -660,6 +658,18 @@ eobj_constructor_error_get(const Eobj *obj)
|
|||
return (intptr_t) eobj_generic_data_get(obj, CONSTRUCT_ERROR_KEY);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_eobj_constructor_default(Eobj *obj)
|
||||
{
|
||||
eobj_constructor_super(obj);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_eobj_destructor_default(Eobj *obj)
|
||||
{
|
||||
eobj_destructor_super(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
eobj_class_constructor(Eobj *obj, const Eobj_Class *klass)
|
||||
{
|
||||
|
@ -677,7 +687,10 @@ eobj_class_constructor(Eobj *obj, const Eobj_Class *klass)
|
|||
extn->klass->desc->constructor(obj);
|
||||
}
|
||||
|
||||
klass->desc->constructor(obj);
|
||||
if (klass->desc->constructor)
|
||||
klass->desc->constructor(obj);
|
||||
else
|
||||
_eobj_constructor_default(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -690,7 +703,10 @@ eobj_class_destructor(Eobj *obj, const Eobj_Class *klass)
|
|||
if (!klass)
|
||||
return;
|
||||
|
||||
klass->desc->destructor(obj);
|
||||
if (klass->desc->destructor)
|
||||
klass->desc->destructor(obj);
|
||||
else
|
||||
_eobj_destructor_default(obj);
|
||||
|
||||
EINA_INLIST_REVERSE_FOREACH(klass->extensions, extn)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue