eolian: separate database API and internals into different source files
authorDaniel Kolesa <d.kolesa@samsung.com>
Thu, 10 Jul 2014 12:13:46 +0000 (13:13 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Thu, 10 Jul 2014 12:13:46 +0000 (13:13 +0100)
14 files changed:
src/Makefile_Eolian.am
src/lib/eolian/database_class.c
src/lib/eolian/database_class_api.c [new file with mode: 0644]
src/lib/eolian/database_event.c
src/lib/eolian/database_event_api.c [new file with mode: 0644]
src/lib/eolian/database_function.c
src/lib/eolian/database_function_api.c [new file with mode: 0644]
src/lib/eolian/database_function_parameter.c
src/lib/eolian/database_function_parameter_api.c [new file with mode: 0644]
src/lib/eolian/database_implement.c
src/lib/eolian/database_implement_api.c [new file with mode: 0644]
src/lib/eolian/database_type.c
src/lib/eolian/database_type_api.c [new file with mode: 0644]
src/lib/eolian/eolian_database.h

index ac738a2..22a5c36 100644 (file)
@@ -17,11 +17,17 @@ lib_eolian_libeolian_la_SOURCES = \
                                   lib/eolian/eolian_database.c \
                                   lib/eolian/eolian_database.h \
                                   lib/eolian/database_class.c \
+                                  lib/eolian/database_class_api.c \
                                   lib/eolian/database_function.c \
+                                  lib/eolian/database_function_api.c \
                                   lib/eolian/database_function_parameter.c \
+                                  lib/eolian/database_function_parameter_api.c \
                                   lib/eolian/database_type.c \
+                                  lib/eolian/database_type_api.c \
                                   lib/eolian/database_implement.c \
+                                  lib/eolian/database_implement_api.c \
                                   lib/eolian/database_event.c \
+                                  lib/eolian/database_event_api.c \
                                   lib/eolian/database_print.c
 
 lib_eolian_libeolian_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EOLIAN_CFLAGS@ \
index e8218b0..7d28aff 100644 (file)
@@ -72,44 +72,6 @@ database_class_file_set(Eolian_Class *class, const char *file_name)
    return EINA_TRUE;
 }
 
-EAPI const char *
-eolian_class_file_get(const Eolian_Class *cl)
-{
-   return cl ? cl->file : NULL;
-}
-
-EAPI const char *
-eolian_class_full_name_get(const Eolian_Class *cl)
-{
-   return cl ? cl->full_name : NULL;
-}
-
-EAPI const char *
-eolian_class_name_get(const Eolian_Class *cl)
-{
-   return cl ? cl->name : NULL;
-}
-
-EAPI const Eina_List *
-eolian_class_namespaces_list_get(const Eolian_Class *cl)
-{
-   return cl ? cl->namespaces : NULL;
-}
-
-EAPI const Eolian_Class *
-eolian_class_find_by_name(const char *class_name)
-{
-   Eina_List *itr;
-   Eolian_Class *cl;
-   Eina_Stringshare *shr_name = eina_stringshare_add(class_name);
-   EINA_LIST_FOREACH(_classes, itr, cl)
-      if (cl->full_name == shr_name) goto end;
-   cl = NULL;
-end:
-   eina_stringshare_del(shr_name);
-   return cl;
-}
-
 /*
  * ret false -> clash, class = NULL
  * ret true && class -> only one class corresponding
@@ -147,33 +109,6 @@ Eina_Bool database_class_name_validate(const char *class_name, const Eolian_Clas
    return EINA_TRUE;
 }
 
-EAPI const Eolian_Class *
-eolian_class_find_by_file(const char *file_name)
-{
-   Eina_List *itr;
-   Eolian_Class *cl;
-   Eina_Stringshare *shr_file = eina_stringshare_add(file_name);
-   EINA_LIST_FOREACH(_classes, itr, cl)
-      if (cl->file == shr_file) goto end;
-   cl = NULL;
-end:
-   eina_stringshare_del(shr_file);
-   return cl;
-}
-
-EAPI Eolian_Class_Type
-eolian_class_type_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EOLIAN_CLASS_UNKNOWN_TYPE);
-   return cl->type;
-}
-
-EAPI const Eina_List *
-eolian_all_classes_list_get(void)
-{
-   return _classes;
-}
-
 Eina_Bool
 database_class_inherit_add(Eolian_Class *cl, const char *inherit_class_name)
 {
@@ -182,13 +117,6 @@ database_class_inherit_add(Eolian_Class *cl, const char *inherit_class_name)
    return EINA_TRUE;
 }
 
-EAPI const char *
-eolian_class_description_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
-   return cl->description;
-}
-
 void
 database_class_description_set(Eolian_Class *cl, const char *description)
 {
@@ -196,13 +124,6 @@ database_class_description_set(Eolian_Class *cl, const char *description)
    cl->description = eina_stringshare_add(description);
 }
 
-EAPI const char*
-eolian_class_legacy_prefix_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
-   return cl->legacy_prefix;
-}
-
 void
 database_class_legacy_prefix_set(Eolian_Class *cl, const char *legacy_prefix)
 {
@@ -210,13 +131,6 @@ database_class_legacy_prefix_set(Eolian_Class *cl, const char *legacy_prefix)
    cl->legacy_prefix = eina_stringshare_add(legacy_prefix);
 }
 
-EAPI const char*
-eolian_class_eo_prefix_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
-   return cl->eo_prefix;
-}
-
 void
 database_class_eo_prefix_set(Eolian_Class *cl, const char *eo_prefix)
 {
@@ -224,13 +138,6 @@ database_class_eo_prefix_set(Eolian_Class *cl, const char *eo_prefix)
    cl->eo_prefix = eina_stringshare_add(eo_prefix);
 }
 
-EAPI const char*
-eolian_class_data_type_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
-   return cl->data_type;
-}
-
 void
 database_class_data_type_set(Eolian_Class *cl, const char *data_type)
 {
@@ -238,21 +145,6 @@ database_class_data_type_set(Eolian_Class *cl, const char *data_type)
    cl->data_type = eina_stringshare_add(data_type);
 }
 
-EAPI const Eina_List *
-eolian_class_inherits_list_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
-   //FIXME: create list here
-   return cl->inherits;
-}
-
-EAPI const Eina_List*
-eolian_class_implements_list_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
-   return cl->implements;
-}
-
 Eina_Bool database_class_function_add(Eolian_Class *cl, Eolian_Function *fid)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
@@ -286,59 +178,6 @@ database_class_implement_add(Eolian_Class *cl, Eolian_Implement *impl_desc)
    return EINA_TRUE;
 }
 
-EAPI const Eolian_Function *
-eolian_class_function_find_by_name(const Eolian_Class *cl, const char *func_name, Eolian_Function_Type f_type)
-{
-   Eina_List *itr;
-   Eolian_Function *fid;
-   if (!cl) return NULL;
-
-   if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_METHOD)
-      EINA_LIST_FOREACH(cl->methods, itr, fid)
-        {
-           if (!strcmp(fid->name, func_name))
-              return fid;
-        }
-
-   if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_PROPERTY ||
-         f_type == EOLIAN_PROP_SET || f_type == EOLIAN_PROP_GET)
-     {
-        EINA_LIST_FOREACH(cl->properties, itr, fid)
-          {
-             if (!strcmp(fid->name, func_name))
-                return fid;
-          }
-     }
-
-   if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_CTOR)
-     {
-        EINA_LIST_FOREACH(cl->constructors, itr, fid)
-          {
-             if (!strcmp(fid->name, func_name))
-                return fid;
-          }
-     }
-
-   ERR("Function %s not found in class %s", func_name, cl->name);
-   return NULL;
-}
-
-EAPI const Eina_List *
-eolian_class_functions_list_get(const Eolian_Class *cl, Eolian_Function_Type foo_type)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
-   switch (foo_type)
-     {
-      case EOLIAN_PROPERTY:
-         return cl->properties;
-      case EOLIAN_METHOD:
-         return cl->methods;
-      case EOLIAN_CTOR:
-         return cl->constructors;
-      default: return NULL;
-     }
-}
-
 Eina_Bool
 database_class_event_add(Eolian_Class *cl, Eolian_Event *event_desc)
 {
@@ -347,13 +186,6 @@ database_class_event_add(Eolian_Class *cl, Eolian_Event *event_desc)
    return EINA_TRUE;
 }
 
-EAPI const Eina_List*
-eolian_class_events_list_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
-   return cl->events;
-}
-
 Eina_Bool
 database_class_ctor_enable_set(Eolian_Class *cl, Eina_Bool enable)
 {
@@ -369,17 +201,3 @@ database_class_dtor_enable_set(Eolian_Class *cl, Eina_Bool enable)
    cl->class_dtor_enable = enable;
    return EINA_TRUE;
 }
-
-EAPI Eina_Bool
-eolian_class_ctor_enable_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
-   return cl->class_ctor_enable;
-}
-
-EAPI Eina_Bool
-eolian_class_dtor_enable_get(const Eolian_Class *cl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
-   return cl->class_dtor_enable;
-}
diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c
new file mode 100644 (file)
index 0000000..bf1483e
--- /dev/null
@@ -0,0 +1,184 @@
+#include <Eina.h>
+#include "eolian_database.h"
+
+EAPI const char *
+eolian_class_file_get(const Eolian_Class *cl)
+{
+   return cl ? cl->file : NULL;
+}
+
+EAPI const char *
+eolian_class_full_name_get(const Eolian_Class *cl)
+{
+   return cl ? cl->full_name : NULL;
+}
+
+EAPI const char *
+eolian_class_name_get(const Eolian_Class *cl)
+{
+   return cl ? cl->name : NULL;
+}
+
+EAPI const Eina_List *
+eolian_class_namespaces_list_get(const Eolian_Class *cl)
+{
+   return cl ? cl->namespaces : NULL;
+}
+
+EAPI const Eolian_Class *
+eolian_class_find_by_name(const char *class_name)
+{
+   Eina_List *itr;
+   Eolian_Class *cl;
+   Eina_Stringshare *shr_name = eina_stringshare_add(class_name);
+   EINA_LIST_FOREACH(_classes, itr, cl)
+      if (cl->full_name == shr_name) goto end;
+   cl = NULL;
+end:
+   eina_stringshare_del(shr_name);
+   return cl;
+}
+
+EAPI const Eolian_Class *
+eolian_class_find_by_file(const char *file_name)
+{
+   Eina_List *itr;
+   Eolian_Class *cl;
+   Eina_Stringshare *shr_file = eina_stringshare_add(file_name);
+   EINA_LIST_FOREACH(_classes, itr, cl)
+      if (cl->file == shr_file) goto end;
+   cl = NULL;
+end:
+   eina_stringshare_del(shr_file);
+   return cl;
+}
+
+EAPI Eolian_Class_Type
+eolian_class_type_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EOLIAN_CLASS_UNKNOWN_TYPE);
+   return cl->type;
+}
+
+EAPI const Eina_List *
+eolian_all_classes_list_get(void)
+{
+   return _classes;
+}
+
+EAPI const char *
+eolian_class_description_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
+   return cl->description;
+}
+
+EAPI const char*
+eolian_class_legacy_prefix_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
+   return cl->legacy_prefix;
+}
+
+EAPI const char*
+eolian_class_eo_prefix_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
+   return cl->eo_prefix;
+}
+
+EAPI const char*
+eolian_class_data_type_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
+   return cl->data_type;
+}
+
+EAPI const Eina_List *
+eolian_class_inherits_list_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
+   //FIXME: create list here
+   return cl->inherits;
+}
+
+EAPI const Eina_List*
+eolian_class_implements_list_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
+   return cl->implements;
+}
+
+EAPI const Eolian_Function *
+eolian_class_function_find_by_name(const Eolian_Class *cl, const char *func_name, Eolian_Function_Type f_type)
+{
+   Eina_List *itr;
+   Eolian_Function *fid;
+   if (!cl) return NULL;
+
+   if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_METHOD)
+      EINA_LIST_FOREACH(cl->methods, itr, fid)
+        {
+           if (!strcmp(fid->name, func_name))
+              return fid;
+        }
+
+   if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_PROPERTY ||
+         f_type == EOLIAN_PROP_SET || f_type == EOLIAN_PROP_GET)
+     {
+        EINA_LIST_FOREACH(cl->properties, itr, fid)
+          {
+             if (!strcmp(fid->name, func_name))
+                return fid;
+          }
+     }
+
+   if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_CTOR)
+     {
+        EINA_LIST_FOREACH(cl->constructors, itr, fid)
+          {
+             if (!strcmp(fid->name, func_name))
+                return fid;
+          }
+     }
+
+   ERR("Function %s not found in class %s", func_name, cl->name);
+   return NULL;
+}
+
+EAPI const Eina_List *
+eolian_class_functions_list_get(const Eolian_Class *cl, Eolian_Function_Type foo_type)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
+   switch (foo_type)
+     {
+      case EOLIAN_PROPERTY:
+         return cl->properties;
+      case EOLIAN_METHOD:
+         return cl->methods;
+      case EOLIAN_CTOR:
+         return cl->constructors;
+      default: return NULL;
+     }
+}
+
+EAPI const Eina_List *
+eolian_class_events_list_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
+   return cl->events;
+}
+
+EAPI Eina_Bool
+eolian_class_ctor_enable_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
+   return cl->class_ctor_enable;
+}
+
+EAPI Eina_Bool
+eolian_class_dtor_enable_get(const Eolian_Class *cl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
+   return cl->class_dtor_enable;
+}
index 13d0bad..4b9ed17 100644 (file)
@@ -20,13 +20,3 @@ database_event_free(Eolian_Event *event)
    eina_stringshare_del(event->comment);
    free(event);
 }
-
-EAPI Eina_Bool
-eolian_class_event_information_get(const Eolian_Event *event, const char **event_name, const char **event_type, const char **event_comment)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_FALSE);
-   if (event_name) *event_name = event->name;
-   if (event_type) *event_type = event->type;
-   if (event_comment) *event_comment = event->comment;
-   return EINA_TRUE;
-}
diff --git a/src/lib/eolian/database_event_api.c b/src/lib/eolian/database_event_api.c
new file mode 100644 (file)
index 0000000..5a184ff
--- /dev/null
@@ -0,0 +1,12 @@
+#include <Eina.h>
+#include "eolian_database.h"
+
+EAPI Eina_Bool
+eolian_class_event_information_get(const Eolian_Event *event, const char **event_name, const char **event_type, const char **event_comment)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_FALSE);
+   if (event_name) *event_name = event->name;
+   if (event_type) *event_type = event->type;
+   if (event_comment) *event_comment = event->comment;
+   return EINA_TRUE;
+}
index de81540..dff8928 100644 (file)
@@ -25,13 +25,6 @@ database_function_new(const char *function_name, Eolian_Function_Type foo_type)
    return fid;
 }
 
-EAPI Eolian_Function_Scope
-eolian_function_scope_get(const Eolian_Function *fid)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_SCOPE_PUBLIC);
-   return fid->scope;
-}
-
 void
 database_function_scope_set(Eolian_Function *fid, Eolian_Function_Scope scope)
 {
@@ -57,54 +50,6 @@ database_function_type_set(Eolian_Function *fid, Eolian_Function_Type foo_type)
    fid->type = foo_type;
 }
 
-EAPI Eolian_Function_Type
-eolian_function_type_get(const Eolian_Function *fid)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_UNRESOLVED);
-   return fid->type;
-}
-
-EAPI const char *
-eolian_function_name_get(const Eolian_Function *fid)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
-   return fid->name;
-}
-
-EAPI const char *
-eolian_function_full_c_name_get(const Eolian_Function *foo_id, const char *prefix)
-{
-   const char  *funcn = eolian_function_name_get(foo_id);
-   const char  *last_p = strrchr(prefix, '_');
-   const char  *func_p = strchr(funcn, '_');
-   Eina_Strbuf *buf = eina_strbuf_new();
-   Eina_Stringshare *ret;
-   int   len;
-
-   if (!last_p) last_p = prefix;
-   else last_p++;
-   if (!func_p) len = strlen(funcn);
-   else len = func_p - funcn;
-
-   if ((int)strlen(last_p) != len || strncmp(last_p, funcn, len))
-     {
-        eina_strbuf_append(buf, prefix);
-        eina_strbuf_append_char(buf, '_');
-        eina_strbuf_append(buf, funcn);
-        ret = eina_stringshare_add(eina_strbuf_string_get(buf));
-        eina_strbuf_free(buf);
-        return ret;
-     }
-
-   if (last_p != prefix)
-      eina_strbuf_append_n(buf, prefix, last_p - prefix); /* includes _ */
-
-   eina_strbuf_append(buf, funcn);
-   ret = eina_stringshare_add(eina_strbuf_string_get(buf));
-   eina_strbuf_free(buf);
-   return ret;
-}
-
 Eina_Bool
 database_function_set_as_virtual_pure(Eolian_Function *fid, Eolian_Function_Type ftype)
 {
@@ -118,18 +63,6 @@ database_function_set_as_virtual_pure(Eolian_Function *fid, Eolian_Function_Type
    return EINA_TRUE;
 }
 
-EAPI Eina_Bool
-eolian_function_is_virtual_pure(const Eolian_Function *fid, Eolian_Function_Type ftype)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
-   switch (ftype)
-     {
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_virtual_pure; break;
-      case EOLIAN_PROP_SET: return fid->set_virtual_pure; break;
-      default: return EINA_FALSE;
-     }
-}
-
 void
 database_function_data_set(Eolian_Function *fid, const char *key, const char *data)
 {
@@ -146,13 +79,6 @@ database_function_data_set(Eolian_Function *fid, const char *key, const char *da
      }
 }
 
