forked from enlightenment/efl
Eobj: Add a convenience macro for defining the class_get functions.
This macro makes the code a tad simpler, but more importantly, makes it easier for us to be thread safe, or more corrctly, easier for us the make user code thread safe. SVN revision: 70407
This commit is contained in:
parent
1390200ede
commit
e0f6adbea6
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
EAPI Eobj_Op INHERIT_BASE_ID = 0;
|
EAPI Eobj_Op INHERIT_BASE_ID = 0;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS INHERIT_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_prot_print(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
_prot_print(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
|
@ -29,27 +29,21 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
inherit_class_get(void)
|
EOBJ_OP_DESCRIPTION(INHERIT_SUB_ID_PROT_PRINT, "", "Print protected var x1."),
|
||||||
{
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
if (_my_class) return _my_class;
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(INHERIT_SUB_ID_PROT_PRINT, "", "Print protected var x1."),
|
"Inherit",
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
};
|
EOBJ_CLASS_DESCRIPTION_OPS(&INHERIT_BASE_ID, op_desc, INHERIT_SUB_ID_LAST),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, NULL)
|
||||||
"Inherit",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&INHERIT_BASE_ID, op_desc, INHERIT_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, SIMPLE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef struct
|
||||||
EAPI const Eobj_Event_Description _SIG_A_CHANGED =
|
EAPI const Eobj_Event_Description _SIG_A_CHANGED =
|
||||||
EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed.");
|
EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed.");
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_a_set(Eobj *obj, void *class_data, va_list *list)
|
_a_set(Eobj *obj, void *class_data, va_list *list)
|
||||||
|
@ -41,32 +41,27 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
simple_class_get(void)
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
if (_my_class) return _my_class;
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Event_Description *event_desc[] = {
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
SIG_A_CHANGED,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Eobj_Event_Description *event_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
SIG_A_CHANGED,
|
"Simple",
|
||||||
NULL
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
};
|
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
||||||
|
event_desc,
|
||||||
|
sizeof(Private_Data),
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL)
|
||||||
"Simple",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
|
||||||
event_desc,
|
|
||||||
sizeof(Private_Data),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
EAPI Eobj_Op COMP_BASE_ID = 0;
|
EAPI Eobj_Op COMP_BASE_ID = 0;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS COMP_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_a_get(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
_a_get(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
|
@ -46,23 +46,18 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
comp_class_get(void)
|
"Comp",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
_constructor,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(comp_class_get, &class_desc, EOBJ_BASE_CLASS,
|
||||||
"Comp",
|
SIMPLE_CLASS, NULL);
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
_constructor,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS,
|
|
||||||
SIMPLE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ EAPI Eobj_Op SIMPLE_BASE_ID = 0;
|
||||||
EAPI const Eobj_Event_Description _SIG_A_CHANGED =
|
EAPI const Eobj_Event_Description _SIG_A_CHANGED =
|
||||||
EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed.");
|
EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed.");
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_a_set(Eobj *obj, void *class_data, va_list *list)
|
_a_set(Eobj *obj, void *class_data, va_list *list)
|
||||||
|
@ -16,7 +16,7 @@ _a_set(Eobj *obj, void *class_data, va_list *list)
|
||||||
Simple_Public_Data *pd = class_data;
|
Simple_Public_Data *pd = class_data;
|
||||||
int a;
|
int a;
|
||||||
a = va_arg(*list, int);
|
a = va_arg(*list, int);
|
||||||
printf("%s %d\n", eobj_class_name_get(_my_class), a);
|
printf("%s %d\n", eobj_class_name_get(MY_CLASS), a);
|
||||||
pd->a = a;
|
pd->a = a;
|
||||||
|
|
||||||
eobj_event_callback_call(obj, SIG_A_CHANGED, &pd->a);
|
eobj_event_callback_call(obj, SIG_A_CHANGED, &pd->a);
|
||||||
|
@ -43,33 +43,28 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
simple_class_get(void)
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "i", "Get property A"),
|
||||||
if (_my_class) return _my_class;
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Event_Description *event_desc[] = {
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
SIG_A_CHANGED,
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "i", "Get property A"),
|
NULL
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
};
|
||||||
};
|
|
||||||
|
|
||||||
static const Eobj_Event_Description *event_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
SIG_A_CHANGED,
|
"Simple",
|
||||||
NULL
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
};
|
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
||||||
|
event_desc,
|
||||||
|
sizeof(Simple_Public_Data),
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL);
|
||||||
"Simple",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
|
||||||
event_desc,
|
|
||||||
sizeof(Simple_Public_Data),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
EAPI Eobj_Op MIXIN_BASE_ID = 0;
|
EAPI Eobj_Op MIXIN_BASE_ID = 0;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS MIXIN_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_add_and_print_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
_add_and_print_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
|
@ -46,27 +46,22 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
mixin_class_get(void)
|
EOBJ_OP_DESCRIPTION(MIXIN_SUB_ID_ADD_AND_SET, "i", "Add A + B + param and print it"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
if (_my_class) return _my_class;
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(MIXIN_SUB_ID_ADD_AND_SET, "i", "Add A + B + param and print it"),
|
"Mixin",
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
EOBJ_CLASS_TYPE_MIXIN,
|
||||||
};
|
EOBJ_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
_constructor,
|
||||||
|
_destructor,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL);
|
||||||
"Mixin",
|
|
||||||
EOBJ_CLASS_TYPE_MIXIN,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
_constructor,
|
|
||||||
_destructor,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ typedef struct
|
||||||
int b;
|
int b;
|
||||||
} Private_Data;
|
} Private_Data;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE_CLASS
|
||||||
|
|
||||||
static char *class_var = NULL;
|
static char *class_var = NULL;
|
||||||
|
|
||||||
|
@ -79,30 +79,26 @@ _class_destructor(Eobj_Class *klass EINA_UNUSED)
|
||||||
free(class_var);
|
free(class_var);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
simple_class_get(void)
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "i", "Get property A"),
|
||||||
if (_my_class) return _my_class;
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_SET, "i", "Set property B"),
|
||||||
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_GET, "i", "Get property B"),
|
||||||
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
"Simple",
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "i", "Get property A"),
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_SET, "i", "Set property B"),
|
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_GET, "i", "Get property B"),
|
NULL,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
sizeof(Private_Data),
|
||||||
};
|
_constructor,
|
||||||
|
_destructor,
|
||||||
|
_class_constructor,
|
||||||
|
_class_destructor
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS,
|
||||||
"Simple",
|
MIXIN_CLASS, NULL);
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
sizeof(Private_Data),
|
|
||||||
_constructor,
|
|
||||||
_destructor,
|
|
||||||
_class_constructor,
|
|
||||||
_class_destructor
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, MIXIN_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE2_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
|
@ -14,23 +14,17 @@ _constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
eobj_constructor_error_set(obj);
|
eobj_constructor_error_set(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
simple2_class_get(void)
|
"Simple2",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
_constructor,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple2_class_get, &class_desc, EOBJ_BASE_CLASS, NULL);
|
||||||
"Simple2",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
_constructor,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
_my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, NULL);
|
|
||||||
return _my_class;
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE3_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
|
@ -12,23 +12,17 @@ _constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
(void) obj;
|
(void) obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
simple3_class_get(void)
|
"Simple3",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
_constructor,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple3_class_get, &class_desc, EOBJ_BASE_CLASS, NULL);
|
||||||
"Simple3",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
_constructor,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
_my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, NULL);
|
|
||||||
return _my_class;
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,25 +3,19 @@
|
||||||
#include "simple.h"
|
#include "simple.h"
|
||||||
#include "simple4.h"
|
#include "simple4.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE4_CLASS
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
simple4_class_get(void)
|
"Simple4",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple4_class_get, &class_desc, SIMPLE_CLASS, MIXIN_CLASS, NULL);
|
||||||
"Simple4",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
_my_class = eobj_class_new(&class_desc, SIMPLE_CLASS, MIXIN_CLASS, NULL);
|
|
||||||
return _my_class;
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE5_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_destructor(Eobj *obj, void *class_data EINA_UNUSED)
|
_destructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
|
@ -12,23 +12,17 @@ _destructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
(void) obj;
|
(void) obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
simple5_class_get(void)
|
"Simple5",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
_destructor,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple5_class_get, &class_desc, EOBJ_BASE_CLASS, NULL);
|
||||||
"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_BASE_CLASS, NULL);
|
|
||||||
return _my_class;
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE6_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_destructor(Eobj *obj, void *class_data EINA_UNUSED)
|
_destructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
|
@ -14,23 +14,17 @@ _destructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
eobj_constructor_error_set(obj);
|
eobj_constructor_error_set(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
simple6_class_get(void)
|
"Simple6",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
_destructor,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple6_class_get, &class_desc, EOBJ_BASE_CLASS, NULL);
|
||||||
"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_BASE_CLASS, NULL);
|
|
||||||
return _my_class;
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef struct
|
||||||
Evas_Object *bx;
|
Evas_Object *bx;
|
||||||
} Widget_Data;
|
} Widget_Data;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS ELW_BOX_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_pack_end(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
_pack_end(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
||||||
|
@ -51,28 +51,22 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
elw_box_class_get(void)
|
EOBJ_OP_DESCRIPTION(ELW_BOX_SUB_ID_PACK_END, "o", "Pack obj at the end of box."),
|
||||||
{
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
if (_my_class) return _my_class;
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(ELW_BOX_SUB_ID_PACK_END, "o", "Pack obj at the end of box."),
|
"Elw Box",
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
};
|
EOBJ_CLASS_DESCRIPTION_OPS(&ELW_BOX_BASE_ID, op_desc, ELW_BOX_SUB_ID_LAST),
|
||||||
|
NULL,
|
||||||
|
sizeof(Widget_Data),
|
||||||
|
_constructor,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(elw_box_class_get, &class_desc, EVAS_OBJ_CLASS, NULL)
|
||||||
"Elw Box",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&ELW_BOX_BASE_ID, op_desc, ELW_BOX_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
sizeof(Widget_Data),
|
|
||||||
_constructor,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EVAS_OBJ_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef struct
|
||||||
// Evas_Object *bx;
|
// Evas_Object *bx;
|
||||||
} Widget_Data;
|
} Widget_Data;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS ELW_BOXEDBUTTON_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
|
@ -29,24 +29,17 @@ _constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
eobj_unref(bt);
|
eobj_unref(bt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
elw_boxedbutton_class_get(void)
|
"Elw BoxedButton",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
sizeof(Widget_Data),
|
||||||
|
_constructor,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(elw_boxedbutton_class_get, &class_desc, ELW_BOX_CLASS, ELW_BUTTON_CLASS, NULL)
|
||||||
"Elw BoxedButton",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
sizeof(Widget_Data),
|
|
||||||
_constructor,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, ELW_BOX_CLASS,
|
|
||||||
ELW_BUTTON_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ typedef struct
|
||||||
Evas_Object *bt;
|
Evas_Object *bt;
|
||||||
} Widget_Data;
|
} Widget_Data;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS ELW_BUTTON_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_position_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
_position_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
|
@ -86,33 +86,27 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
elw_button_class_get(void)
|
EOBJ_OP_DESCRIPTION(ELW_BUTTON_SUB_ID_TEXT_SET, "s", "Text of a text supporting evas object."), // FIXME: This ID sholudn't really be defined here...
|
||||||
{
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
if (_my_class) return _my_class;
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Event_Description *event_desc[] = {
|
||||||
EOBJ_OP_DESCRIPTION(ELW_BUTTON_SUB_ID_TEXT_SET, "s", "Text of a text supporting evas object."), // FIXME: This ID sholudn't really be defined here...
|
SIG_CLICKED,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Eobj_Event_Description *event_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
SIG_CLICKED,
|
"Elw Button",
|
||||||
NULL
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
};
|
EOBJ_CLASS_DESCRIPTION_OPS(&ELW_BUTTON_BASE_ID, op_desc, ELW_BUTTON_SUB_ID_LAST),
|
||||||
|
event_desc,
|
||||||
|
sizeof(Widget_Data),
|
||||||
|
_constructor,
|
||||||
|
_destructor,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(elw_button_class_get, &class_desc, EVAS_OBJ_CLASS, NULL)
|
||||||
"Elw Button",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&ELW_BUTTON_BASE_ID, op_desc, ELW_BUTTON_SUB_ID_LAST),
|
|
||||||
event_desc,
|
|
||||||
sizeof(Widget_Data),
|
|
||||||
_constructor,
|
|
||||||
_destructor,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EVAS_OBJ_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ typedef struct
|
||||||
Evas_Object *bg;
|
Evas_Object *bg;
|
||||||
} Widget_Data;
|
} Widget_Data;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS ELW_WIN_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
my_win_del(void *data, Evas_Object *obj, void *event_info)
|
my_win_del(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
@ -43,23 +43,18 @@ _constructor(Eobj *obj, void *class_data)
|
||||||
eobj_evas_object_set(obj, wd->win);
|
eobj_evas_object_set(obj, wd->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
elw_win_class_get(void)
|
"Elw Win",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
sizeof(Widget_Data),
|
||||||
|
_constructor,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
|
||||||
"Elw Win",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
sizeof(Widget_Data),
|
|
||||||
_constructor,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EVAS_OBJ_CLASS, NULL);
|
EOBJ_DEFINE_CLASS(elw_win_class_get, &class_desc, EVAS_OBJ_CLASS, NULL)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS EVAS_OBJ_CLASS
|
||||||
|
|
||||||
EAPI Eobj_Op EVAS_OBJ_BASE_ID = 0;
|
EAPI Eobj_Op EVAS_OBJ_BASE_ID = 0;
|
||||||
|
|
||||||
|
@ -118,32 +118,26 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
evas_object_class_get(void)
|
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_POSITION_SET, "ii", "Position of an evas object."),
|
||||||
{
|
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_SIZE_SET, "ii", "Size of an evas object."),
|
||||||
if (_my_class) return _my_class;
|
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_COLOR_SET, "iiii", "Color of an evas object."),
|
||||||
|
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_COLOR_GET, "iiii", "Color of an evas object."),
|
||||||
|
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_VISIBILITY_SET, "b", "Visibility of an evas object."),
|
||||||
|
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_CHILD_ADD, "o", "Add a child eobj."),
|
||||||
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_POSITION_SET, "ii", "Position of an evas object."),
|
"Evas Object",
|
||||||
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_SIZE_SET, "ii", "Size of an evas object."),
|
EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT,
|
||||||
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_COLOR_SET, "iiii", "Color of an evas object."),
|
EOBJ_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_BASE_ID, op_desc, EVAS_OBJ_SUB_ID_LAST),
|
||||||
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_COLOR_GET, "iiii", "Color of an evas object."),
|
NULL,
|
||||||
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_VISIBILITY_SET, "b", "Visibility of an evas object."),
|
sizeof(Widget_Data),
|
||||||
EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_CHILD_ADD, "o", "Add a child eobj."),
|
_constructor,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
_destructor,
|
||||||
};
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(evas_object_class_get, &class_desc, EOBJ_BASE_CLASS, NULL)
|
||||||
"Evas Object",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_BASE_ID, op_desc, EVAS_OBJ_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
sizeof(Widget_Data),
|
|
||||||
_constructor,
|
|
||||||
_destructor,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,24 +3,18 @@
|
||||||
|
|
||||||
#include "inherit.h"
|
#include "inherit.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS INHERIT_CLASS
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
inherit_class_get(void)
|
"Inherit",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, NULL);
|
||||||
"Inherit",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, SIMPLE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
EAPI Eobj_Op INHERIT2_BASE_ID = 0;
|
EAPI Eobj_Op INHERIT2_BASE_ID = 0;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS INHERIT2_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_a_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
_a_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
a = va_arg(*list, int);
|
a = va_arg(*list, int);
|
||||||
printf("%s %d\n", eobj_class_name_get(_my_class), a);
|
printf("%s %d\n", eobj_class_name_get(MY_CLASS), a);
|
||||||
eobj_do(obj, SIMPLE_A_PRINT());
|
eobj_do(obj, SIMPLE_A_PRINT());
|
||||||
eobj_do_super(obj, SIMPLE_A_SET(a + 1));
|
eobj_do_super(obj, SIMPLE_A_SET(a + 1));
|
||||||
|
|
||||||
|
@ -50,28 +50,23 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
inherit2_class_get(void)
|
EOBJ_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT, "", "Print hey"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT2, "", "Print hey2"),
|
||||||
if (_my_class) return _my_class;
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT, "", "Print hey"),
|
"Inherit2",
|
||||||
EOBJ_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT2, "", "Print hey2"),
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
EOBJ_CLASS_DESCRIPTION_OPS(&INHERIT2_BASE_ID, op_desc, INHERIT2_SUB_ID_LAST),
|
||||||
};
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(inherit2_class_get, &class_desc, INHERIT_CLASS, NULL);
|
||||||
"Inherit2",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&INHERIT2_BASE_ID, op_desc, INHERIT2_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, INHERIT_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS INHERIT3_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_a_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
_a_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
a = va_arg(*list, int);
|
a = va_arg(*list, int);
|
||||||
printf("%s %d\n", eobj_class_name_get(_my_class), a);
|
printf("%s %d\n", eobj_class_name_get(MY_CLASS), a);
|
||||||
eobj_do_super(obj, SIMPLE_A_SET(a + 1));
|
eobj_do_super(obj, SIMPLE_A_SET(a + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,22 +28,17 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
inherit3_class_get(void)
|
"Inherit3",
|
||||||
{
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(inherit3_class_get, &class_desc, INHERIT2_CLASS, NULL);
|
||||||
"Inherit3",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, INHERIT2_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
EAPI Eobj_Op SIMPLE_BASE_ID = 0;
|
EAPI Eobj_Op SIMPLE_BASE_ID = 0;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_a_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
_a_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
||||||
|
@ -13,7 +13,7 @@ _a_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
||||||
Simple_Public_Data *pd = class_data;
|
Simple_Public_Data *pd = class_data;
|
||||||
int a;
|
int a;
|
||||||
a = va_arg(*list, int);
|
a = va_arg(*list, int);
|
||||||
printf("%s %d\n", eobj_class_name_get(_my_class), a);
|
printf("%s %d\n", eobj_class_name_get(MY_CLASS), a);
|
||||||
pd->a = a;
|
pd->a = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ _a_print(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
||||||
{
|
{
|
||||||
Simple_Public_Data *pd = class_data;
|
Simple_Public_Data *pd = class_data;
|
||||||
(void) list;
|
(void) list;
|
||||||
printf("Print %s %d\n", eobj_class_name_get(_my_class), pd->a);
|
printf("Print %s %d\n", eobj_class_name_get(MY_CLASS), pd->a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -37,28 +37,23 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
simple_class_get(void)
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_PRINT, "", "Print property A"),
|
||||||
if (_my_class) return _my_class;
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
"Simple",
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_PRINT, "", "Print property A"),
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
||||||
};
|
NULL,
|
||||||
|
sizeof(Simple_Public_Data),
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL);
|
||||||
"Simple",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
sizeof(Simple_Public_Data),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
EAPI Eobj_Op MIXIN_BASE_ID = 0;
|
EAPI Eobj_Op MIXIN_BASE_ID = 0;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS MIXIN_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ab_sum_get(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
_ab_sum_get(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
|
@ -16,7 +16,7 @@ _ab_sum_get(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
int *sum = va_arg(*list, int *);
|
int *sum = va_arg(*list, int *);
|
||||||
if (sum)
|
if (sum)
|
||||||
*sum = a + b;
|
*sum = a + b;
|
||||||
printf("%s %s\n", eobj_class_name_get(_my_class), __func__);
|
printf("%s %s\n", eobj_class_name_get(MY_CLASS), __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -42,29 +42,23 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
|
||||||
mixin_class_get(void)
|
|
||||||
{
|
|
||||||
if (_my_class) return _my_class;
|
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
EOBJ_OP_DESCRIPTION(MIXIN_SUB_ID_AB_SUM_GET, "i", "Get the sum of a and b."),
|
EOBJ_OP_DESCRIPTION(MIXIN_SUB_ID_AB_SUM_GET, "i", "Get the sum of a and b."),
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
"Mixin",
|
"Mixin",
|
||||||
EOBJ_CLASS_TYPE_MIXIN,
|
EOBJ_CLASS_TYPE_MIXIN,
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
|
EOBJ_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
_constructor,
|
_constructor,
|
||||||
_destructor,
|
_destructor,
|
||||||
_class_constructor,
|
_class_constructor,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
_my_class = eobj_class_new(&class_desc, NULL, NULL);
|
EOBJ_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL)
|
||||||
|
|
||||||
return _my_class;
|
|
||||||
}
|
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
#include "../eunit_tests.h"
|
#include "../eunit_tests.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS MIXIN2_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ab_sum_get(Eobj *obj, void *class_data, va_list *list)
|
_ab_sum_get(Eobj *obj, void *class_data, va_list *list)
|
||||||
{
|
{
|
||||||
Mixin2_Public_Data *pd = class_data;
|
Mixin2_Public_Data *pd = class_data;
|
||||||
int *sum = va_arg(*list, int *);
|
int *sum = va_arg(*list, int *);
|
||||||
printf("%s %s\n", eobj_class_name_get(_my_class), __func__);
|
printf("%s %s\n", eobj_class_name_get(MY_CLASS), __func__);
|
||||||
eobj_do_super(obj, MIXIN_AB_SUM_GET(sum));
|
eobj_do_super(obj, MIXIN_AB_SUM_GET(sum));
|
||||||
|
|
||||||
++*sum;
|
++*sum;
|
||||||
|
@ -50,24 +50,17 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
mixin2_class_get(void)
|
"Mixin2",
|
||||||
{
|
EOBJ_CLASS_TYPE_MIXIN,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
sizeof(Mixin2_Public_Data),
|
||||||
|
_constructor,
|
||||||
|
_destructor,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(mixin2_class_get, &class_desc, MIXIN_CLASS, NULL);
|
||||||
"Mixin2",
|
|
||||||
EOBJ_CLASS_TYPE_MIXIN,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
sizeof(Mixin2_Public_Data),
|
|
||||||
_constructor,
|
|
||||||
_destructor,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
_my_class = eobj_class_new(&class_desc, MIXIN_CLASS, NULL);
|
|
||||||
|
|
||||||
return _my_class;
|
|
||||||
}
|
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
#include "../eunit_tests.h"
|
#include "../eunit_tests.h"
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS MIXIN3_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ab_sum_get(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
_ab_sum_get(Eobj *obj, void *class_data EINA_UNUSED, va_list *list)
|
||||||
{
|
{
|
||||||
Mixin3_Public_Data *pd = class_data;
|
Mixin3_Public_Data *pd = class_data;
|
||||||
int *sum = va_arg(*list, int *);
|
int *sum = va_arg(*list, int *);
|
||||||
printf("%s %s\n", eobj_class_name_get(_my_class), __func__);
|
printf("%s %s\n", eobj_class_name_get(MY_CLASS), __func__);
|
||||||
eobj_do_super(obj, MIXIN_AB_SUM_GET(sum));
|
eobj_do_super(obj, MIXIN_AB_SUM_GET(sum));
|
||||||
|
|
||||||
++*sum;
|
++*sum;
|
||||||
|
@ -50,24 +50,17 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Class_Description class_desc = {
|
||||||
mixin3_class_get(void)
|
"Mixin3",
|
||||||
{
|
EOBJ_CLASS_TYPE_MIXIN,
|
||||||
if (_my_class) return _my_class;
|
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
||||||
|
NULL,
|
||||||
|
sizeof(Mixin3_Public_Data),
|
||||||
|
_constructor,
|
||||||
|
_destructor,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(mixin3_class_get, &class_desc, MIXIN_CLASS, NULL);
|
||||||
"Mixin3",
|
|
||||||
EOBJ_CLASS_TYPE_MIXIN,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
|
||||||
NULL,
|
|
||||||
sizeof(Mixin3_Public_Data),
|
|
||||||
_constructor,
|
|
||||||
_destructor,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
_my_class = eobj_class_new(&class_desc, MIXIN_CLASS, NULL);
|
|
||||||
|
|
||||||
return _my_class;
|
|
||||||
}
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ typedef struct
|
||||||
int b;
|
int b;
|
||||||
} Private_Data;
|
} Private_Data;
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE_CLASS
|
||||||
|
|
||||||
#define _GET_SET_FUNC(name) \
|
#define _GET_SET_FUNC(name) \
|
||||||
static void \
|
static void \
|
||||||
|
@ -53,30 +53,24 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
simple_class_get(void)
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "i", "Get property A"),
|
||||||
if (_my_class) return _my_class;
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_SET, "i", "Set property B"),
|
||||||
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_GET, "i", "Get property B"),
|
||||||
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
"Simple",
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "i", "Get property A"),
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_SET, "i", "Set property B"),
|
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_GET, "i", "Get property B"),
|
NULL,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
sizeof(Private_Data),
|
||||||
};
|
NULL,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, MIXIN3_CLASS, MIXIN2_CLASS, NULL);
|
||||||
"Simple",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
sizeof(Private_Data),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, MIXIN3_CLASS, MIXIN2_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ typedef struct
|
||||||
EAPI const Eobj_Event_Description _SIG_A_CHANGED =
|
EAPI const Eobj_Event_Description _SIG_A_CHANGED =
|
||||||
EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed.");
|
EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed.");
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS SIMPLE_CLASS
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_a_set(Eobj *obj, void *class_data, va_list *list)
|
_a_set(Eobj *obj, void *class_data, va_list *list)
|
||||||
|
@ -31,7 +31,7 @@ _a_set(Eobj *obj, void *class_data, va_list *list)
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
_cb_added(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info)
|
_cb_added(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info)
|
||||||
{
|
{
|
||||||
Simple_Public_Data *pd = eobj_data_get(obj, _my_class);
|
Simple_Public_Data *pd = eobj_data_get(obj, MY_CLASS);
|
||||||
const Eobj_Event_Description *cb_desc = event_info;
|
const Eobj_Event_Description *cb_desc = event_info;
|
||||||
(void) data;
|
(void) data;
|
||||||
(void) desc;
|
(void) desc;
|
||||||
|
@ -48,7 +48,7 @@ _cb_added(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
_cb_deled(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info)
|
_cb_deled(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info)
|
||||||
{
|
{
|
||||||
Simple_Public_Data *pd = eobj_data_get(obj, _my_class);
|
Simple_Public_Data *pd = eobj_data_get(obj, MY_CLASS);
|
||||||
const Eobj_Event_Description *cb_desc = event_info;
|
const Eobj_Event_Description *cb_desc = event_info;
|
||||||
(void) data;
|
(void) data;
|
||||||
(void) desc;
|
(void) desc;
|
||||||
|
@ -84,32 +84,27 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
simple_class_get(void)
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
if (_my_class) return _my_class;
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Event_Description *event_desc[] = {
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
SIG_A_CHANGED,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Eobj_Event_Description *event_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
SIG_A_CHANGED,
|
"Simple",
|
||||||
NULL
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
};
|
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
||||||
|
event_desc,
|
||||||
|
sizeof(Private_Data),
|
||||||
|
_constructor,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL);
|
||||||
"Simple",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
|
||||||
event_desc,
|
|
||||||
sizeof(Private_Data),
|
|
||||||
_constructor,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,6 +4,17 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <Eina.h>
|
#include <Eina.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var _eobj_class_creation_lock
|
||||||
|
* This variable is used for locking purposes in the class_get function
|
||||||
|
* defined in #EOBJ_DEFINE_CLASS.
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
EAPI extern Eina_Lock _eobj_class_creation_lock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Eobj Eobj Generic Object System
|
* @defgroup Eobj Eobj Generic Object System
|
||||||
*
|
*
|
||||||
|
@ -99,6 +110,51 @@ typedef struct _Eobj_Event_Description Eobj_Event_Description;
|
||||||
*/
|
*/
|
||||||
typedef struct _Eobj_Class Eobj_Class;
|
typedef struct _Eobj_Class Eobj_Class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def EOBJ_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...)
|
||||||
|
* 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.
|
||||||
|
* @param parent_class The parent class for the function. Look at eobj_class_new() for more information.
|
||||||
|
* @param ... List of etxensions. Look at eobj_class_new() for more information.
|
||||||
|
*
|
||||||
|
* You must use this macro if you want thread safety in class creation.
|
||||||
|
*/
|
||||||
|
#define EOBJ_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) \
|
||||||
|
EAPI const Eobj_Class * \
|
||||||
|
class_get_func_name(void) \
|
||||||
|
{ \
|
||||||
|
static volatile char lk_init = 0; \
|
||||||
|
static Eina_Lock _my_lock; \
|
||||||
|
static const Eobj_Class * volatile _my_class = NULL; \
|
||||||
|
if (EINA_LIKELY(!!_my_class)) return _my_class; \
|
||||||
|
\
|
||||||
|
eina_lock_take(&_eobj_class_creation_lock); \
|
||||||
|
if (!lk_init) \
|
||||||
|
eina_lock_new(&_my_lock); \
|
||||||
|
if (lk_init < 2) eina_lock_take(&_my_lock); \
|
||||||
|
if (!lk_init) \
|
||||||
|
lk_init = 1; \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
if (lk_init < 2) eina_lock_release(&_my_lock); \
|
||||||
|
eina_lock_release(&_eobj_class_creation_lock); \
|
||||||
|
return _my_class; \
|
||||||
|
} \
|
||||||
|
eina_lock_release(&_eobj_class_creation_lock); \
|
||||||
|
_my_class = eobj_class_new(class_desc, parent_class, __VA_ARGS__); \
|
||||||
|
eina_lock_release(&_my_lock); \
|
||||||
|
\
|
||||||
|
eina_lock_take(&_eobj_class_creation_lock); \
|
||||||
|
eina_lock_free(&_my_lock); \
|
||||||
|
lk_init = 2; \
|
||||||
|
eina_lock_release(&_eobj_class_creation_lock); \
|
||||||
|
return _my_class; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enum representing the possible types of an Eobj class.
|
* An enum representing the possible types of an Eobj class.
|
||||||
*/
|
*/
|
||||||
|
@ -139,6 +195,7 @@ typedef struct _Eobj_Op_Func_Description Eobj_Op_Func_Description;
|
||||||
* array.
|
* array.
|
||||||
*/
|
*/
|
||||||
#define EOBJ_OP_FUNC(op, func) { op, func }
|
#define EOBJ_OP_FUNC(op, func) { op, func }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def EOBJ_OP_FUNC_SENTINEL
|
* @def EOBJ_OP_FUNC_SENTINEL
|
||||||
* A convenience macro to be used when populating the #Eobj_Op_Func_Description
|
* A convenience macro to be used when populating the #Eobj_Op_Func_Description
|
||||||
|
@ -227,6 +284,11 @@ typedef struct _Eobj_Class_Description Eobj_Class_Description;
|
||||||
* @param parent the class to inherit from.
|
* @param parent the class to inherit from.
|
||||||
* @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects).
|
* @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.
|
* @return The new class's handle on success, or NULL otherwise.
|
||||||
|
*
|
||||||
|
* You should use #EOBJ_DEFINE_CLASS. It'll provide thread safety and other
|
||||||
|
* features easily.
|
||||||
|
*
|
||||||
|
* @see #EOBJ_DEFINE_CLASS
|
||||||
*/
|
*/
|
||||||
EAPI const Eobj_Class *eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ...);
|
EAPI const Eobj_Class *eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ...);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
typedef int Eobj_Class_Id;
|
typedef int Eobj_Class_Id;
|
||||||
|
|
||||||
|
/* Used inside the class_get functions of classes, see #EOBJ_DEFINE_CLASS */
|
||||||
|
EAPI Eina_Lock _eobj_class_creation_lock;
|
||||||
int _eobj_log_dom = -1;
|
int _eobj_log_dom = -1;
|
||||||
|
|
||||||
static Eobj_Class **_eobj_classes;
|
static Eobj_Class **_eobj_classes;
|
||||||
|
@ -815,6 +817,7 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ...
|
||||||
klass->extn_data_size = extn_data_off;
|
klass->extn_data_size = extn_data_off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eina_lock_take(&_eobj_class_creation_lock);
|
||||||
klass->class_id = ++_eobj_classes_last_id;
|
klass->class_id = ++_eobj_classes_last_id;
|
||||||
{
|
{
|
||||||
/* FIXME: Handle errors. */
|
/* FIXME: Handle errors. */
|
||||||
|
@ -823,6 +826,7 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ...
|
||||||
_eobj_classes = tmp;
|
_eobj_classes = tmp;
|
||||||
_eobj_classes[klass->class_id - 1] = klass;
|
_eobj_classes[klass->class_id - 1] = klass;
|
||||||
}
|
}
|
||||||
|
eina_lock_release(&_eobj_class_creation_lock);
|
||||||
|
|
||||||
_eobj_class_base_op_init(klass);
|
_eobj_class_base_op_init(klass);
|
||||||
|
|
||||||
|
@ -1188,6 +1192,12 @@ eobj_init(void)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!eina_lock_new(&_eobj_class_creation_lock))
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Could not init lock.");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1209,6 +1219,8 @@ eobj_shutdown(void)
|
||||||
if (_eobj_classes)
|
if (_eobj_classes)
|
||||||
free(_eobj_classes);
|
free(_eobj_classes);
|
||||||
|
|
||||||
|
eina_lock_free(&_eobj_class_creation_lock);
|
||||||
|
|
||||||
eina_log_domain_unregister(_eobj_log_dom);
|
eina_log_domain_unregister(_eobj_log_dom);
|
||||||
_eobj_log_dom = -1;
|
_eobj_log_dom = -1;
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ _data_del(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOBJ_BASE_CLASS stuff */
|
/* EOBJ_BASE_CLASS stuff */
|
||||||
static const Eobj_Class *_my_class = NULL;
|
#define MY_CLASS EOBJ_BASE_CLASS
|
||||||
|
|
||||||
/* FIXME: Set proper type descriptions. */
|
/* FIXME: Set proper type descriptions. */
|
||||||
EAPI const Eobj_Event_Description _EOBJ_EV_CALLBACK_ADD =
|
EAPI const Eobj_Event_Description _EOBJ_EV_CALLBACK_ADD =
|
||||||
|
@ -129,13 +129,13 @@ EAPI const Eobj_Event_Description _EOBJ_EV_DEL =
|
||||||
static void
|
static void
|
||||||
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
_constructor(Eobj *obj, void *class_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
DBG("%p - %s.", obj, eobj_class_name_get(_my_class));
|
DBG("%p - %s.", obj, eobj_class_name_get(MY_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_destructor(Eobj *obj, void *class_data)
|
_destructor(Eobj *obj, void *class_data)
|
||||||
{
|
{
|
||||||
DBG("%p - %s.", obj, eobj_class_name_get(_my_class));
|
DBG("%p - %s.", obj, eobj_class_name_get(MY_CLASS));
|
||||||
|
|
||||||
_eobj_generic_data_del_all(class_data);
|
_eobj_generic_data_del_all(class_data);
|
||||||
}
|
}
|
||||||
|
@ -153,38 +153,32 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
eobj_base_class_get(void)
|
EOBJ_OP_DESCRIPTION(EOBJ_BASE_SUB_ID_DATA_SET, "?", "Set data for key."),
|
||||||
{
|
EOBJ_OP_DESCRIPTION(EOBJ_BASE_SUB_ID_DATA_GET, "?", "Get data for key."),
|
||||||
if (_my_class) return _my_class;
|
EOBJ_OP_DESCRIPTION(EOBJ_BASE_SUB_ID_DATA_DEL, "?", "Del key."),
|
||||||
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Event_Description *event_desc[] = {
|
||||||
EOBJ_OP_DESCRIPTION(EOBJ_BASE_SUB_ID_DATA_SET, "?", "Set data for key."),
|
EOBJ_EV_CALLBACK_ADD,
|
||||||
EOBJ_OP_DESCRIPTION(EOBJ_BASE_SUB_ID_DATA_GET, "?", "Get data for key."),
|
EOBJ_EV_CALLBACK_DEL,
|
||||||
EOBJ_OP_DESCRIPTION(EOBJ_BASE_SUB_ID_DATA_DEL, "?", "Del key."),
|
EOBJ_EV_FREE,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
EOBJ_EV_DEL,
|
||||||
};
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Event_Description *event_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_EV_CALLBACK_ADD,
|
"Eobj Base",
|
||||||
EOBJ_EV_CALLBACK_DEL,
|
EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT,
|
||||||
EOBJ_EV_FREE,
|
EOBJ_CLASS_DESCRIPTION_OPS(&EOBJ_BASE_BASE_ID, op_desc, EOBJ_BASE_SUB_ID_LAST),
|
||||||
EOBJ_EV_DEL,
|
event_desc,
|
||||||
NULL
|
sizeof(Private_Data),
|
||||||
};
|
_constructor,
|
||||||
|
_destructor,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(eobj_base_class_get, &class_desc, NULL, NULL)
|
||||||
"Eobj Base",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&EOBJ_BASE_BASE_ID, op_desc, EOBJ_BASE_SUB_ID_LAST),
|
|
||||||
event_desc,
|
|
||||||
sizeof(Private_Data),
|
|
||||||
_constructor,
|
|
||||||
_destructor,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
EAPI Eobj_Op SIMPLE_BASE_ID = 0;
|
#define MY_CLASS SIMPLE_CLASS
|
||||||
|
|
||||||
static const Eobj_Class *_my_class = NULL;
|
EAPI Eobj_Op SIMPLE_BASE_ID = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_a_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
_a_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
||||||
|
@ -13,7 +13,7 @@ _a_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
||||||
Simple_Public_Data *pd = class_data;
|
Simple_Public_Data *pd = class_data;
|
||||||
int a;
|
int a;
|
||||||
a = va_arg(*list, int);
|
a = va_arg(*list, int);
|
||||||
printf("%s %d\n", eobj_class_name_get(_my_class), a);
|
printf("%s %d\n", eobj_class_name_get(MY_CLASS), a);
|
||||||
pd->a = a;
|
pd->a = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ _a_print(Eobj *obj EINA_UNUSED, void *class_data, va_list *list)
|
||||||
{
|
{
|
||||||
Simple_Public_Data *pd = class_data;
|
Simple_Public_Data *pd = class_data;
|
||||||
(void) list;
|
(void) list;
|
||||||
printf("Print %s %d\n", eobj_class_name_get(_my_class), pd->a);
|
printf("Print %s %d\n", eobj_class_name_get(MY_CLASS), pd->a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -37,28 +37,23 @@ _class_constructor(Eobj_Class *klass)
|
||||||
eobj_class_funcs_set(klass, func_desc);
|
eobj_class_funcs_set(klass, func_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Eobj_Class *
|
static const Eobj_Op_Description op_desc[] = {
|
||||||
simple_class_get(void)
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
||||||
{
|
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_PRINT, "", "Print property A"),
|
||||||
if (_my_class) return _my_class;
|
EOBJ_OP_DESCRIPTION_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Op_Description op_desc[] = {
|
static const Eobj_Class_Description class_desc = {
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"),
|
"Simple",
|
||||||
EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_PRINT, "", "Print property A"),
|
EOBJ_CLASS_TYPE_REGULAR,
|
||||||
EOBJ_OP_DESCRIPTION_SENTINEL
|
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
||||||
};
|
NULL,
|
||||||
|
sizeof(Simple_Public_Data),
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
_class_constructor,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static const Eobj_Class_Description class_desc = {
|
EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL)
|
||||||
"Simple",
|
|
||||||
EOBJ_CLASS_TYPE_REGULAR,
|
|
||||||
EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
sizeof(Simple_Public_Data),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
return _my_class = eobj_class_new(&class_desc, EOBJ_BASE_CLASS, NULL);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue