Eo_Kls_Itr mro_itr;
+ Eina_Bool composite:1;
Eina_Bool del:1;
Eina_Bool construct_error:1;
Eina_Bool manual_free:1;
_eo_ref(obj);
+ if (eo_composite_is(obj))
+ {
+ eo_composite_object_detach(obj->parent, obj);
+ }
+
if (obj->parent)
{
obj->parent->children =
EO_MAGIC_RETURN(obj, EO_EINA_MAGIC);
EO_MAGIC_RETURN(emb_obj, EO_EINA_MAGIC);
- eo_xref(emb_obj, obj);
+ emb_obj->composite = EINA_TRUE;
+ eo_parent_set(emb_obj, obj);
obj->composite_objects = eina_list_prepend(obj->composite_objects, emb_obj);
}
EO_MAGIC_RETURN(obj, EO_EINA_MAGIC);
EO_MAGIC_RETURN(emb_obj, EO_EINA_MAGIC);
+ emb_obj->composite = EINA_FALSE;
obj->composite_objects = eina_list_remove(obj->composite_objects, emb_obj);
- eo_xunref(emb_obj, obj);
+ eo_parent_set(emb_obj, NULL);
}
EAPI Eina_Bool
return EINA_FALSE;
}
- Eo *obj = eo_parent_get(emb_obj);
- Eina_List *itr;
- Eo *tmp;
-
- if (!obj)
- return EINA_FALSE;
-
- EINA_LIST_FOREACH(obj->composite_objects, itr, tmp)
- {
- if (tmp == emb_obj)
- return EINA_TRUE;
- }
-
- return EINA_FALSE;
+ return emb_obj->composite;
}
EAPI void
}
END_TEST
+START_TEST(eo_composite_tests)
+{
+ eo_init();
+
+ Eo *obj = eo_add(SIMPLE_CLASS, NULL);
+ fail_if(!obj);
+ Eo *obj2 = eo_add(SIMPLE_CLASS, NULL);
+ fail_if(!obj2);
+
+ eo_composite_object_attach(obj, obj2);
+ eo_parent_set(obj2, NULL);
+ fail_if(eo_composite_is(obj2));
+
+ eo_unref(obj2);
+ eo_unref(obj);
+
+ eo_shutdown();
+}
+END_TEST
+
START_TEST(eo_static_classes)
{
eo_init();
tcase_add_test(tc, eo_data_fetch);
tcase_add_test(tc, eo_man_free);
tcase_add_test(tc, eo_static_classes);
+ tcase_add_test(tc, eo_composite_tests);
}