parent: Eo.Base * @nullable; [[the new parent]]
}
}
+ @property id {
+ [[ The id/name of the object.
+
+ Every object can have a string name. Names may not contain
+ the slash "/" character. It is illegal. Using it in a name
+ will result in undefined behavior later on. An empty string
+ is considered the same as a NULL string or no string for the
+ name/id at all.
+ ]]
+ set {
+ }
+ get {
+ }
+ values {
+ id: const(char)* @nullable; [[the id/name]]
+ }
+ }
@property event_global_freeze_count @class {
get {
[[Return freeze events of object.
Eina_Inlist *generic_data;
Eo ***wrefs;
+ const char *id;
Eo_Callback_Description *callbacks;
unsigned short walking_list;
unsigned short event_freeze_count;
}
EOLIAN static void
+_eo_base_id_set(Eo *obj EINA_UNUSED, Eo_Base_Data *pd, const char *id)
+{
+ if ((id) && (!id[0])) id = NULL;
+ eina_stringshare_replace(&(pd->id), id);
+}
+
+EOLIAN static const char *
+_eo_base_id_get(Eo *obj EINA_UNUSED, Eo_Base_Data *pd)
+{
+ return pd->id;
+}
+
+
+EOLIAN static void
_eo_base_parent_set(Eo *obj, Eo_Base_Data *pd, Eo *parent_id)
{
if (pd->parent == parent_id)
_wref_destruct(pd);
_eo_callback_remove_all(pd);
+ eina_stringshare_del(pd->id);
+ pd->id = NULL;
+
_eo_condtor_done(obj);
}
}
END_TEST
+START_TEST(eo_name)
+{
+ eo_init();
+ Eo *obj = eo_add(SIMPLE_CLASS, NULL);
+ const char *id;
+
+ id = eo_id_get(obj);
+ fail_if(NULL != id);
+
+ eo_id_set(obj, "Hello");
+ id = eo_id_get(obj);
+ fail_if(NULL == id);
+ fail_if(!!strcmp(id, "Hello"));
+
+ eo_id_set(obj, "Hello");
+ eo_id_set(obj, "");
+ id = eo_id_get(obj);
+ fail_if(NULL != id);
+
+ eo_id_set(obj, "Hello");
+ eo_id_set(obj, NULL);
+ id = eo_id_get(obj);
+ fail_if(NULL != id);
+
+ eo_del(obj);
+
+ eo_shutdown();
+}
+END_TEST
+
void eo_test_general(TCase *tc)
{
tcase_add_test(tc, eo_simple);
tcase_add_test(tc, eo_pointers_indirection);
tcase_add_test(tc, eo_add_failures);
tcase_add_test(tc, eo_del_intercept);
+ tcase_add_test(tc, eo_name);
}