-EAPI const char *
-eolian_function_data_get(const Eolian_Function *fid, const char *key)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
-   return eina_hash_find(fid->data, key);
-}
-
 Eolian_Function_Parameter *
 database_property_key_add(Eolian_Function *fid, Eolian_Type *type, const char *name, const char *description)
 {
@@ -181,39 +107,6 @@ database_method_parameter_add(Eolian_Function *fid, Eolian_Parameter_Dir param_d
    return param;
 }
 
-EAPI const Eolian_Function_Parameter *
-eolian_function_parameter_get(const Eolian_Function *fid, const char *param_name)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
-   Eina_List *itr;
-   Eolian_Function_Parameter *param;
-   EINA_LIST_FOREACH(fid->keys, itr, param)
-      if (!strcmp(param->name, param_name)) return param;
-   EINA_LIST_FOREACH(fid->params, itr, param)
-      if (!strcmp(param->name, param_name)) return param;
-   return NULL;
-}
-
-EAPI const Eina_List *
-eolian_property_keys_list_get(const Eolian_Function *fid)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
-   return fid->keys;
-}
-
-EAPI const Eina_List *
-eolian_property_values_list_get(const Eolian_Function *fid)
-{
-   return eolian_parameters_list_get(fid);
-}
-
-EAPI const Eina_List *
-eolian_parameters_list_get(const Eolian_Function *fid)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
-   return fid->params;
-}
-
 void database_function_return_type_set(Eolian_Function *fid, Eolian_Function_Type ftype, Eolian_Type *ret_type)
 {
    switch (ftype)
@@ -224,17 +117,6 @@ void database_function_return_type_set(Eolian_Function *fid, Eolian_Function_Typ
      }
 }
 
