q66 pushed a commit to branch master.

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

commit e91ae3984a9b90ff95ed22fc303109fb61540c55
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Tue Feb 27 13:24:05 2018 +0100

    eolian: add APIs to retrieve units from a state
---
 src/lib/eolian/Eolian.h          | 29 +++++++++++++++++++++++++++++
 src/lib/eolian/eolian_database.c | 17 +++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index ef6cfcab28..94eb9a0b49 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -531,6 +531,35 @@ EAPI Eina_Bool eolian_state_directory_add(Eolian_State 
*state, const char *dir);
 EAPI Eina_Bool eolian_state_system_directory_add(Eolian_State *state);
 
 /*
+ * @brief Get an Eolian unit by file name.
+ *
+ * For any .eo or .eot file (must be within a directory previously scanned
+ * by eolian_state_directory_add or eolian_state_system_directory_add), get
+ * its corresponding unit.
+ *
+ * This only works if the file has been previously parsed.
+ *
+ * @param[in] state The Eolian state.
+ * @param[in] file The file name.
+ *
+ * @see eolian_state_units_get
+ *
+ * @ingroup Eolian
+ */
+EAPI const Eolian_Unit *eolian_state_unit_by_file_get(const Eolian_State 
*state, const char *file_name);
+
+/*
+ * @brief Get an iterator to all Eolian units in a state.
+ *
+ * This means units of all files that have been parsed so far.
+ *
+ * @param[in] state The Eolian state.
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Iterator *eolian_state_units_get(const Eolian_State *state);
+
+/*
  * @brief Parse the given .eo or .eot file and fill the database.
  *
  * The input can be either a full path to the file or only a filename.
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index eb5105222a..3749e511a8 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -660,6 +660,23 @@ eolian_system_directory_scan(Eolian_State *state)
    return eolian_state_system_directory_add(state);
 }
 
+EAPI const Eolian_Unit *
+eolian_state_unit_by_file_get(const Eolian_State *state, const char *file_name)
+{
+   if (!state) return NULL;
+   Eina_Stringshare *shr = eina_stringshare_add(file_name);
+   Eolian_Unit *unit = eina_hash_find(state->units, shr);
+   eina_stringshare_del(shr);
+   return unit;
+}
+
+EAPI Eina_Iterator *
+eolian_state_units_get(const Eolian_State *state)
+{
+   if (!state) return NULL;
+   return eina_hash_iterator_data_new(state->units);
+}
+
 char *
 database_class_to_filename(const char *cname)
 {

-- 


Reply via email to