add_subdirectory(src/lib)
add_subdirectory(src/examples/evas)
+add_subdirectory(src/examples/simple)
add_subdirectory(src/tests/mixin)
add_subdirectory(src/tests/signals)
--- /dev/null
+LIST(APPEND SIMPLE_CC_SOURCES
+ main.c
+ simple.c
+ interface.c
+ mixin.c
+ )
+
+include_directories(
+ ${EINA_INCLUDE_DIRS}
+ ${EVAS_INCLUDE_DIRS}
+ ${CMAKE_SOURCE_DIR}/src/lib
+ )
+
+add_executable(simple ${SIMPLE_CC_SOURCES})
+
+get_target_property(eo_LIB_FILE eo LOCATION)
+target_link_libraries(simple
+ ${EINA_LIBRARIES}
+ ${EINA_LDFLAGS_OTHER}
+ ${eo_LIB_FILE}
+ )
+
+add_dependencies(simple eo)
--- /dev/null
+#include "Eo.h"
+#include "interface.h"
+
+#include "config.h"
+
+EAPI Eo_Op INTERFACE_BASE_ID = 0;
+
+#define MY_CLASS INTERFACE_CLASS
+
+static const Eo_Op_Description op_desc[] = {
+ EO_OP_DESCRIPTION_CONST(INTERFACE_SUB_ID_A_POWER_3_GET, "Get the a^3"),
+ EO_OP_DESCRIPTION_SENTINEL
+};
+
+static const Eo_Class_Description class_desc = {
+ "Interface",
+ EO_CLASS_TYPE_INTERFACE,
+ EO_CLASS_DESCRIPTION_OPS(&INTERFACE_BASE_ID, op_desc, INTERFACE_SUB_ID_LAST),
+ NULL,
+ 0,
+ NULL,
+ NULL
+};
+
+EO_DEFINE_CLASS(interface_class_get, &class_desc, NULL, NULL)
+
--- /dev/null
+#ifndef INTERFACE_H
+#define INTERFACE_H
+
+#include "Eo.h"
+
+extern EAPI Eo_Op INTERFACE_BASE_ID;
+
+enum {
+ INTERFACE_SUB_ID_A_POWER_3_GET,
+ INTERFACE_SUB_ID_LAST
+};
+
+#define INTERFACE_ID(sub_id) (INTERFACE_BASE_ID + sub_id)
+
+
+/**
+ * @def interface_a_power_3_get(ret)
+ * @brief Get a^3
+ * @param[out] ret integer pointer to ret - value
+ */
+#define interface_a_power_3_get(ret) INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), EO_TYPECHECK(int *, ret)
+
+#define INTERFACE_CLASS interface_class_get()
+const Eo_Class *interface_class_get(void);
+
+#endif
--- /dev/null
+#include "Eo.h"
+#include "simple.h"
+
+int
+main(int argc, char *argv[])
+{
+ (void) argc;
+ (void) argv;
+ eo_init();
+
+ Eo *obj = eo_add(SIMPLE_CLASS, NULL);
+
+ eo_do(obj, simple_a_set(4));
+
+ int a = 0, a2 = 0, a3 = 0;
+
+ eo_do(obj, simple_a_get(&a),
+ interface_a_power_3_get(&a3),
+ mixin_a_square_get(&a2));
+
+ printf("Got %d %d %d\n", a, a2, a3);
+
+ eo_unref(obj);
+ eo_shutdown();
+ return 0;
+}
+
--- /dev/null
+#include "Eo.h"
+#include "mixin.h"
+#include "simple.h"
+
+#include "config.h"
+
+EAPI Eo_Op MIXIN_BASE_ID = 0;
+
+#define MY_CLASS MIXIN_CLASS
+
+static void
+_a_square_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list)
+{
+ int a;
+ eo_query(obj, simple_a_get(&a));
+ int *ret = va_arg(*list, int *);
+ if (ret)
+ *ret = a * a;
+ printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
+}
+
+static void
+_class_constructor(Eo_Class *klass)
+{
+ const Eo_Op_Func_Description func_desc[] = {
+ EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), _a_square_get),
+ EO_OP_FUNC_SENTINEL
+ };
+
+ eo_class_funcs_set(klass, func_desc);
+}
+
+
+static const Eo_Op_Description op_desc[] = {
+ EO_OP_DESCRIPTION_CONST(MIXIN_SUB_ID_A_SQUARE_GET, "Get the value of A^2"),
+ EO_OP_DESCRIPTION_SENTINEL
+};
+
+static const Eo_Class_Description class_desc = {
+ "Mixin",
+ EO_CLASS_TYPE_MIXIN,
+ EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
+ NULL,
+ 0,
+ _class_constructor,
+ NULL
+};
+
+EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL)
+
--- /dev/null
+#ifndef MIXIN_H
+#define MIXIN_H
+
+#include "Eo.h"
+
+extern EAPI Eo_Op MIXIN_BASE_ID;
+
+enum {
+ MIXIN_SUB_ID_A_SQUARE_GET,
+ MIXIN_SUB_ID_LAST
+};
+
+#define MIXIN_ID(sub_id) (MIXIN_BASE_ID + sub_id)
+
+
+/**
+ * @def mixin_a_square_get(ret)
+ * @brief Get the square of a.
+ * @param[out] ret the square of a
+ */
+#define mixin_a_square_get(ret) MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), EO_TYPECHECK(int *, ret)
+
+#define MIXIN_CLASS mixin_class_get()
+const Eo_Class *mixin_class_get(void);
+
+#endif
--- /dev/null
+#include "Eo.h"
+#include "simple.h"
+
+#include "config.h"
+
+EAPI Eo_Op SIMPLE_BASE_ID = 0;
+
+typedef struct
+{
+ int a;
+} Private_Data;
+
+#define MY_CLASS SIMPLE_CLASS
+
+static void
+_a_get(const Eo *obj EINA_UNUSED, const void *class_data, va_list *list)
+{
+ const Private_Data *pd = class_data;
+ int *a;
+ a = va_arg(*list, int *);
+ *a = pd->a;
+ printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
+}
+
+static void
+_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
+{
+ Private_Data *pd = class_data;
+ int a;
+ a = va_arg(*list, int);
+ pd->a = a;
+ printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
+}
+
+static void
+_a_power_3_get(const Eo *obj EINA_UNUSED, const void *class_data, va_list *list)
+{
+ const Private_Data *pd = class_data;
+ int *ret;
+ ret = va_arg(*list, int *);
+ if (ret)
+ *ret = pd->a * pd->a * pd->a;
+ printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
+}
+
+static void
+_class_constructor(Eo_Class *klass)
+{
+ const Eo_Op_Func_Description func_desc[] = {
+ EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
+ EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
+ EO_OP_FUNC_CONST(INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), _a_power_3_get),
+ EO_OP_FUNC_SENTINEL
+ };
+
+ eo_class_funcs_set(klass, func_desc);
+}
+
+static const Eo_Op_Description op_desc[] = {
+ EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"),
+ EO_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_GET, "Get property A"),
+ EO_OP_DESCRIPTION_SENTINEL
+};
+
+static const Eo_Class_Description class_desc = {
+ "Simple",
+ EO_CLASS_TYPE_REGULAR,
+ EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
+ NULL,
+ sizeof(Private_Data),
+ _class_constructor,
+ NULL
+};
+
+EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, INTERFACE_CLASS, MIXIN_CLASS, NULL);
--- /dev/null
+#ifndef SIMPLE_H
+#define SIMPLE_H
+
+#include "Eo.h"
+#include "interface.h"
+#include "mixin.h"
+
+extern EAPI Eo_Op SIMPLE_BASE_ID;
+
+enum {
+ SIMPLE_SUB_ID_A_SET,
+ SIMPLE_SUB_ID_A_GET,
+ SIMPLE_SUB_ID_LAST
+};
+
+#define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id)
+
+/**
+ * @def simple_a_set(a)
+ * @brief Set value to a-property
+ * @param[in] a integer value to set
+ */
+#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a)
+
+/**
+ * @def simple_a_get(a)
+ * @brief Get value of a-property
+ * @param[out] integer pointer to a-value
+ */
+#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a)
+
+#define SIMPLE_CLASS simple_class_get()
+const Eo_Class *simple_class_get(void);
+
+#endif