-EAPI const Eolian_Type *
-eolian_function_return_type_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
-{
-   switch (ftype)
-     {
-      case EOLIAN_PROP_SET: return fid->set_ret_type;
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_ret_type;
-      default: return NULL;
-     }
-}
-
 void database_function_return_dflt_val_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *ret_dflt_value)
 {
    const char *key = NULL;
@@ -248,34 +130,6 @@ void database_function_return_dflt_val_set(Eolian_Function *fid, Eolian_Function
    database_function_data_set(fid, key, ret_dflt_value);
 }
 
-EAPI const char *
-eolian_function_return_dflt_value_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
-{
-   const char *key = NULL;
-   switch (ftype)
-     {
-      case EOLIAN_PROP_SET: key = PROP_SET_RETURN_DFLT_VAL; break;
-      case EOLIAN_PROP_GET: key = PROP_GET_RETURN_DFLT_VAL; break;
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: key = METHOD_RETURN_DFLT_VAL; break;
-      default: return NULL;
-     }
-   return eolian_function_data_get(fid, key);
-}
-
-EAPI const char *
-eolian_function_return_comment_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
-{
-   const char *key = NULL;
-   switch (ftype)
-     {
-      case EOLIAN_PROP_SET: key = EOLIAN_PROP_SET_RETURN_COMMENT; break;
-      case EOLIAN_PROP_GET: key = EOLIAN_PROP_GET_RETURN_COMMENT; break;
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: key = EOLIAN_METHOD_RETURN_COMMENT; break;
-      default: return NULL;
-     }
-   return eolian_function_data_get(fid, key);
-}
-
 void database_function_return_comment_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *ret_comment)
 {
    const char *key = NULL;
@@ -301,29 +155,9 @@ void database_function_return_flag_set_as_warn_unused(Eolian_Function *fid,
      }
 }
 
-EAPI Eina_Bool
-eolian_function_return_is_warn_unused(const Eolian_Function *fid,
-      Eolian_Function_Type ftype)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
-   switch (ftype)
-     {
-      case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_return_warn_unused;
-      case EOLIAN_PROP_SET: return fid->set_return_warn_unused;
-      default: return EINA_FALSE;
-     }
-}
-
 void
 database_function_object_set_as_const(Eolian_Function *fid, Eina_Bool is_const)
 {
    EINA_SAFETY_ON_NULL_RETURN(fid);
    fid->obj_is_const = is_const;
 }
