summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-06-01 16:42:37 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-06-01 16:42:37 +0200
commit1373440eb043ebd121a6827aa28e4832cb959efe (patch)
tree20538d24b1613082334e928b08efc5bf491293ab /src
parentad62dda338917350cb678db86a8436a34d045ac9 (diff)
downloadedoors-1373440eb043ebd121a6827aa28e4832cb959efe.zip
edoors-1373440eb043ebd121a6827aa28e4832cb959efe.tar.gz
cleanup eiotas_particle_has_dst, add eiotas_particle_next_dst
Diffstat (limited to 'src')
-rw-r--r--src/include/eiotas_particle.h9
-rw-r--r--src/lib/eiotas_particle.c9
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)