diff options
-rw-r--r-- | src/include/eiotas_particle.h | 10 | ||||
-rw-r--r-- | src/lib/eiotas_particle.c | 7 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/include/eiotas_particle.h b/src/include/eiotas_particle.h index 34b59ed..2815b71 100644 --- a/src/include/eiotas_particle.h +++ b/src/include/eiotas_particle.h @@ -116,6 +116,16 @@ EAPI void eiotas_particle_destinations_add(Eiotas_Particle *particle, const char EAPI void eiotas_particle_link_fields_set(Eiotas_Particle *particle, const char *link_fields); /** + * @brief Restore the data associated to a given key + * + * @param particle The @ref Eiotas_Particle to restore data from + * @param key The @ref Eina_Hash key + * + * @return The data stored on success, NULL otherwise. + */ +EAPI const char* eiotas_particle_data_get(Eiotas_Particle *particle, const char *key); + +/** * @} */ diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c index a2252bd..5a37ae0 100644 --- a/src/lib/eiotas_particle.c +++ b/src/lib/eiotas_particle.c @@ -29,7 +29,7 @@ Eiotas_Particle* eiotas_particle_alloc() particle->src = NULL; particle->dst = NULL; particle->dsts = eina_array_new(EIOTAS_PARTICLE_ARRAY_STEP); - particle->payload = eina_hash_string_small_new(NULL); // TODO data delete function + particle->payload = eina_hash_string_small_new((Eina_Free_Cb)&eina_stringshare_del); particle->merged = NULL; particle->link_fields = eina_array_new(EIOTAS_PARTICLE_ARRAY_STEP); particle->link_value = NULL; @@ -147,6 +147,11 @@ EAPI void eiotas_particle_link_fields_set(Eiotas_Particle *particle, const char update_link_value(particle,NULL); } +EAPI const char* eiotas_particle_data_get(Eiotas_Particle *particle, const char* key) +{ + return eina_hash_find(particle->payload,key); +} + static void update_link_value(Eiotas_Particle *particle, const char *field) { unsigned int i; |