(struct _iterator): rewritten as a general-purpose iterator structure.
Showing
1 changed file
with
11 additions
and
7 deletions
... | @@ -30,17 +30,21 @@ extern "C" { | ... | @@ -30,17 +30,21 @@ extern "C" { |
30 | 30 | ||
31 | struct _iterator | 31 | struct _iterator |
32 | { | 32 | { |
33 | struct _iterator *next; /* Next iterator in the chain */ | 33 | struct _iterator *next_itr; /* Next iterator in the chain */ |
34 | list_t list; /* Owner list */ | 34 | void *owner; /* Object whose contents is being iterated */ |
35 | struct list_data *cur; /* Current list item */ | 35 | int is_advanced; /* Is the iterator already advanced */ |
36 | int is_advanced; /* Is the item already advanced */ | 36 | |
37 | int (*dup) (void **ptr, void *owner); | ||
38 | int (*destroy) (iterator_t itr, void *owner); | ||
39 | int (*first) (void *owner); | ||
40 | int (*next) (void *owner); | ||
41 | int (*getitem) (void *owner, void **pret); | ||
42 | int (*curitem_p) (void *owner, void *item); | ||
43 | int (*finished_p) (void *owner); | ||
37 | }; | 44 | }; |
38 | 45 | ||
39 | |||
40 | #ifdef __cplusplus | 46 | #ifdef __cplusplus |
41 | } | 47 | } |
42 | #endif | 48 | #endif |
43 | 49 | ||
44 | extern void iterator_advance(iterator_t iterator, struct list_data *e); | ||
45 | |||
46 | #endif /* _ITERATOR0_H */ | 50 | #endif /* _ITERATOR0_H */ | ... | ... |
-
Please register or sign in to post a comment