From 1373440eb043ebd121a6827aa28e4832cb959efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 1 Jun 2012 16:42:37 +0200 Subject: cleanup eiotas_particle_has_dst, add eiotas_particle_next_dst --- src/include/eiotas_particle.h | 9 +++++++++ src/lib/eiotas_particle.c | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/include/eiotas_particle.h b/src/include/eiotas_particle.h index 4461945..52c8011 100644 --- a/src/include/eiotas_particle.h +++ b/src/include/eiotas_particle.h @@ -107,6 +107,15 @@ EAPI void eiotas_particle_merge(Eiotas_Particle *particle, const Eiotas_Particle EAPI Eina_Bool eiotas_particle_has_dst(Eiotas_Particle *particle); /** + * @brief Point to the next destination + * + * @param particle The @ref Eiotas_Particle to mofify + * + * @return EINA_TRUE if next destination is defined, EINA_FALSE otherwise. + */ +EAPI Eina_Bool eiotas_particle_next_dst(Eiotas_Particle *particle); + +/** * @brief Add destinations to the @ref Eiotas_Particle * * @param particle The @ref Eiotas_Particle to add destinations to diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c index 6d3facc..6148845 100644 --- a/src/lib/eiotas_particle.c +++ b/src/lib/eiotas_particle.c @@ -95,8 +95,13 @@ EAPI void eiotas_particle_merge(Eiotas_Particle *particle, const Eiotas_Particle EAPI Eina_Bool eiotas_particle_has_dst(Eiotas_Particle *particle) { - if(eina_array_count_get(particle->dsts)<=particle->cur_dst) return EINA_FALSE; - return ( (eina_array_data_get(particle->dsts,particle->cur_dst)==NULL) ? EINA_FALSE : EINA_TRUE ); + return ( (eina_array_count_get(particle->dsts)>particle->cur_dst) ? EINA_TRUE : EINA_FALSE ); +} + +EAPI Eina_Bool eiotas_particle_next_dst(Eiotas_Particle *particle) +{ + particle->cur_dst+=1; + return ( (eina_array_count_get(particle->dsts)>particle->cur_dst) ? EINA_TRUE : EINA_FALSE ); } EAPI void eiotas_particle_destinations_add(Eiotas_Particle *particle, const char* destinations) -- cgit v1.1-2-g2b99