eolian: APIs to check if an implement references get/set

This commit is contained in:
Daniel Kolesa 2014-08-29 15:30:51 +01:00
parent b05f738675
commit 4785353baf
4 changed files with 45 additions and 4 deletions

View File

@ -661,6 +661,8 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
const char *rets;
char *tp = implname;
const char *names[] = { "", "getter ", "setter " };
if ((impl_class = eolian_implement_class_get(impl_desc)))
{
fnid = eolian_implement_function_get(impl_desc, &ftype);
@ -673,8 +675,10 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
if (!fnid)
{
ERR ("Failed to generate implementation of %s - missing form super class",
eolian_implement_full_name_get(impl_desc));
const char *name = names[eolian_implement_is_prop_get(impl_desc)
| (eolian_implement_is_prop_set(impl_desc) << 1)];
ERR ("Failed to generate implementation of %s%s - missing form super class",
name, eolian_implement_full_name_get(impl_desc));
goto end;
}

View File

@ -276,13 +276,16 @@ impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buffer)
if (itr)
{
Eolian_Implement *impl_desc;
const char *names[] = { "", "getter ", "setter " };
EINA_ITERATOR_FOREACH(itr, impl_desc)
{
Eolian_Function_Type ftype;
if (!(foo = eolian_implement_function_get(impl_desc, &ftype)))
{
ERR ("Failed to generate implementation of %s - missing form super class",
eolian_implement_full_name_get(impl_desc));
const char *name = names[eolian_implement_is_prop_get(impl_desc)
| (eolian_implement_is_prop_set(impl_desc) << 1)];
ERR ("Failed to generate implementation of %s%s - missing form super class",
name, eolian_implement_full_name_get(impl_desc));
goto end;
}
switch (ftype)

View File

@ -945,6 +945,26 @@ EAPI Eina_Bool eolian_implement_is_auto(const Eolian_Implement *impl);
*/
EAPI Eina_Bool eolian_implement_is_empty(const Eolian_Implement *impl);
/*
* @brief Get whether an implement references a property getter.
*
* @param[in] impl the handle of the implement
* @return EINA_TRUE when it does, EINA_FALSE when it's not.
*
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_implement_is_prop_get(const Eolian_Implement *impl);
/*
* @brief Get whether an implement references a property setter.
*
* @param[in] impl the handle of the implement
* @return EINA_TRUE when it does, EINA_FALSE when it's not.
*
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_implement_is_prop_set(const Eolian_Implement *impl);
/*
* @brief Get an iterator to the overriding functions defined in a class.
*

View File

@ -121,3 +121,17 @@ eolian_implement_is_empty(const Eolian_Implement *impl)
EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
return impl->is_empty;
}
EAPI Eina_Bool
eolian_implement_is_prop_get(const Eolian_Implement *impl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
return impl->is_prop_get;
}
EAPI Eina_Bool
eolian_implement_is_prop_set(const Eolian_Implement *impl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
return impl->is_prop_set;
}