eolian: type_struct_description, type_struct_file -> type_description, type_file

This commit is contained in:
Daniel Kolesa 2014-07-21 14:38:43 +01:00
parent 7117aad879
commit 460cfd9e34
4 changed files with 21 additions and 12 deletions

View File

@ -867,24 +867,24 @@ EAPI const Eolian_Type *eolian_type_struct_field_get(const Eolian_Type *tp, cons
EAPI Eina_Stringshare *eolian_type_struct_field_description_get(const Eolian_Type *tp, const char *field);
/*
* @brief Get the description of a struct type.
* @brief Get the description of a struct/alias type.
*
* @param[in] tp the type.
* @return the description when @c tp is EOLIAN_TYPE_STRUCT, NULL otherwise.
*
* @ingroup Eolian
*/
EAPI Eina_Stringshare *eolian_type_struct_description_get(const Eolian_Type *tp);
EAPI Eina_Stringshare *eolian_type_description_get(const Eolian_Type *tp);
/*
* @brief Get the filename of a struct type.
* @brief Get the filename of a struct/alias type.
*
* @param[in] tp the type.
* @return the filename when @c tp is EOLIAN_TYPE_STRUCT, NULL otherwise.
*
* @ingroup Eolian
*/
EAPI Eina_Stringshare *eolian_type_struct_file_get(const Eolian_Type *tp);
EAPI Eina_Stringshare *eolian_type_file_get(const Eolian_Type *tp);
/*
* @brief Get the return type of a function type.

View File

@ -104,18 +104,26 @@ eolian_type_struct_field_description_get(const Eolian_Type *tp, const char *fiel
}
EAPI Eina_Stringshare *
eolian_type_struct_description_get(const Eolian_Type *tp)
eolian_type_description_get(const Eolian_Type *tp)
{
Eolian_Type_Type tpp;
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
return tp->comment;
tpp = eolian_type_type_get(tp);
EINA_SAFETY_ON_FALSE_RETURN_VAL(tpp != EOLIAN_TYPE_POINTER
&& tpp != EOLIAN_TYPE_FUNCTION
&& tpp != EOLIAN_TYPE_VOID, NULL);
return eina_stringshare_ref(tp->comment);
}
EAPI Eina_Stringshare *
eolian_type_struct_file_get(const Eolian_Type *tp)
eolian_type_file_get(const Eolian_Type *tp)
{
Eolian_Type_Type tpp;
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
tpp = eolian_type_type_get(tp);
EINA_SAFETY_ON_FALSE_RETURN_VAL(tpp != EOLIAN_TYPE_POINTER
&& tpp != EOLIAN_TYPE_FUNCTION
&& tpp != EOLIAN_TYPE_VOID, NULL);
return eina_stringshare_ref(tp->file);
}

View File

@ -100,7 +100,7 @@ struct _Eolian_Type
{
Eolian_Type_Type type;
union {
/* pointers */
/* pointers and regular types */
struct {
Eina_List *subtypes;
Eolian_Type *base_type;
@ -112,6 +112,7 @@ struct _Eolian_Type
};
/* structs, aliases, regular types */
struct {
void *pad; /* make space for subtypes */
Eina_Stringshare *name; /* all */
Eina_Stringshare *full_name; /* all */
Eina_List *namespaces; /* all */

View File

@ -508,7 +508,7 @@ START_TEST(eolian_struct)
/* named struct */
fail_if(!(type = eolian_type_struct_find_by_name("Named")));
fail_if(!(type_name = eolian_type_name_get(type)));
fail_if(!(file = eolian_type_struct_file_get(type)));
fail_if(!(file = eolian_type_file_get(type)));
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT);
fail_if(eolian_type_is_own(type));
fail_if(eolian_type_is_const(type));
@ -528,7 +528,7 @@ START_TEST(eolian_struct)
/* referencing */
fail_if(!(type = eolian_type_struct_find_by_name("Another")));
fail_if(!(type_name = eolian_type_name_get(type)));
fail_if(!(file = eolian_type_struct_file_get(type)));
fail_if(!(file = eolian_type_file_get(type)));
fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT);
fail_if(strcmp(type_name, "Another"));
eina_stringshare_del(type_name);