edje: add edje_file_iterator_new().
This list the actually opened Edje file by the current process.
This commit is contained in:
parent
bfbb2d8a51
commit
b72df468f2
|
@ -1772,6 +1772,13 @@ EAPI void edje_mmap_collection_list_free(Eina_List *lst);
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool edje_mmap_group_exists(Eina_File *f, const char *glob);
|
EAPI Eina_Bool edje_mmap_group_exists(Eina_File *f, const char *glob);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Iterate over all the opened Edje file.
|
||||||
|
*
|
||||||
|
* @return an iterator of Eina_File currently opened Edje file.
|
||||||
|
*/
|
||||||
|
EAPI Eina_Iterator *edje_file_iterator_new(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of groups in an edje file
|
* Get a list of groups in an edje file
|
||||||
* @param file The path to the edje file
|
* @param file The path to the edje file
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "edje_private.h"
|
#include "edje_private.h"
|
||||||
|
|
||||||
static Eina_Hash *_edje_file_hash = NULL;
|
Eina_Hash *_edje_file_hash = NULL;
|
||||||
|
|
||||||
static int _edje_file_cache_size = 16;
|
static int _edje_file_cache_size = 16;
|
||||||
static Eina_List *_edje_file_cache = NULL;
|
static Eina_List *_edje_file_cache = NULL;
|
||||||
|
|
||||||
|
|
|
@ -234,6 +234,62 @@ edje_mmap_group_exists(Eina_File *f, const char *glob)
|
||||||
return succeed;
|
return succeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct _Edje_File_Iterator Edje_File_Iterator;
|
||||||
|
struct _Edje_File_Iterator
|
||||||
|
{
|
||||||
|
Eina_Iterator iterator;
|
||||||
|
|
||||||
|
Eina_Iterator *it;
|
||||||
|
};
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_edje_file_iterator_next(Eina_Iterator *it, void **data)
|
||||||
|
{
|
||||||
|
Edje_File_Iterator *et = (void*) it;
|
||||||
|
Edje_File *edf = NULL;
|
||||||
|
|
||||||
|
if (!eina_iterator_next(et->it, (void**) &edf))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
*data = edf->f;
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_edje_file_iterator_container(Eina_Iterator *it EINA_UNUSED)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_file_iterator_free(Eina_Iterator *it)
|
||||||
|
{
|
||||||
|
Edje_File_Iterator *et = (void*) it;
|
||||||
|
|
||||||
|
EINA_MAGIC_SET(&et->iterator, 0);
|
||||||
|
eina_iterator_free(et->it);
|
||||||
|
free(et);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Iterator *
|
||||||
|
edje_file_iterator_new(void)
|
||||||
|
{
|
||||||
|
Edje_File_Iterator *it;
|
||||||
|
|
||||||
|
it = calloc(1, sizeof (Edje_File_Iterator));
|
||||||
|
if (!it) return NULL;
|
||||||
|
|
||||||
|
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
|
||||||
|
it->it = eina_hash_iterator_data_new(_edje_file_hash);
|
||||||
|
|
||||||
|
it->iterator.version = EINA_ITERATOR_VERSION;
|
||||||
|
it->iterator.next = _edje_file_iterator_next;
|
||||||
|
it->iterator.get_container = _edje_file_iterator_container;
|
||||||
|
it->iterator.free = _edje_file_iterator_free;
|
||||||
|
|
||||||
|
return &it->iterator;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
edje_file_group_exists(const char *file, const char *glob)
|
edje_file_group_exists(const char *file, const char *glob)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2129,6 +2129,8 @@ extern Eina_Mempool *_edje_real_part_state_mp;
|
||||||
extern Eina_Cow *_edje_calc_params_map_cow;
|
extern Eina_Cow *_edje_calc_params_map_cow;
|
||||||
extern Eina_Cow *_edje_calc_params_physics_cow;
|
extern Eina_Cow *_edje_calc_params_physics_cow;
|
||||||
|
|
||||||
|
extern Eina_Hash *_edje_file_hash;
|
||||||
|
|
||||||
EAPI extern Eina_Mempool *_emp_RECTANGLE;
|
EAPI extern Eina_Mempool *_emp_RECTANGLE;
|
||||||
EAPI extern Eina_Mempool *_emp_TEXT;
|
EAPI extern Eina_Mempool *_emp_TEXT;
|
||||||
EAPI extern Eina_Mempool *_emp_IMAGE;
|
EAPI extern Eina_Mempool *_emp_IMAGE;
|
||||||
|
|
Loading…
Reference in New Issue