eo: add EO_CLASS_CLASS
authorJérémy Zurcher <jeremy@asynk.ch>
Sat, 12 Oct 2013 21:51:59 +0000 (23:51 +0200)
committerJérémy Zurcher <jeremy@asynk.ch>
Sat, 12 Oct 2013 22:00:13 +0000 (00:00 +0200)
it's an empty class without operations,
used as a return value for eo_class_get() when the caller is a class

src/Makefile_Eo.am
src/lib/eo/Eo.h
src/lib/eo/eo.c
src/lib/eo/eo_class_class.c [new file with mode: 0644]

index ab24350..b0d15bd 100644 (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
 
index fb7ccc2..36a7948 100644 (file)
@@ -970,6 +970,36 @@ 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
+};
+
+/**
+ * @}
+ */
+
+/**
  * @addtogroup Eo_Class_Base Eo's Base class.
  * @{
  */
index 3e1d3c1..bc4cd8a 100644 (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;
 }
 
diff --git a/src/lib/eo/eo_class_class.c b/src/lib/eo/eo_class_class.c
new file mode 100644 (file)
index 0000000..f9844c5
--- /dev/null
@@ -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)