q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7117aad879cf7c28e7c185944646f4053c874b47

commit 7117aad879cf7c28e7c185944646f4053c874b47
Author: Daniel Kolesa <[email protected]>
Date:   Mon Jul 21 14:27:23 2014 +0100

    eolian: new APIs: eolian_type_full_name_get, eolian_type_naespaces_list_get
---
 src/lib/eolian/Eolian.h            | 32 ++++++++++++++++++++++++++++----
 src/lib/eolian/database_type_api.c | 33 +++++++++++++++++++++++++++++++--
 src/lib/eolian/eolian_database.h   |  4 ++--
 3 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index c276257..b283f17 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -975,17 +975,41 @@ EAPI Eina_Stringshare *eolian_type_c_type_named_get(const 
Eolian_Type *tp, const
 EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp);
 
 /*
- * @brief Get the type name of the given type. You have to manually delete
- * the stringshare.
+ * @brief Get the name of the given type. You have to manually delete
+ * the stringshare. For EOLIAN_TYPE_REGULAR and EOLIAN_TYPE_REGULAR_STRUCT,
+ * this is for example "int". For EOLIAN_TYPE_STRUCT and EOLIAN_TYPE_ALIAS,
+ * this is the name of the alias or of the struct. Keep in mind that the name
+ * doesn't include namespaces for structs and aliases.
  *
  * @param[in] tp the type.
- * @return the name assuming @c tp is an EOLIAN_TYPE_REGULAR, NULL otherwise.
- * The name may include a "struct" keyword.
+ * @return the name.
  *
  * @ingroup Eolian
  */
 EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp);
 
+/*
+ * @brief Get the full (namespaced) name of a function. Only works on named
+ * types (not pointers, not functions, not void).
+ *
+ * @param[in] tp the type.
+ * @return the name.
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Stringshare *eolian_type_full_name_get(const Eolian_Type *tp);
+
+/*
+ * @brief Get an iterator to the list of namespaces of the given type. Only
+ * works on named types (not pointers, not functions, not void).
+ *
+ * @param[in] tp the type.
+ * @return the iterator.
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Iterator *eolian_type_namespaces_list_get(const Eolian_Type *tp);
+
 #endif
 
 #ifdef __cplusplus
diff --git a/src/lib/eolian/database_type_api.c 
b/src/lib/eolian/database_type_api.c
index 7078283..1e31b80 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -180,7 +180,36 @@ eolian_type_c_type_get(const Eolian_Type *tp)
 EAPI Eina_Stringshare *
 eolian_type_name_get(const Eolian_Type *tp)
 {
+   Eolian_Type_Type tpp;
    EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
-   eina_stringshare_ref(tp->name);
-   return tp->name;
+   tpp = eolian_type_type_get(tp);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpp != EOLIAN_TYPE_POINTER
+                                && tpp != EOLIAN_TYPE_FUNCTION
+                                && tpp != EOLIAN_TYPE_VOID, NULL);
+   return eina_stringshare_ref(tp->name);
+}
+
+EAPI Eina_Stringshare *
+eolian_type_full_name_get(const Eolian_Type *tp)
+{
+   Eolian_Type_Type tpp;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   tpp = eolian_type_type_get(tp);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpp != EOLIAN_TYPE_POINTER
+                                && tpp != EOLIAN_TYPE_FUNCTION
+                                && tpp != EOLIAN_TYPE_VOID, NULL);
+   return eina_stringshare_ref(tp->full_name);
+}
+
+EAPI Eina_Iterator *
+eolian_type_namespaces_list_get(const Eolian_Type *tp)
+{
+   Eolian_Type_Type tpp;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
+   tpp = eolian_type_type_get(tp);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpp != EOLIAN_TYPE_POINTER
+                                && tpp != EOLIAN_TYPE_FUNCTION
+                                && tpp != EOLIAN_TYPE_VOID, NULL);
+   if (!tp->namespaces) return NULL;
+   return eina_list_iterator_new(tp->namespaces);
 }
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 47c6263..76ea383 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -113,8 +113,8 @@ struct _Eolian_Type
       /* structs, aliases, regular types */
       struct {
          Eina_Stringshare *name;       /* all */
-         Eina_Stringshare *full_name;  /* structs, aliases */
-         Eina_List        *namespaces; /* structs, aliases */
+         Eina_Stringshare *full_name;  /* all */
+         Eina_List        *namespaces; /* all */
          Eina_Hash        *fields;     /* structs */
          Eina_Stringshare *comment;    /* structs, aliases */
          Eina_Stringshare *file;       /* structs, aliases */

-- 


Reply via email to