-
-EAPI Eina_Bool
-eolian_function_object_is_const(const Eolian_Function *fid)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
-   return fid->obj_is_const;
-}
diff --git a/src/lib/eolian/database_function_api.c b/src/lib/eolian/database_function_api.c
new file mode 100644 (file)
index 0000000..64e5e57
--- /dev/null
@@ -0,0 +1,168 @@
+#include <Eina.h>
+#include "eolian_database.h"
+
+EAPI Eolian_Function_Scope
+eolian_function_scope_get(const Eolian_Function *fid)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_SCOPE_PUBLIC);
+   return fid->scope;
+}
+
+EAPI Eolian_Function_Type
+eolian_function_type_get(const Eolian_Function *fid)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_UNRESOLVED);
+   return fid->type;
+}
+
+EAPI const char *
+eolian_function_name_get(const Eolian_Function *fid)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
+   return fid->name;
+}
+
+EAPI const char *
+eolian_function_full_c_name_get(const Eolian_Function *foo_id, const char *prefix)
+{
+   const char  *funcn = eolian_function_name_get(foo_id);
+   const char  *last_p = strrchr(prefix, '_');
+   const char  *func_p = strchr(funcn, '_');
+   Eina_Strbuf *buf = eina_strbuf_new();
+   Eina_Stringshare *ret;
+   int   len;
+
+   if (!last_p) last_p = prefix;
+   else last_p++;
+   if (!func_p) len = strlen(funcn);
+   else len = func_p - funcn;
+
+   if ((int)strlen(last_p) != len || strncmp(last_p, funcn, len))
+     {
+        eina_strbuf_append(buf, prefix);
+        eina_strbuf_append_char(buf, '_');
+        eina_strbuf_append(buf, funcn);
+        ret = eina_stringshare_add(eina_strbuf_string_get(buf));
+        eina_strbuf_free(buf);
+        return ret;
+     }
+
+   if (last_p != prefix)
+      eina_strbuf_append_n(buf, prefix, last_p - prefix); /* includes _ */
+
+   eina_strbuf_append(buf, funcn);
+   ret = eina_stringshare_add(eina_strbuf_string_get(buf));
+   eina_strbuf_free(buf);
+   return ret;
+}
+
+EAPI Eina_Bool
+eolian_function_is_virtual_pure(const Eolian_Function *fid, Eolian_Function_Type ftype)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
+   switch (ftype)
+     {
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_virtual_pure; break;
+      case EOLIAN_PROP_SET: return fid->set_virtual_pure; break;
+      default: return EINA_FALSE;
+     }
+}
+
+EAPI const char *
+eolian_function_data_get(const Eolian_Function *fid, const char *key)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
+   return eina_hash_find(fid->data, key);
+}
+
+EAPI const Eolian_Function_Parameter *
+eolian_function_parameter_get(const Eolian_Function *fid, const char *param_name)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
+   Eina_List *itr;
+   Eolian_Function_Parameter *param;
+   EINA_LIST_FOREACH(fid->keys, itr, param)
+      if (!strcmp(param->name, param_name)) return param;
+   EINA_LIST_FOREACH(fid->params, itr, param)
+      if (!strcmp(param->name, param_name)) return param;
+   return NULL;
+}
+
+EAPI const Eina_List *
+eolian_property_keys_list_get(const Eolian_Function *fid)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
+   return fid->keys;
+}
+
+EAPI const Eina_List *
+eolian_property_values_list_get(const Eolian_Function *fid)
+{
+   return eolian_parameters_list_get(fid);
+}
+
+EAPI const Eina_List *
+eolian_parameters_list_get(const Eolian_Function *fid)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
+   return fid->params;
+}
+
+EAPI const Eolian_Type *
+eolian_function_return_type_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
+{
+   switch (ftype)
+     {
+      case EOLIAN_PROP_SET: return fid->set_ret_type;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_ret_type;
+      default: return NULL;
+     }
+}
+
+EAPI const char *
+eolian_function_return_dflt_value_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
+{
+   const char *key = NULL;
+   switch (ftype)
+     {
+      case EOLIAN_PROP_SET: key = PROP_SET_RETURN_DFLT_VAL; break;
+      case EOLIAN_PROP_GET: key = PROP_GET_RETURN_DFLT_VAL; break;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: key = METHOD_RETURN_DFLT_VAL; break;
+      default: return NULL;
+     }
+   return eolian_function_data_get(fid, key);
+}
+
+EAPI const char *
+eolian_function_return_comment_get(const Eolian_Function *fid, Eolian_Function_Type ftype)
+{
+   const char *key = NULL;
+   switch (ftype)
+     {
+      case EOLIAN_PROP_SET: key = EOLIAN_PROP_SET_RETURN_COMMENT; break;
+      case EOLIAN_PROP_GET: key = EOLIAN_PROP_GET_RETURN_COMMENT; break;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: key = EOLIAN_METHOD_RETURN_COMMENT; break;
+      default: return NULL;
+     }
+   return eolian_function_data_get(fid, key);
+}
+
+EAPI Eina_Bool
+eolian_function_return_is_warn_unused(const Eolian_Function *fid,
+      Eolian_Function_Type ftype)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
+   switch (ftype)
+     {
+      case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_return_warn_unused;
+      case EOLIAN_PROP_SET: return fid->set_return_warn_unused;
+      default: return EINA_FALSE;
+     }
+}
+
+EAPI Eina_Bool
+eolian_function_object_is_const(const Eolian_Function *fid)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
+   return fid->obj_is_const;
+}
index 1d32cec..ab9863b 100644 (file)
@@ -22,32 +22,6 @@ database_parameter_del(Eolian_Function_Parameter *pdesc)
    free(pdesc);
 }
 
