eolian: add actual useful declaration APIs
This commit is contained in:
parent
522c021a36
commit
e58da1faa0
|
@ -310,6 +310,7 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
EOLIAN_DECL_UNKNOWN = -1,
|
||||
EOLIAN_DECL_CLASS,
|
||||
EOLIAN_DECL_ALIAS,
|
||||
EOLIAN_DECL_STRUCT,
|
||||
|
@ -2070,6 +2071,58 @@ EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var);
|
|||
*/
|
||||
EAPI Eina_Iterator *eolian_declarations_get_by_file(const char *fname);
|
||||
|
||||
/*
|
||||
* @brief Get the type of a declaration
|
||||
*
|
||||
* @param[in] decl the declaration
|
||||
* @return the declaration type
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eolian_Declaration_Type eolian_declaration_type_get(const Eolian_Declaration *decl);
|
||||
|
||||
/*
|
||||
* @brief Get the name of a declaration
|
||||
*
|
||||
* This matches the full namespaced name of the data it's holding.
|
||||
*
|
||||
* @param[in] decl the declaration
|
||||
* @return the declaration name
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Stringshare *eolian_declaration_name_get(const Eolian_Declaration *decl);
|
||||
|
||||
/*
|
||||
* @brief Get the class of a class declaration.
|
||||
*
|
||||
* @param[in] decl the declaration
|
||||
* @return the class
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI const Eolian_Class *eolian_declaration_class_get(const Eolian_Declaration *decl);
|
||||
|
||||
/*
|
||||
* @brief Get the type of a type (alias, struct, enum) declaration.
|
||||
*
|
||||
* @param[in] decl the declaration
|
||||
* @return the type
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI const Eolian_Type *eolian_declaration_data_type_get(const Eolian_Declaration *decl);
|
||||
|
||||
/*
|
||||
* @brief Get the variable of a variable (constant, global) declaration.
|
||||
*
|
||||
* @param[in] decl the declaration
|
||||
* @return the class
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI const Eolian_Variable *eolian_declaration_variable_get(const Eolian_Declaration *decl);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -120,6 +120,48 @@ eolian_declarations_get_by_file(const char *fname)
|
|||
return eina_list_iterator_new(l);
|
||||
}
|
||||
|
||||
EAPI Eolian_Declaration_Type
|
||||
eolian_declaration_type_get(const Eolian_Declaration *decl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(decl, EOLIAN_DECL_UNKNOWN);
|
||||
return decl->type;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_declaration_name_get(const Eolian_Declaration *decl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(decl, NULL);
|
||||
return decl->name;
|
||||
}
|
||||
|
||||
EAPI const Eolian_Class *
|
||||
eolian_declaration_class_get(const Eolian_Declaration *decl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(decl, NULL);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(decl->type == EOLIAN_DECL_CLASS, NULL);
|
||||
return (const Eolian_Class *)decl->data;
|
||||
}
|
||||
|
||||
EAPI const Eolian_Type *
|
||||
eolian_declaration_data_type_get(const Eolian_Declaration *decl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(decl, NULL);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(decl->type == EOLIAN_DECL_ALIAS ||
|
||||
decl->type == EOLIAN_DECL_STRUCT ||
|
||||
decl->type == EOLIAN_DECL_ENUM, NULL);
|
||||
return (const Eolian_Type *)decl->data;
|
||||
}
|
||||
|
||||
|
||||
EAPI const Eolian_Variable *
|
||||
eolian_declaration_variable_get(const Eolian_Declaration *decl)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(decl, NULL);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(decl->type == EOLIAN_DECL_VAR, NULL);
|
||||
return (const Eolian_Variable *)decl->data;
|
||||
}
|
||||
|
||||
|
||||
#define EO_SUFFIX ".eo"
|
||||
#define EOT_SUFFIX ".eot"
|
||||
|
||||
|
|
Loading…
Reference in New Issue