eolian: API refactoring

This commit is contained in:
Daniel Kolesa 2014-07-10 14:04:13 +01:00
parent 1772ab8a1c
commit 1293dce967
6 changed files with 63 additions and 72 deletions

View File

@ -234,8 +234,7 @@ EAPI Eina_Bool eolian_show(const Eolian_Class *klass);
*
* @ingroup Eolian
*/
EAPI const Eolian_Class *
eolian_class_find_by_name(const char *class_name);
EAPI const Eolian_Class *eolian_class_find_by_name(const char *class_name);
/*
* @brief Finds a class by its location (.eo file)
@ -245,8 +244,7 @@ eolian_class_find_by_name(const char *class_name);
*
* @ingroup Eolian
*/
EAPI const Eolian_Class *
eolian_class_find_by_file(const char *file_name);
EAPI const Eolian_Class *eolian_class_find_by_file(const char *file_name);
/*
* @brief Returns the name of the file containing the given class.
@ -256,8 +254,7 @@ eolian_class_find_by_file(const char *file_name);
*
* @ingroup Eolian
*/
EAPI const char *
eolian_class_file_get(const Eolian_Class *klass);
EAPI Eina_Stringshare *eolian_class_file_get(const Eolian_Class *klass);
/*
* @brief Returns the full name of the given class.
@ -270,8 +267,7 @@ eolian_class_file_get(const Eolian_Class *klass);
*
* @ingroup Eolian
*/
EAPI const char *
eolian_class_full_name_get(const Eolian_Class *klass);
EAPI Eina_Stringshare *eolian_class_full_name_get(const Eolian_Class *klass);
/*
* @brief Returns the name of the given class.
@ -281,8 +277,7 @@ eolian_class_full_name_get(const Eolian_Class *klass);
*
* @ingroup Eolian
*/
EAPI const char *
eolian_class_name_get(const Eolian_Class *klass);
EAPI Eina_Stringshare *eolian_class_name_get(const Eolian_Class *klass);
/*
* @brief Returns the namespaces list of the given class.
@ -292,8 +287,7 @@ eolian_class_name_get(const Eolian_Class *klass);
*
* @ingroup Eolian
*/
EAPI const Eina_List *
eolian_class_namespaces_list_get(const Eolian_Class *klass);
EAPI const Eina_List *eolian_class_namespaces_list_get(const Eolian_Class *klass);
/*
* @brief Returns the class type of the given class
@ -322,7 +316,7 @@ EAPI const Eina_List *eolian_all_classes_list_get(void);
*
* @ingroup Eolian
*/
EAPI const char *eolian_class_description_get(const Eolian_Class *klass);
EAPI Eina_Stringshare *eolian_class_description_get(const Eolian_Class *klass);
/*
* @brief Returns the legacy prefix of a class
@ -332,7 +326,7 @@ EAPI const char *eolian_class_description_get(const Eolian_Class *klass);
*
* @ingroup Eolian
*/
EAPI const char *eolian_class_legacy_prefix_get(const Eolian_Class *klass);
EAPI Eina_Stringshare *eolian_class_legacy_prefix_get(const Eolian_Class *klass);
/*
* @brief Returns the eo prefix of a class
@ -342,7 +336,7 @@ EAPI const char *eolian_class_legacy_prefix_get(const Eolian_Class *klass);
*
* @ingroup Eolian
*/
EAPI const char* eolian_class_eo_prefix_get(const Eolian_Class *klass);
EAPI Eina_Stringshare* eolian_class_eo_prefix_get(const Eolian_Class *klass);
/*
* @brief Returns the data type of a class
@ -352,8 +346,7 @@ EAPI const char* eolian_class_eo_prefix_get(const Eolian_Class *klass);
*
* @ingroup Eolian
*/
EAPI const char*
eolian_class_data_type_get(const Eolian_Class *klass);
EAPI Eina_Stringshare *eolian_class_data_type_get(const Eolian_Class *klass);
/*
* @brief Returns the names list of the inherit classes of a class
@ -404,7 +397,7 @@ EAPI Eolian_Function_Scope eolian_function_scope_get(const Eolian_Function *func
*
* @ingroup Eolian
*/
EAPI const char *eolian_function_name_get(const Eolian_Function *function_id);
EAPI Eina_Stringshare *eolian_function_name_get(const Eolian_Function *function_id);
/*
* @brief Returns the full C name of a function (with prefix). It's here
@ -417,7 +410,7 @@ EAPI const char *eolian_function_name_get(const Eolian_Function *function_id);
*
* @ingroup Eolian
*/
EAPI const char *eolian_function_full_c_name_get(const Eolian_Function *function_id, const char *prefix);
EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id, const char *prefix);
/*
* @brief Find a function in a class by its name and type
@ -440,7 +433,7 @@ EAPI const Eolian_Function *eolian_class_function_find_by_name(const Eolian_Clas
*
* @ingroup Eolian
*/
EAPI const char *eolian_function_data_get(const Eolian_Function *function_id, const char *key);
EAPI Eina_Stringshare *eolian_function_data_get(const Eolian_Function *function_id, const char *key);
/*
* @brief Indicates if a function is virtual pure.
@ -588,7 +581,7 @@ EAPI const Eolian_Type *eolian_function_return_type_get(const Eolian_Function *f
*
* @ingroup Eolian
*/
EAPI const char *
EAPI Eina_Stringshare *
eolian_function_return_dflt_value_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
/*
@ -603,8 +596,7 @@ eolian_function_return_dflt_value_get(const Eolian_Function *foo_id, Eolian_Func
*
* @ingroup Eolian
*/
EAPI const char *
eolian_function_return_comment_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
EAPI Eina_Stringshare *eolian_function_return_comment_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
/*
* @brief Indicates if a function return is warn-unused.
@ -651,8 +643,7 @@ EAPI Eina_Stringshare * eolian_implement_full_name_get(const Eolian_Implement *i
*
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_implement_information_get(const Eolian_Implement *impl,
const Eolian_Class **klass, const Eolian_Function **function, Eolian_Function_Type *type);
EAPI Eina_Bool eolian_implement_information_get(const Eolian_Implement *impl, const Eolian_Class **klass, const Eolian_Function **function, Eolian_Function_Type *type);
/*
* @brief Get the list of overriding functions defined in a class.
@ -792,7 +783,7 @@ EAPI const Eolian_Type *eolian_type_struct_field_get(const Eolian_Type *tp, cons
*
* @ingroup Eolian
*/
EAPI const char *eolian_type_struct_field_description_get(const Eolian_Type *tp, const char *field);
EAPI Eina_Stringshare *eolian_type_struct_field_description_get(const Eolian_Type *tp, const char *field);
/*
* @brief Get the description of a struct type.
@ -802,7 +793,7 @@ EAPI const char *eolian_type_struct_field_description_get(const Eolian_Type *tp,
*
* @ingroup Eolian
*/
EAPI const char *eolian_type_struct_description_get(const Eolian_Type *tp);
EAPI Eina_Stringshare *eolian_type_struct_description_get(const Eolian_Type *tp);
/*
* @brief Get the return type of a function type.

View File

@ -1,19 +1,19 @@
#include <Eina.h>
#include "eolian_database.h"
EAPI const char *
EAPI Eina_Stringshare *
eolian_class_file_get(const Eolian_Class *cl)
{
return cl ? cl->file : NULL;
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_class_full_name_get(const Eolian_Class *cl)
{
return cl ? cl->full_name : NULL;
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_class_name_get(const Eolian_Class *cl)
{
return cl ? cl->name : NULL;
@ -66,28 +66,28 @@ eolian_all_classes_list_get(void)
return _classes;
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_class_description_get(const Eolian_Class *cl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->description;
}
EAPI const char*
EAPI Eina_Stringshare*
eolian_class_legacy_prefix_get(const Eolian_Class *cl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->legacy_prefix;
}
EAPI const char*
EAPI Eina_Stringshare*
eolian_class_eo_prefix_get(const Eolian_Class *cl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
return cl->eo_prefix;
}
EAPI const char*
EAPI Eina_Stringshare*
eolian_class_data_type_get(const Eolian_Class *cl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);

View File

@ -15,14 +15,14 @@ eolian_function_type_get(const Eolian_Function *fid)
return fid->type;
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_function_name_get(const Eolian_Function *fid)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
return fid->name;
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_function_full_c_name_get(const Eolian_Function *foo_id, const char *prefix)
{
const char *funcn = eolian_function_name_get(foo_id);
@ -68,7 +68,7 @@ eolian_function_is_virtual_pure(const Eolian_Function *fid, Eolian_Function_Type
}
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_function_data_get(const Eolian_Function *fid, const char *key)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
@ -119,7 +119,7 @@ eolian_function_return_type_get(const Eolian_Function *fid, Eolian_Function_Type
}
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_function_return_dflt_value_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
{
const char *key = NULL;
@ -133,7 +133,7 @@ eolian_function_return_dflt_value_get(const Eolian_Function *fid, Eolian_Functio
return eolian_function_data_get(fid, key);
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_function_return_comment_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
{
const char *key = NULL;

View File

@ -71,7 +71,7 @@ eolian_type_struct_field_get(const Eolian_Type *tp, const char *field)
return sf->type;
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_type_struct_field_description_get(const Eolian_Type *tp, const char *field)
{
_Struct_Field_Type *sf = NULL;
@ -83,7 +83,7 @@ eolian_type_struct_field_description_get(const Eolian_Type *tp, const char *fiel
return sf->comment;
}
EAPI const char *
EAPI Eina_Stringshare *
eolian_type_struct_description_get(const Eolian_Type *tp)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);

View File

@ -9,7 +9,7 @@
typedef struct _eo_type_def Eo_Type_Def;
struct _eo_type_def
{
const char *name;
Eina_Stringshare *name;
Eolian_Type_Type type;
union {
struct {
@ -21,8 +21,8 @@ struct _eo_type_def
Eo_Type_Def *ret_type;
};
struct {
Eina_Hash *fields;
const char *comment;
Eina_Hash *fields;
Eina_Stringshare *comment;
};
};
Eina_Bool is_const :1;
@ -32,7 +32,7 @@ struct _eo_type_def
typedef struct _eo_struct_field_def
{
Eo_Type_Def *type;
const char *comment;
Eina_Stringshare *comment;
} Eo_Struct_Field_Def;
/* RET */
@ -40,8 +40,8 @@ typedef struct _eo_struct_field_def
typedef struct _eo_ret_def
{
Eo_Type_Def *type;
const char *comment;
const char *dflt_ret_val;
Eina_Stringshare *comment;
Eina_Stringshare *dflt_ret_val;
Eina_Bool warn_unused:1;
} Eo_Ret_Def;
@ -59,8 +59,8 @@ typedef struct _eo_param_def
{
Param_Way way;
Eo_Type_Def *type;
const char *name;
const char *comment;
Eina_Stringshare *name;
Eina_Stringshare *comment;
Eina_Bool nonull:1;
} Eo_Param_Def;
@ -75,7 +75,7 @@ typedef enum _eo_accessor_type
typedef struct _eo_accessor_param
{
const char *name;
Eina_Stringshare *name;
Eina_Bool is_const:1;
} Eo_Accessor_Param;
@ -83,8 +83,8 @@ typedef struct _eo_accessor_def
{
Eo_Accessor_Type type;
Eo_Ret_Def *ret;
const char *comment;
const char* legacy;
Eina_Stringshare *comment;
Eina_Stringshare* legacy;
Eina_List *params; /* List of Eo_Accessor_Param */
} Eo_Accessor_Def;
@ -92,7 +92,7 @@ typedef struct _eo_accessor_def
typedef struct _eo_property_def
{
const char *name;
Eina_Stringshare *name;
Eina_List *keys;
Eina_List *values;
Eina_List *accessors;
@ -111,10 +111,10 @@ typedef struct _eo_method_def
{
Eo_Ret_Def *ret;
Eo_Method_Type type;
const char *name;
const char *comment;
Eina_Stringshare *name;
Eina_Stringshare *comment;
Eina_List *params;
const char* legacy;
Eina_Stringshare *legacy;
Eina_Bool obj_const;
int scope;
} Eo_Method_Def;
@ -123,28 +123,28 @@ typedef struct _eo_method_def
typedef struct _eo_event_def
{
const char *name;
const char *type;
const char *comment;
Eina_Stringshare *name;
Eina_Stringshare *type;
Eina_Stringshare *comment;
} Eo_Event_Def;
/* IMPLEMENT */
typedef struct _eo_implement_def
{
const char *meth_name;
Eina_Stringshare *meth_name;
} Eo_Implement_Def;
/* CLASS */
typedef struct _eo_class_def
{
const char *name;
Eina_Stringshare *name;
Eolian_Class_Type type;
const char *comment;
const char *legacy_prefix;
const char *eo_prefix;
const char *data_type;
Eina_Stringshare *comment;
Eina_Stringshare *legacy_prefix;
Eina_Stringshare *eo_prefix;
Eina_Stringshare *data_type;
Eina_List *inherits;
Eina_List *implements;
Eina_List *events;
@ -157,7 +157,7 @@ typedef struct _eo_class_def
typedef struct _eo_typedef_def
{
const char *alias;
Eina_Stringshare *alias;
Eo_Type_Def *type;
} Eo_Typedef_Def;
@ -167,7 +167,7 @@ typedef struct _Eo_Lexer_Temps
{
Eina_List *str_bufs;
Eina_List *params;
const char *legacy_def;
Eina_Stringshare *legacy_def;
Eo_Class_Def *kls;
Eo_Ret_Def *ret_def;
Eo_Typedef_Def *typedef_def;

View File

@ -108,13 +108,13 @@ struct _Eolian_Function_Parameter
typedef struct
{
Eolian_Type *type;
const char *comment;
Eolian_Type *type;
Eina_Stringshare *comment;
} _Struct_Field_Type;
struct _Eolian_Type
{
const char *name;
Eina_Stringshare *name;
Eolian_Type_Type type;
union {
struct {
@ -126,8 +126,8 @@ struct _Eolian_Type
Eolian_Type *ret_type;
};
struct {
Eina_Hash *fields;
const char *comment;
Eina_Hash *fields;
Eina_Stringshare *comment;
};
};
Eina_Bool is_const :1;