eo: add EO_CLASS_CLASS

it's an empty class without operations,
used as a return value for eo_class_get() when the caller is a class
This commit is contained in:
Jérémy Zurcher 2013-10-12 23:51:59 +02:00
parent f3e3739e7c
commit 1648b67c5b
4 changed files with 55 additions and 1 deletions

View File

@ -10,6 +10,7 @@ lib_eo_libeo_la_SOURCES = \
lib/eo/eo.c \
lib/eo/eo_ptr_indirection.c \
lib/eo/eo_ptr_indirection.h \
lib/eo/eo_class_class.c \
lib/eo/eo_base_class.c \
lib/eo/eo_private.h

View File

@ -965,6 +965,36 @@ EAPI void eo_composite_detach(Eo *comp_obj, Eo *parent);
*/
EAPI Eina_Bool eo_composite_is(const Eo *comp_obj);
/**
* @}
*/
/**
* @addtogroup Eo_Class_Class Eo's Class class.
* @{
*/
/**
* @def EO_CLASS_CLASS
* The class type for the Eo Class class.
*/
#define EO_CLASS_CLASS eo_class_class_get()
/**
* @brief Use #EO_CLASS_CLASS
* @internal
* */
EAPI const Eo_Class *eo_class_class_get(void);
/**
* @var EO_CLASS_CLASS_BASE_ID
* #EO_CLASS_CLASS 's base id.
*/
extern EAPI Eo_Op EO_CLASS_CLASS_BASE_ID;
enum {
EO_CLASS_CLASS_SUB_ID_LAST
};
/**
* @}
*/

View File

@ -460,7 +460,7 @@ eo_class_get(const Eo *obj_id)
if (_eo_is_a_class(obj_id))
{
EO_CLASS_POINTER_RETURN_VAL(obj_id, _klass, NULL);
return NULL;
return eo_class_class_get();
}
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL);
@ -1446,6 +1446,9 @@ eo_init(void)
EINA_LOG_STATE_STOP,
EINA_LOG_STATE_INIT);
/* bootstrap EO_CLASS_CLASS */
(void) eo_class_class_get();
return EINA_TRUE;
}

View File

@ -0,0 +1,20 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
EAPI Eo_Op EO_CLASS_CLASS_BASE_ID = 0;
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Eo Abstract Class",
EO_CLASS_TYPE_REGULAR_NO_INSTANT,
EO_CLASS_DESCRIPTION_OPS(&EO_CLASS_CLASS_BASE_ID, NULL, EO_CLASS_CLASS_SUB_ID_LAST),
NULL,
0,
NULL,
NULL
};
EO_DEFINE_CLASS(eo_class_class_get, &class_desc, NULL, NULL)