[notmuch] [PATCH] Added regress option to tags iterator
Ruben Pollan
meskio at sindominio.net
Wed Jan 6 01:08:54 PST 2010
On 11:39, Tue 05 Jan 10, Carl Worth wrote:
> Right. So example code using this would be:
>
> for (notmuch_messages_to_first (messages);
> notmuch_messages_has_current (messages);
> notmuch_messages_to_next (messages))
> {
> notmuch_message_t *message;
>
> message = notmuch_messages_get_current (messages);
>
> ...
> }
>
> And for iterating in the opposite direction it's very similar:
>
> for (notmuch_messages_to_last (messages);
> notmuch_messages_has_current (messages);
> notmuch_messages_to_previous (messages))
> {
> notmuch_message_t *message;
>
> message = notmuch_messages_get_current (messages);
>
> ...
> }
>
> Note that if you couldn't get the iterator to point to an invalid item
> before the first, then this second loop would have to look very
> different.
Yes, make sense like that.
I'm not sure what to do about the iterator when is on an invalid item, if you
reach an invalid item doing to_next should be possible to do to_previous to
recover the last valid item? Or is better to force the user to use to_last to
go back?
In some cases implement to_previous will need to store the previous item
(actually I did that on the patches I sent).
--
Rubén Pollán | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ésta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
el odio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100106/19326bc2/attachment.pgp>
More information about the notmuch
mailing list