-EAPI const Eolian_Type *
-eolian_parameter_type_get(const Eolian_Function_Parameter *param)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(param, NULL);
-   return param->type;
-}
-
-EAPI Eina_Stringshare *
-eolian_parameter_name_get(const Eolian_Function_Parameter *param)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(param, NULL);
-   eina_stringshare_ref(param->name);
-   return param->name;
-}
-
-/* Get parameter information */
-EAPI void
-eolian_parameter_information_get(const Eolian_Function_Parameter *param, Eolian_Parameter_Dir *param_dir, const Eolian_Type **type, const char **name, const char **description)
-{
-   EINA_SAFETY_ON_NULL_RETURN(param);
-   if (param_dir) *param_dir = param->param_dir;
-   if (type) *type = param->type;
-   if (name) *name = param->name;
-   if (description) *description = param->description;
-}
-
 void
 database_parameter_const_attribute_set(Eolian_Function_Parameter *param, Eina_Bool is_get, Eina_Bool is_const)
 {
@@ -65,26 +39,9 @@ database_parameter_type_set(Eolian_Function_Parameter *param, Eolian_Type *types
    param->type = types;
 }
 
-EAPI Eina_Bool
-eolian_parameter_const_attribute_get(const Eolian_Function_Parameter *param, Eina_Bool is_get)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
-   if (is_get)
-      return param->is_const_on_get;
-   else
-      return param->is_const_on_set;
-}
-
 void
 database_parameter_nonull_set(Eolian_Function_Parameter *param, Eina_Bool nonull)
 {
    EINA_SAFETY_ON_NULL_RETURN(param);
    param->nonull = nonull;
 }
-
-EAPI Eina_Bool
-eolian_parameter_is_nonull(const Eolian_Function_Parameter *param)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
-   return param->nonull;
-}
diff --git a/src/lib/eolian/database_function_parameter_api.c b/src/lib/eolian/database_function_parameter_api.c
new file mode 100644 (file)
index 0000000..ed82a9a
--- /dev/null
@@ -0,0 +1,44 @@
+#include <Eina.h>
+#include "eolian_database.h"
+
+EAPI const Eolian_Type *
+eolian_parameter_type_get(const Eolian_Function_Parameter *param)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(param, NULL);
+   return param->type;
+}
+
+EAPI Eina_Stringshare *
+eolian_parameter_name_get(const Eolian_Function_Parameter *param)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(param, NULL);
+   eina_stringshare_ref(param->name);
+   return param->name;
+}
+
+EAPI void
+eolian_parameter_information_get(const Eolian_Function_Parameter *param, Eolian_Parameter_Dir *param_dir, const Eolian_Type **type, const char **name, const char **description)
+{
+   EINA_SAFETY_ON_NULL_RETURN(param);
+   if (param_dir) *param_dir = param->param_dir;
+   if (type) *type = param->type;
+   if (name) *name = param->name;
+   if (description) *description = param->description;
+}
+
+EAPI Eina_Bool
+eolian_parameter_const_attribute_get(const Eolian_Function_Parameter *param, Eina_Bool is_get)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
+   if (is_get)
+      return param->is_const_on_get;
+   else
+      return param->is_const_on_set;
+}
+
+EAPI Eina_Bool
+eolian_parameter_is_nonull(const Eolian_Function_Parameter *param)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
+   return param->nonull;
+}
index 5c3299b..be6b5f5 100644 (file)
@@ -9,37 +9,3 @@ database_implement_new(const char *impl_name)
    impl_desc->full_name = eina_stringshare_add(impl_name);
    return impl_desc;
 }
-
-EAPI Eina_Stringshare *
-eolian_implement_full_name_get(const Eolian_Implement *impl)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(impl, NULL);
-   return impl->full_name;
-}
-
-EAPI Eina_Bool
-eolian_implement_information_get(const Eolian_Implement *impl, const Eolian_Class **class_out, const Eolian_Function **func_out, Eolian_Function_Type *type_out)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
-   const Eolian_Class *class;
-   if (!database_class_name_validate(impl->full_name, &class) || !class) return EINA_FALSE;
-   const char *class_name = class->full_name;
-   if (class_out) *class_out = class;
-
-   char *func_name = strdup(impl->full_name + strlen(class_name) + 1);
-   char *colon = strchr(func_name, '.');
-   Eolian_Function_Type type = EOLIAN_UNRESOLVED;
-   if (colon)
-     {
-        *colon = '\0';
-        if (!strcmp(colon+1, "set")) type = EOLIAN_PROP_SET;
-        else if (!strcmp(colon+1, "get")) type = EOLIAN_PROP_GET;
-     }
-
-   const Eolian_Function *fid = eolian_class_function_find_by_name(class, func_name, type);
-   if (func_out) *func_out = fid;
-   if (type == EOLIAN_UNRESOLVED) type = eolian_function_type_get(fid);
-   if (type_out) *type_out = type;
-   free(func_name);
-   return EINA_TRUE;
-}
diff --git a/src/lib/eolian/database_implement_api.c b/src/lib/eolian/database_implement_api.c
new file mode 100644 (file)
index 0000000..56777af
--- /dev/null
@@ -0,0 +1,36 @@
+#include <Eina.h>
+#include "eolian_database.h"
+
+EAPI Eina_Stringshare *
+eolian_implement_full_name_get(const Eolian_Implement *impl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(impl, NULL);
+   return impl->full_name;
+}
+
+EAPI Eina_Bool
+eolian_implement_information_get(const Eolian_Implement *impl, const Eolian_Class **class_out, const Eolian_Function **func_out, Eolian_Function_Type *type_out)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
+   const Eolian_Class *class;
+   if (!database_class_name_validate(impl->full_name, &class) || !class) return EINA_FALSE;
+   const char *class_name = class->full_name;
+   if (class_out) *class_out = class;
+
+   char *func_name = strdup(impl->full_name + strlen(class_name) + 1);
+   char *colon = strchr(func_name, '.');
+   Eolian_Function_Type type = EOLIAN_UNRESOLVED;
+   if (colon)
+     {
+        *colon = '\0';
+        if (!strcmp(colon+1, "set")) type = EOLIAN_PROP_SET;
+        else if (!strcmp(colon+1, "get")) type = EOLIAN_PROP_GET;
+     }
+
+   const Eolian_Function *fid = eolian_class_function_find_by_name(class, func_name, type);
+   if (func_out) *func_out = fid;
+   if (type == EOLIAN_UNRESOLVED) type = eolian_function_type_get(fid);
+   if (type_out) *type_out = type;
+   free(func_name);
+   return EINA_TRUE;
+}
index 93a8ba2..c9d2c96 100644 (file)
@@ -33,129 +33,6 @@ Eina_Bool database_struct_add(Eolian_Type *tp)
    return EINA_FALSE;
 }
 
