q66 pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f5e3734cdd4deed9caab78581d6570d49af81777
commit f5e3734cdd4deed9caab78581d6570d49af81777 Author: Daniel Kolesa <[email protected]> Date: Tue Feb 27 13:07:31 2018 +0100 eolian: new APIs for directory scanning --- src/lib/eolian/Eolian.h | 70 +++++++++++++++++++++++----------------- src/lib/eolian/eolian_database.c | 16 +++++++-- 2 files changed, 54 insertions(+), 32 deletions(-) diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 46c864cb95..ef6cfcab28 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -497,6 +497,40 @@ EAPI Eolian_State *eolian_state_new(void); EAPI void eolian_state_free(Eolian_State *state); /* + * @brief Scan the given directory for .eo and .eot files. + * + * You need to add every directory you plan to use .eo/.eot files from. + * The directory is scanned recursively, so all of its sub-directories + * are also added. + * + * @param[in] state The Eolian state. + * @param[in] dir the directory to scan + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * @see eolian_state_system_directory_add + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_state_directory_add(Eolian_State *state, const char *dir); + +/* + * @brief Scan the system directory for .eo and .eot files. + * + * This is just like eolian_state_directory_add, except it uses the system + * directory. The system directory is determined from the prefix of the + * Eolian library. Typically it tends to be $PREFIX/share/eolian. + * + * @param[in] state The Eolian state. + * + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * @see eolian_state_directory_add + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_state_system_directory_add(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. @@ -565,36 +599,6 @@ EAPI Eina_Iterator *eolian_all_eo_files_get(const Eolian_State *state); EAPI Eina_Iterator *eolian_all_eot_files_get(const Eolian_State *state); /* - * @brief Scan the given directory (recursively) and search for .eo and - * .eot files. - * - * The found files are just open to extract the class name. - * - * @param[in] state The Eolian state. - * @param[in] dir the directory to scan - * @return EINA_TRUE on success, EINA_FALSE otherwise. - * - * @see eolian_system_directory_scan - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_directory_scan(Eolian_State *state, const char *dir); - -/* - * @brief Scan the system directory (recursively) and search for .eo and - * .eot files. - * - * @param[in] state The Eolian state. - * - * @return EINA_TRUE on success, EINA_FALSE otherwise. - * - * @see eolian_directory_scan - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_system_directory_scan(Eolian_State *state); - -/* * @brief Force parsing of all the .eo files located in the directories * given in eolian_directory_scan.. * @@ -2606,6 +2610,12 @@ EAPI char *eolian_doc_token_text_get(const Eolian_Doc_Token *tok); */ EAPI Eolian_Doc_Ref_Type eolian_doc_token_ref_get(const Eolian_Unit *unit, const Eolian_Doc_Token *tok, const void **data, const void **data2); +/* DEPRECATED */ +EAPI Eina_Bool eolian_directory_scan(Eolian_State *state, const char *dir); + +/* DEPRECATED */ +EAPI Eina_Bool eolian_system_directory_scan(Eolian_State *state); + #endif /** diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index 70a6dc3818..eb5105222a 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -629,7 +629,7 @@ _scan_cb(const char *name, const char *path, void *data EINA_UNUSED) } EAPI Eina_Bool -eolian_directory_scan(Eolian_State *state, const char *dir) +eolian_state_directory_add(Eolian_State *state, const char *dir) { if (!dir || !state) return EINA_FALSE; eina_file_dir_list(dir, EINA_TRUE, _scan_cb, state); @@ -637,7 +637,7 @@ eolian_directory_scan(Eolian_State *state, const char *dir) } EAPI Eina_Bool -eolian_system_directory_scan(Eolian_State *state) +eolian_state_system_directory_add(Eolian_State *state) { Eina_Bool ret; Eina_Strbuf *buf = eina_strbuf_new(); @@ -648,6 +648,18 @@ eolian_system_directory_scan(Eolian_State *state) return ret; } +EAPI Eina_Bool +eolian_directory_scan(Eolian_State *state, const char *dir) +{ + return eolian_state_directory_add(state, dir); +} + +EAPI Eina_Bool +eolian_system_directory_scan(Eolian_State *state) +{ + return eolian_state_system_directory_add(state); +} + char * database_class_to_filename(const char *cname) { --
