eolian: new API: eolian_class_event_scope_get

This commit is contained in:
Daniel Kolesa 2014-08-13 11:53:33 +01:00
parent a5964f0252
commit ffbf149da1
7 changed files with 36 additions and 9 deletions

View File

@ -92,7 +92,7 @@ eo_fundef_generate(const Eolian_Class *class, Eolian_Function *func, Eolian_Func
const Eolian_Type *rettypet = NULL;
const char *rettype = NULL;
Eina_Bool ret_const = EINA_FALSE;
Eolian_Function_Scope scope = eolian_function_scope_get(func);
Eolian_Object_Scope scope = eolian_function_scope_get(func);
_class_func_env_create(class, eolian_function_name_get(func), ftype, &func_env);
char *fsuffix = "";

View File

@ -122,8 +122,9 @@ typedef enum
typedef enum
{
EOLIAN_SCOPE_PUBLIC,
EOLIAN_SCOPE_PRIVATE,
EOLIAN_SCOPE_PROTECTED
} Eolian_Function_Scope;
} Eolian_Object_Scope;
typedef enum
{
@ -583,7 +584,7 @@ EAPI Eolian_Function_Type eolian_function_type_get(const Eolian_Function *functi
*
* @ingroup Eolian
*/
EAPI Eolian_Function_Scope eolian_function_scope_get(const Eolian_Function *function_id);
EAPI Eolian_Object_Scope eolian_function_scope_get(const Eolian_Function *function_id);
/*
* @brief Returns the name of a function
@ -884,6 +885,16 @@ EAPI Eina_Iterator *eolian_class_events_get(const Eolian_Class *klass);
*/
EAPI Eina_Bool eolian_class_event_information_get(const Eolian_Event *event, const char **event_name, const Eolian_Type **event_type, const char **event_desc);
/*
* @brief Returns the scope of an event
*
* @param[in] event the event handle
* @return the event scope
*
* @ingroup Eolian
*/
EAPI Eolian_Object_Scope eolian_class_event_scope_get(const Eolian_Event *event);
/*
* @brief Indicates if the class constructor has to invoke
* a non-generated class constructor function.

View File

@ -10,3 +10,10 @@ eolian_class_event_information_get(const Eolian_Event *event, const char **event
if (event_comment) *event_comment = event->comment;
return EINA_TRUE;
}
EAPI Eolian_Object_Scope
eolian_class_event_scope_get(const Eolian_Event *event)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(event, EOLIAN_SCOPE_PUBLIC);
return event->scope;
}

View File

@ -30,7 +30,7 @@ database_function_new(const char *function_name, Eolian_Function_Type foo_type)
}
void
database_function_scope_set(Eolian_Function *fid, Eolian_Function_Scope scope)
database_function_scope_set(Eolian_Function *fid, Eolian_Object_Scope scope)
{
EINA_SAFETY_ON_NULL_RETURN(fid);
fid->scope = scope;

View File

@ -1,7 +1,7 @@
#include <Eina.h>
#include "eolian_database.h"
EAPI Eolian_Function_Scope
EAPI Eolian_Object_Scope
eolian_function_scope_get(const Eolian_Function *fid)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_SCOPE_PUBLIC);

View File

@ -1487,8 +1487,16 @@ parse_event(Eo_Lexer *ls)
}
ev->name = eina_stringshare_add(eina_strbuf_string_get(buf));
pop_strbuf(ls);
if (ls->t.kw == KW_at_private || ls->t.kw == KW_at_protected)
eo_lexer_get(ls);
if (ls->t.kw == KW_at_private)
{
ev->scope = EOLIAN_SCOPE_PRIVATE;
eo_lexer_get(ls);
}
else if (ls->t.kw == KW_at_protected)
{
ev->scope = EOLIAN_SCOPE_PROTECTED;
eo_lexer_get(ls);
}
if (ls->t.token == ':')
{
eo_lexer_get(ls);

View File

@ -86,7 +86,7 @@ struct _Eolian_Function
Eina_List *keys; /* list of Eolian_Function_Parameter */
Eina_List *params; /* list of Eolian_Function_Parameter */
Eolian_Function_Type type;
Eolian_Function_Scope scope;
Eolian_Object_Scope scope;
Eolian_Type *get_ret_type;
Eolian_Type *set_ret_type;
Eolian_Expression *get_ret_val;
@ -152,6 +152,7 @@ struct _Eolian_Event
Eina_Stringshare *name;
Eina_Stringshare *comment;
Eolian_Type *type;
int scope;
};
typedef struct _Eolian_Struct_Field
@ -319,7 +320,7 @@ void database_function_return_flag_set_as_warn_unused(Eolian_Function *foo_id, E
void database_function_object_set_as_const(Eolian_Function *foo_id, Eina_Bool is_const);
void database_function_set_as_class(Eolian_Function *foo_id, Eina_Bool is_class);
Eina_Bool database_function_set_as_virtual_pure(Eolian_Function *function_id, Eolian_Function_Type type);
void database_function_scope_set(Eolian_Function *function_id, Eolian_Function_Scope scope);
void database_function_scope_set(Eolian_Function *function_id, Eolian_Object_Scope scope);
Eolian_Function_Parameter *database_property_key_add(Eolian_Function *foo_id, Eolian_Type *type, const char *name, const char *description);
Eolian_Function_Parameter *database_property_value_add(Eolian_Function *foo_id, Eolian_Type *type, const char *name, const char *description);