forked from enlightenment/efl
eolian: add api to access the requires field
Summary: This is needed in order to support checking the correct regular classes in efl#. ref T7240 Depends on D7673 Test Plan: run ninja test / make check Reviewers: q66, felipealmeida, segfaultxavi Reviewed By: felipealmeida Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7240 Differential Revision: https://phab.enlightenment.org/D7674
This commit is contained in:
parent
ceac54b23b
commit
8e487069c9
|
@ -1461,6 +1461,19 @@ EAPI Eina_Stringshare *eolian_class_data_type_get(const Eolian_Class *klass);
|
|||
*/
|
||||
EAPI const Eolian_Class *eolian_class_parent_get(const Eolian_Class *klass);
|
||||
|
||||
/*
|
||||
* @brief Returns an iterator to the required classes of this mixin
|
||||
*
|
||||
* For none mixins this will return an empty iterator, for mixins this retuns a iterator that
|
||||
* carries all the classes that are required by this passed mixin.
|
||||
*
|
||||
* @param[in] klass the class
|
||||
* @return the iterator
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Iterator *eolian_class_requires_get(const Eolian_Class *klass);
|
||||
|
||||
/*
|
||||
* @brief Returns an iterator to the class extensions
|
||||
*
|
||||
|
|
|
@ -55,6 +55,12 @@ eolian_class_parent_get(const Eolian_Class *cl)
|
|||
return cl->parent;
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
eolian_class_requires_get(const Eolian_Class *cl)
|
||||
{
|
||||
return eina_list_iterator_new(cl->requires);
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
eolian_class_extensions_get(const Eolian_Class *cl)
|
||||
{
|
||||
|
|
|
@ -1583,14 +1583,35 @@ EFL_START_TEST(eolian_mixins_require)
|
|||
//check that implements contains this one class
|
||||
{
|
||||
Eolian_Implement *impl;
|
||||
Eina_Iterator *i = eolian_class_extensions_get (cl);
|
||||
Eina_Iterator *i = eolian_class_implements_get(cl);
|
||||
Eina_Array *tmp = eina_array_new(1);
|
||||
|
||||
EINA_ITERATOR_FOREACH(i, impl)
|
||||
{
|
||||
ck_assert_ptr_eq(eolian_implement_class_get(impl), base);
|
||||
if (eolian_implement_class_get(impl) != cl)
|
||||
{
|
||||
eina_array_push(tmp, eolian_implement_class_get(impl));
|
||||
ck_assert_ptr_eq(eolian_implement_class_get(impl), base);
|
||||
}
|
||||
}
|
||||
ck_assert_int_eq(eina_array_count(tmp), 1);
|
||||
eina_array_free(tmp);
|
||||
eina_iterator_free(i);
|
||||
}
|
||||
//check that the mixins has the right require
|
||||
{
|
||||
Eina_Iterator *iter = eolian_class_requires_get(cl);
|
||||
Eina_Array *tmp = eina_array_new(1);
|
||||
|
||||
EINA_ITERATOR_FOREACH(iter, cl)
|
||||
{
|
||||
eina_array_push(tmp, cl);
|
||||
}
|
||||
ck_assert_int_eq(eina_array_count(tmp), 1);
|
||||
ck_assert_ptr_eq(eina_array_data_get(tmp, 0), base);
|
||||
eina_array_free(tmp);
|
||||
eina_iterator_free(iter);
|
||||
}
|
||||
eolian_state_free(eos);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
|
Loading…
Reference in New Issue