-EAPI const Eolian_Type *
-eolian_type_find_by_alias(const char *alias)
-{
-   if (!_types) return NULL;
-   Eina_Stringshare *shr = eina_stringshare_add(alias);
-   Type_Desc *cl = eina_hash_find(_types, shr);
-   eina_stringshare_del(shr);
-   return cl?cl->type:NULL;
-}
-
-EAPI const Eolian_Type *
-eolian_type_struct_find_by_name(const char *name)
-{
-   if (!_structs) return NULL;
-   Eina_Stringshare *shr = eina_stringshare_add(name);
-   Eolian_Type *tp = eina_hash_find(_structs, shr);
-   eina_stringshare_del(shr);
-   return tp;
-}
-
-EAPI Eolian_Type_Type
-eolian_type_type_get(const Eolian_Type *tp)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EOLIAN_TYPE_UNKNOWN_TYPE);
-   return tp->type;
-}
-
-EAPI Eina_Iterator *
-eolian_type_arguments_list_get(const Eolian_Type *tp)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(eolian_type_type_get(tp) == EOLIAN_TYPE_FUNCTION, NULL);
-   if (!tp->arguments) return NULL;
-   return eina_list_iterator_new(tp->arguments);
-}
-
-EAPI Eina_Iterator *
-eolian_type_subtypes_list_get(const Eolian_Type *tp)
-{
-   Eolian_Type_Type tpt;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   tpt = tp->type;
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpt == EOLIAN_TYPE_REGULAR
-                                || tpt == EOLIAN_TYPE_POINTER
-                                || tpt == EOLIAN_TYPE_REGULAR_STRUCT, NULL);
-   if (!tp->subtypes) return NULL;
-   return eina_list_iterator_new(tp->subtypes);
-}
-
-EAPI Eina_Iterator *
-eolian_type_struct_field_names_list_get(const Eolian_Type *tp)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
-   return eina_hash_iterator_key_new(tp->fields);
-}
-
-EAPI const Eolian_Type *
-eolian_type_struct_field_get(const Eolian_Type *tp, const char *field)
-{
-   _Struct_Field_Type *sf = NULL;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(field, NULL);
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
-   sf = eina_hash_find(tp->fields, field);
-   if (!sf) return NULL;
-   return sf->type;
-}
-
-EAPI const char *
-eolian_type_struct_field_description_get(const Eolian_Type *tp, const char *field)
-{
-   _Struct_Field_Type *sf = NULL;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(field, NULL);
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
-   sf = eina_hash_find(tp->fields, field);
-   if (!sf) return NULL;
-   return sf->comment;
-}
-
-EAPI const char *
-eolian_type_struct_description_get(const Eolian_Type *tp)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
-   return tp->comment;
-}
-
-EAPI const Eolian_Type *
-eolian_type_return_type_get(const Eolian_Type *tp)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(eolian_type_type_get(tp) == EOLIAN_TYPE_FUNCTION, NULL);
-   return tp->ret_type;
-}
-
-EAPI const Eolian_Type *
-eolian_type_base_type_get(const Eolian_Type *tp)
-{
-   Eolian_Type_Type tpt;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   tpt = eolian_type_type_get(tp);
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpt == EOLIAN_TYPE_POINTER, NULL);
-   return tp->base_type;
-}
-
-EAPI Eina_Bool
-eolian_type_is_own(const Eolian_Type *tp)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
-   return tp->is_own;
-}
-
-EAPI Eina_Bool
-eolian_type_is_const(const Eolian_Type *tp)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
-   return tp->is_const;
-}
-
-static void _type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name);
-
 static void
 _ftype_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
 {
@@ -163,7 +40,7 @@ _ftype_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
    Eolian_Type *stp;
    Eina_Bool first = EINA_TRUE;
    if (tp->ret_type)
-     _type_to_str(tp->ret_type, buf, NULL);
+     database_type_to_str(tp->ret_type, buf, NULL);
    else
      eina_strbuf_append(buf, "void");
    eina_strbuf_append(buf, " (*");
@@ -173,7 +50,7 @@ _ftype_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
      {
         if (!first) eina_strbuf_append(buf, ", ");
         first = EINA_FALSE;
-        _type_to_str(stp, buf, NULL);
+        database_type_to_str(stp, buf, NULL);
      }
 }
 
@@ -181,8 +58,8 @@ static Eina_Bool
 _stype_field_cb(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data,
                 void *fdata)
 {
-   _type_to_str((Eolian_Type*)((_Struct_Field_Type*)data)->type,
-                (Eina_Strbuf*)fdata, (const char*)key);
+   database_type_to_str((Eolian_Type*)((_Struct_Field_Type*)data)->type,
+                        (Eina_Strbuf*)fdata, (const char*)key);
    eina_strbuf_append((Eina_Strbuf*)fdata, "; ");
    return EINA_TRUE;
 }
@@ -206,8 +83,8 @@ _stype_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
      }
 }
 
