eolian: new API: eolian_class_event_scope_get
authorDaniel Kolesa <d.kolesa@samsung.com>
Wed, 13 Aug 2014 10:53:33 +0000 (11:53 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Thu, 21 Aug 2014 08:26:04 +0000 (09:26 +0100)
src/bin/eolian/eo_generator.c
src/lib/eolian/Eolian.h
src/lib/eolian/database_event_api.c
src/lib/eolian/database_function.c
src/lib/eolian/database_function_api.c
src/lib/eolian/eo_parser.c
src/lib/eolian/eolian_database.h

index 90d87b69cf5019ea1d04f52831cda101def6b3cb..505072ef771326694a3df4ab67285512609a2fc7 100644 (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 = "";
index b090f7ddfa190f9b536dca0f2d917b275fe31526..e5c72f30e47ec1d01b9f18337fa2883bb7c2a776 100644 (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.
index 520ef93558247e73276d96fc20435e76ae972d22..877932e1f87b03687af13a8904b92a017b53086d 100644 (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;
+}
index 97bbf59d71c8d18d344ffaed2a7fbc4b17ceb379..eb3956167b9c5242e278c11d3b481631bd5697ff 100644 (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;
index caf76472ed5367b5246c91bfdfe9f0f6cf350337..9cd0656eb7e33dfc77c667c090c5ad72014ef604 100644 (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);
index 97d35112311c8a682b0701f6d183e3c6ea551805..5dc244d7dc661f636dd475efe2da782760d8394b 100644 (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);
index 59e21b95c2d0d814ee5d4c14299cdd62ed239132..bd0730166bdf508789754b8832a2f03d5b7136b3 100644 (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);