a class can be a interface mixin abstract or regular.
This adds a API for getting this information
EFL_CLASS_TYPE_REGULAR = 0, /**< Regular class. */
EFL_CLASS_TYPE_REGULAR_NO_INSTANT, /**< Regular non instant-able class. */
EFL_CLASS_TYPE_INTERFACE, /**< Interface */
- EFL_CLASS_TYPE_MIXIN /**< Mixin */
+ EFL_CLASS_TYPE_MIXIN, /**< Mixin */
+ EFL_CLASS_TYPE_INVALID
};
/**
#include "efl_class.eo.h"
/**
+ * @brief Get the type of this class.
+ * @param klass The Efl_Class to get the type from.
+ *
+ * @return The type of this class or INVALID if the klass parameter was invalid.
+ */
+EAPI Efl_Class_Type efl_class_type_get(const Efl_Class *klass);
+
+/**
* @}
*/
return NULL;
}
break;
+ default:
+ ERR("type cannot be INVALID");
+ return NULL;
}
}
case EFL_CLASS_TYPE_MIXIN:
extn_list = eina_list_append(extn_list, extn);
break;
+ default:
+ ERR("type cannot be INVALID");
+ return NULL;
}
}
extn_id = va_arg(p_list, Eo_Id *);
return EINA_VALUE_EMPTY;
}
+
+EAPI Efl_Class_Type
+efl_class_type_get(const Efl_Class *klass_id)
+{
+ EO_CLASS_POINTER_RETURN_VAL(klass_id, klass, EFL_CLASS_TYPE_INVALID);
+
+ return klass->desc->type;
+}
fail_if(!efl_isa(SIMPLE_CLASS, INTERFACE2_CLASS));
fail_if(efl_isa(INTERFACE_CLASS, INTERFACE2_CLASS));
+ fail_if(efl_class_type_get(INTERFACE_CLASS) != EFL_CLASS_TYPE_INTERFACE);
+
efl_unref(obj);
efl_object_shutdown();
return 0;
printf("%d\n", a);
fail_if(a != 5);
+ fail_if(efl_class_type_get(MIXIN_CLASS) != EFL_CLASS_TYPE_MIXIN);
+
+
efl_unref(obj);
efl_object_shutdown();
return 0;
}
EFL_END_TEST
+EFL_START_TEST(eo_test_class_type)
+{
+ ck_assert_int_eq(efl_class_type_get(SIMPLE_CLASS), EFL_CLASS_TYPE_REGULAR);
+ ck_assert_int_eq(efl_class_type_get((void*)0xAFFE), EFL_CLASS_TYPE_INVALID);
+}
+EFL_END_TEST
+
void eo_test_general(TCase *tc)
{
tcase_add_test(tc, eo_simple);
tcase_add_test(tc, efl_object_destruct_test);
tcase_add_test(tc, efl_object_auto_unref_test);
tcase_add_test(tc, efl_object_size);
+ tcase_add_test(tc, eo_test_class_type);
}