-static void
-_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
+void
+database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
 {
    if (tp->type == EOLIAN_TYPE_FUNCTION)
      {
@@ -238,7 +115,7 @@ _type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
    else
      {
         Eolian_Type *btp = tp->base_type;
-        _type_to_str(tp->base_type, buf, NULL);
+        database_type_to_str(tp->base_type, buf, NULL);
         if (btp->type != EOLIAN_TYPE_POINTER || btp->is_const)
            eina_strbuf_append_char(buf, ' ');
         eina_strbuf_append_char(buf, '*');
@@ -251,33 +128,6 @@ _type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
      }
 }
 
-EAPI Eina_Stringshare *
-eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name)
-{
-   Eina_Stringshare *ret;
-   Eina_Strbuf *buf;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   buf = eina_strbuf_new();
-   _type_to_str(tp, buf, name);
-   ret = eina_stringshare_add(eina_strbuf_string_get(buf));
-   eina_strbuf_free(buf);
-   return ret;
-}
-
-EAPI Eina_Stringshare *
-eolian_type_c_type_get(const Eolian_Type *tp)
-{
-   return eolian_type_c_type_named_get(tp, NULL);
-}
-
-EAPI Eina_Stringshare *
-eolian_type_name_get(const Eolian_Type *tp)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   eina_stringshare_ref(tp->name);
-   return tp->name;
-}
-
 static Eina_Bool
 _print_field(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data,
              void *fdata EINA_UNUSED)
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
new file mode 100644 (file)
index 0000000..b6bc663
--- /dev/null
@@ -0,0 +1,151 @@
+#include <Eina.h>
+#include "eolian_database.h"
+#include "eo_definitions.h"
+
+EAPI const Eolian_Type *
+eolian_type_find_by_alias(const char *alias)
+{
+   if (!_types) return NULL;
+   Eina_Stringshare *shr = eina_stringshare_add(alias);
+   Type_Desc *cl = eina_hash_find(_types, shr);
+   eina_stringshare_del(shr);
+   return cl?cl->type:NULL;
+}
+
+EAPI const Eolian_Type *
+eolian_type_struct_find_by_name(const char *name)
+{
+   if (!_structs) return NULL;
+   Eina_Stringshare *shr = eina_stringshare_add(name);
+   Eolian_Type *tp = eina_hash_find(_structs, shr);
+   eina_stringshare_del(shr);
+   return tp;
+}
+
+EAPI Eolian_Type_Type
+eolian_type_type_get(const Eolian_Type *tp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EOLIAN_TYPE_UNKNOWN_TYPE);
+   return tp->type;
+}
+
+EAPI Eina_Iterator *
+eolian_type_arguments_list_get(const Eolian_Type *tp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(eolian_type_type_get(tp) == EOLIAN_TYPE_FUNCTION, NULL);
+   if (!tp->arguments) return NULL;
+   return eina_list_iterator_new(tp->arguments);
+}
+
+EAPI Eina_Iterator *
+eolian_type_subtypes_list_get(const Eolian_Type *tp)
+{
+   Eolian_Type_Type tpt;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   tpt = tp->type;
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpt == EOLIAN_TYPE_REGULAR
+                                || tpt == EOLIAN_TYPE_POINTER
+                                || tpt == EOLIAN_TYPE_REGULAR_STRUCT, NULL);
+   if (!tp->subtypes) return NULL;
+   return eina_list_iterator_new(tp->subtypes);
+}
+
+EAPI Eina_Iterator *
+eolian_type_struct_field_names_list_get(const Eolian_Type *tp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
+   return eina_hash_iterator_key_new(tp->fields);
+}
+
+EAPI const Eolian_Type *
+eolian_type_struct_field_get(const Eolian_Type *tp, const char *field)
+{
+   _Struct_Field_Type *sf = NULL;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(field, NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
+   sf = eina_hash_find(tp->fields, field);
+   if (!sf) return NULL;
+   return sf->type;
+}
+
+EAPI const char *
+eolian_type_struct_field_description_get(const Eolian_Type *tp, const char *field)
+{
+   _Struct_Field_Type *sf = NULL;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(field, NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
+   sf = eina_hash_find(tp->fields, field);
+   if (!sf) return NULL;
+   return sf->comment;
+}
+
+EAPI const char *
+eolian_type_struct_description_get(const Eolian_Type *tp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tp->type == EOLIAN_TYPE_STRUCT, NULL);
+   return tp->comment;
+}
+
+EAPI const Eolian_Type *
+eolian_type_return_type_get(const Eolian_Type *tp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(eolian_type_type_get(tp) == EOLIAN_TYPE_FUNCTION, NULL);
+   return tp->ret_type;
+}
+
+EAPI const Eolian_Type *
+eolian_type_base_type_get(const Eolian_Type *tp)
+{
+   Eolian_Type_Type tpt;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   tpt = eolian_type_type_get(tp);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpt == EOLIAN_TYPE_POINTER, NULL);
+   return tp->base_type;
+}
+
+EAPI Eina_Bool
+eolian_type_is_own(const Eolian_Type *tp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
+   return tp->is_own;
+}
+
+EAPI Eina_Bool
+eolian_type_is_const(const Eolian_Type *tp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
+   return tp->is_const;
+}
+
+EAPI Eina_Stringshare *
+eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name)
+{
+   Eina_Stringshare *ret;
+   Eina_Strbuf *buf;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   buf = eina_strbuf_new();
+   database_type_to_str(tp, buf, name);
+   ret = eina_stringshare_add(eina_strbuf_string_get(buf));
+   eina_strbuf_free(buf);
+   return ret;
+}
+
+EAPI Eina_Stringshare *
+eolian_type_c_type_get(const Eolian_Type *tp)
+{
+   return eolian_type_c_type_named_get(tp, NULL);
+}
+
+EAPI Eina_Stringshare *
+eolian_type_name_get(const Eolian_Type *tp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   eina_stringshare_ref(tp->name);
+   return tp->name;
+}
index 330e33c..1ee8f3b 100644 (file)
@@ -264,4 +264,7 @@ database_class_event_add(Eolian_Class *class, Eolian_Event *event_desc);
 void
 database_type_print(Eolian_Type *type);
 
+void
+database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name);
+
 #endif