Functions | |
Evas_Hash * | evas_hash_add (Evas_Hash *hash, const char *key, const void *data) |
Adds an entry to the given hash table. | |
Evas_Hash * | evas_hash_direct_add (Evas_Hash *hash, const char *key, const void *data) |
Adds an entry to the given hash table and does not duplicate the string key. | |
Evas_Hash * | evas_hash_del (Evas_Hash *hash, const char *key, const void *data) |
Removes the entry identified by key or data from the given hash table. | |
void * | evas_hash_find (Evas_Hash *hash, const char *key) |
Retrieves a specific entry in the given hash table. | |
void * | evas_hash_modify (Evas_Hash *hash, const char *key, const void *data) |
Modifies the entry pointer at the specified key and returns the old entry. |
The following example shows how to add and then access data in a hash table:
Evas_Hash *hash = NULL; extern void *my_data; hash = evas_hash_add(hash, "My Data", my_data); if (evas_hash_alloc_error()) { fprintf(stderr, "ERROR: Memory is low. Hash allocation failed.\n"); exit(-1); } if (evas_hash_find(hash, "My Data") == my_data) { printf("My Data inserted and successfully found.\n"); }
What follows is another example, showing how the evas_hash_del function is used:
extern Evas_Hash *hash; extern void *data; printf("Insert some data...\n"); hash = evas_hash_add(hash, "My Data", my_data); printf("Removing by key...\n"); hash = evas_hash_del(hash, "My Data", NULL); printf("Insert some more data as a NULL key...\n"); hash = evas_hash_add(hash, NULL, my_data); printf("Removing by data as a NULL key...\n"); hash = evas_hash_del(hash, NULL, my_data);
|
Adds an entry to the given hash table.
Key strings are case sensitive. evas_hash_alloc_error should be used to determine if an allocation error occurred during this function.
|
|
Removes the entry identified by
If
|
|
Adds an entry to the given hash table and does not duplicate the string key.
Key strings are case sensitive. evas_hash_alloc_error should be used to determine if an allocation error occurred during this function.
|
|
Retrieves a specific entry in the given hash table.
|
|
Modifies the entry pointer at the specified key and returns the old entry.
|