aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-01 11:42:30 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-01 12:16:28 +0100
commitd6382f3f2bf74850c404ec92553e444bd8726248 (patch)
tree14614b1c43b2f8ec604a190d960d6b1d0a375088
parentRevert "theme: rename "default" theme to "dark"" (diff)
downloadefl-d6382f3f2bf74850c404ec92553e444bd8726248.tar.gz
eolian: new APIs for class retrieval
-rw-r--r--src/lib/eolian/Eolian.h65
-rw-r--r--src/lib/eolian/database_class_api.c26
-rw-r--r--src/lib/eolian/eolian_database.c57
3 files changed, 102 insertions, 46 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index a47115f148..b7f5b6bc66 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -659,6 +659,35 @@ EAPI const Eolian_Unit *eolian_state_unit_by_file_get(const Eolian_State *state,
EAPI Eina_Iterator *eolian_state_units_get(const Eolian_State *state);
/*
+ * @brief Get a class within a state by name.
+ *
+ * @param[in] state The state.
+ * @param[in] class_name The full name of the class.
+ *
+ * @ingroup Eolian
+ */
+EAPI const Eolian_Class *eolian_state_class_by_name_get(const Eolian_State *state, const char *class_name);
+
+/*
+ * @brief Get a class within a state by file name (class_name.eo).
+ *
+ * @param[in] state The state.
+ * @param[in] file_name The full name of the class.
+ *
+ * @ingroup Eolian
+ */
+EAPI const Eolian_Class *eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name);
+
+/*
+ * @brief Get an iterator to all the classes stored into a state.
+ *
+ * @param[in] state The Eolian state.
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Iterator *eolian_state_classes_get(const Eolian_State *state);
+
+/*
* @brief Get the children (dependencies) of a unit.
*
* The iterator is obviously again to `const Eolian_Unit *`.
@@ -682,26 +711,23 @@ EAPI Eina_Iterator *eolian_unit_children_get(const Eolian_Unit *unit);
EAPI const char *eolian_unit_file_get(const Eolian_Unit *unit);
/*
- * @brief Gets a class by its name
+ * @brief Get a class within a unit by name.
*
- * @param[in] unit the unit to look in
- * @param[in] class_name name of the class to get.
- * @return the class
+ * @param[in] unit The unit.
+ * @param[in] class_name The full name of the class.
*
* @ingroup Eolian
*/
-EAPI const Eolian_Class *eolian_class_get_by_name(const Eolian_Unit *unit, const char *class_name);
+EAPI const Eolian_Class *eolian_unit_class_by_name_get(const Eolian_Unit *unit, const char *class_name);
/*
- * @brief Gets a class by its filename (name.eo)
+ * @brief Get an iterator to all the classes stored into a unit.
*
- * @param[in] unit the unit to look in
- * @param[in] file_name the filename
- * @return the class stored in the file
+ * @param[in] unit The Eolian unit.
*
* @ingroup Eolian
*/
-EAPI const Eolian_Class *eolian_class_get_by_file(const Eolian_Unit *unit, const char *file_name);
+EAPI Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit);
/*
* @brief Returns the name of the file containing the given class.
@@ -757,16 +783,6 @@ EAPI Eina_Iterator *eolian_class_namespaces_get(const Eolian_Class *klass);
EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
/*
- * @brief Returns an iterator to all the classes stored into the database.
- *
- * @param[in] unit the unit to look in
- * @return the iterator
- *
- * @ingroup Eolian
- */
-EAPI Eina_Iterator *eolian_all_classes_get(const Eolian_Unit *unit);
-
-/*
* @brief Returns the documentation of a class.
*
* @param[in] klass the class
@@ -2690,6 +2706,15 @@ EAPI Eina_Iterator *eolian_all_eo_files_get(const Eolian_State *state);
/* DEPRECATED */
EAPI Eina_Iterator *eolian_all_eot_files_get(const Eolian_State *state);
+/* DEPRECATED */
+EAPI const Eolian_Class *eolian_class_get_by_name(const Eolian_Unit *unit, const char *class_name);
+
+/* DEPRECATED */
+EAPI const Eolian_Class *eolian_class_get_by_file(const Eolian_Unit *unit, const char *file_name);
+
+/* DEPRECATED */
+EAPI Eina_Iterator *eolian_all_classes_get(const Eolian_Unit *unit);
+
#endif
/**
diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c
index dbb6dee56e..2703d0e200 100644
--- a/src/lib/eolian/database_class_api.c
+++ b/src/lib/eolian/database_class_api.c
@@ -31,26 +31,6 @@ eolian_class_namespaces_get(const Eolian_Class *cl)
: NULL);
}
-EAPI const Eolian_Class *
-eolian_class_get_by_name(const Eolian_Unit *unit, const char *class_name)
-{
- if (!unit) return NULL;
- Eina_Stringshare *shr = eina_stringshare_add(class_name);
- Eolian_Class *cl = eina_hash_find(unit->classes, shr);
- eina_stringshare_del(shr);
- return cl;
-}
-
-EAPI const Eolian_Class *
-eolian_class_get_by_file(const Eolian_Unit *unit, const char *file_name)
-{
- if (!unit) return NULL;
- Eina_Stringshare *shr = eina_stringshare_add(file_name);
- Eolian_Class *cl = eina_hash_find(unit->state->classes_f, shr);
- eina_stringshare_del(shr);
- return cl;
-}
-
EAPI Eolian_Class_Type
eolian_class_type_get(const Eolian_Class *cl)
{
@@ -58,12 +38,6 @@ eolian_class_type_get(const Eolian_Class *cl)
return cl->type;
}
-EAPI Eina_Iterator *
-eolian_all_classes_get(const Eolian_Unit *unit)
-{
- return (unit ? eina_hash_iterator_data_new(unit->classes) : NULL);
-}
-
EAPI const Eolian_Documentation *
eolian_class_documentation_get(const Eolian_Class *cl)
{
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 6491f64cab..ada3062f3e 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -934,6 +934,28 @@ eolian_state_units_get(const Eolian_State *state)
return eina_hash_iterator_data_new(state->units);
}
+EAPI const Eolian_Class *
+eolian_state_class_by_name_get(const Eolian_State *state, const char *class_name)
+{
+ return eolian_unit_class_by_name_get((Eolian_Unit *)state, class_name);
+}
+
+EAPI const Eolian_Class *
+eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name)
+{
+ if (!state) return NULL;
+ Eina_Stringshare *shr = eina_stringshare_add(file_name);
+ Eolian_Class *cl = eina_hash_find(state->classes_f, shr);
+ eina_stringshare_del(shr);
+ return cl;
+}
+
+EAPI Eina_Iterator *
+eolian_state_classes_get(const Eolian_State *state)
+{
+ return eolian_unit_classes_get((Eolian_Unit *)state);
+}
+
EAPI Eina_Iterator *
eolian_unit_children_get(const Eolian_Unit *unit)
{
@@ -948,6 +970,41 @@ eolian_unit_file_get(const Eolian_Unit *unit)
return unit->file;
}
+EAPI const Eolian_Class *
+eolian_unit_class_by_name_get(const Eolian_Unit *unit, const char *class_name)
+{
+ if (!unit) return NULL;
+ Eina_Stringshare *shr = eina_stringshare_add(class_name);
+ Eolian_Class *cl = eina_hash_find(unit->classes, shr);
+ eina_stringshare_del(shr);
+ return cl;
+}
+
+EAPI Eina_Iterator *
+eolian_unit_classes_get(const Eolian_Unit *unit)
+{
+ return (unit ? eina_hash_iterator_data_new(unit->classes) : NULL);
+}
+
+EAPI const Eolian_Class *
+eolian_class_get_by_name(const Eolian_Unit *unit, const char *class_name)
+{
+ return eolian_unit_class_by_name_get(unit, class_name);
+}
+
+EAPI const Eolian_Class *
+eolian_class_get_by_file(const Eolian_Unit *unit, const char *file_name)
+{
+ if (!unit) return NULL;
+ return eolian_state_class_by_file_get(unit->state, file_name);
+}
+
+EAPI Eina_Iterator *
+eolian_all_classes_get(const Eolian_Unit *unit)
+{
+ return eolian_unit_classes_get(unit);
+}
+
char *
database_class_to_filename(const char *cname)
{