forked from enlightenment/efl
parent
d5e74719dc
commit
d6affb56f7
|
@ -4,6 +4,8 @@ LIST(APPEND CONSTRUCTORS_CC_SOURCES
|
|||
simple2.c
|
||||
simple3.c
|
||||
simple4.c
|
||||
simple5.c
|
||||
simple6.c
|
||||
mixin.c
|
||||
)
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "simple2.h"
|
||||
#include "simple3.h"
|
||||
#include "simple4.h"
|
||||
#include "simple5.h"
|
||||
#include "simple6.h"
|
||||
#include "mixin.h"
|
||||
|
||||
#include "../eunit_tests.h"
|
||||
|
@ -45,6 +47,12 @@ main(int argc, char *argv[])
|
|||
|
||||
fail_if(my_init_count != 0);
|
||||
|
||||
obj = eobj_add(SIMPLE5_CLASS, NULL);
|
||||
eobj_unref(obj);
|
||||
|
||||
obj = eobj_add(SIMPLE6_CLASS, NULL);
|
||||
eobj_unref(obj);
|
||||
|
||||
eobj_shutdown();
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ typedef struct
|
|||
|
||||
static Eobj_Class *_my_class = NULL;
|
||||
|
||||
static char *class_var = NULL;
|
||||
|
||||
#define _GET_SET_FUNC(name) \
|
||||
static void \
|
||||
_##name##_get(Eobj *obj __UNUSED__, void *class_data, va_list *list) \
|
||||
|
@ -67,6 +69,14 @@ _class_constructor(Eobj_Class *klass)
|
|||
};
|
||||
|
||||
eobj_class_funcs_set(klass, func_desc);
|
||||
|
||||
class_var = malloc(10);
|
||||
}
|
||||
|
||||
static void
|
||||
_class_destructor(Eobj_Class *klass __UNUSED__)
|
||||
{
|
||||
free(class_var);
|
||||
}
|
||||
|
||||
const Eobj_Class *
|
||||
|
@ -91,7 +101,7 @@ simple_class_get(void)
|
|||
_constructor,
|
||||
_destructor,
|
||||
_class_constructor,
|
||||
NULL
|
||||
_class_destructor
|
||||
};
|
||||
|
||||
return _my_class = eobj_class_new(&class_desc, EOBJ_CLASS_BASE, MIXIN_CLASS, NULL);
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#include "Eobj.h"
|
||||
#include "mixin.h"
|
||||
#include "simple5.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
static Eobj_Class *_my_class = NULL;
|
||||
|
||||
static void
|
||||
_destructor(Eobj *obj, void *class_data __UNUSED__)
|
||||
{
|
||||
(void) obj;
|
||||
}
|
||||
|
||||
const Eobj_Class *
|
||||
simple5_class_get(void)
|
||||
{
|
||||
if (_my_class) return _my_class;
|
||||
|
||||
static const Eobj_Class_Description class_desc = {
|
||||
"Simple5",
|
||||
EOBJ_CLASS_TYPE_REGULAR,
|
||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
_destructor,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
_my_class = eobj_class_new(&class_desc, EOBJ_CLASS_BASE, NULL);
|
||||
return _my_class;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef SIMPLE5_H
|
||||
#define SIMPLE5_H
|
||||
|
||||
#include "Eobj.h"
|
||||
|
||||
#define SIMPLE5_CLASS simple5_class_get()
|
||||
const Eobj_Class *simple5_class_get(void) EINA_CONST;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,36 @@
|
|||
#include "Eobj.h"
|
||||
#include "mixin.h"
|
||||
#include "simple6.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
static Eobj_Class *_my_class = NULL;
|
||||
|
||||
static void
|
||||
_destructor(Eobj *obj, void *class_data __UNUSED__)
|
||||
{
|
||||
eobj_constructor_super(obj);
|
||||
|
||||
eobj_constructor_error_set(obj);
|
||||
}
|
||||
|
||||
const Eobj_Class *
|
||||
simple6_class_get(void)
|
||||
{
|
||||
if (_my_class) return _my_class;
|
||||
|
||||
static const Eobj_Class_Description class_desc = {
|
||||
"Simple6",
|
||||
EOBJ_CLASS_TYPE_REGULAR,
|
||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
_destructor,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
_my_class = eobj_class_new(&class_desc, EOBJ_CLASS_BASE, NULL);
|
||||
return _my_class;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef SIMPLE6_H
|
||||
#define SIMPLE6_H
|
||||
|
||||
#include "Eobj.h"
|
||||
|
||||
#define SIMPLE6_CLASS simple6_class_get()
|
||||
const Eobj_Class *simple6_class_get(void) EINA_CONST;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue