55 /** |
55 /** |
56 * Internal iterator struct - use CxIterator. |
56 * Internal iterator struct - use CxIterator. |
57 */ |
57 */ |
58 struct cx_iterator_s { |
58 struct cx_iterator_s { |
59 /** |
59 /** |
60 * If the iterator is position-aware, contains the index of the element in the underlying collection. |
|
61 * Otherwise, this field is usually uninitialized. |
|
62 */ |
|
63 size_t index; |
|
64 /** |
|
65 * Internal data. |
|
66 */ |
|
67 void *data; |
|
68 |
|
69 /** |
|
70 * True iff the iterator points to valid data. |
60 * True iff the iterator points to valid data. |
71 */ |
61 */ |
72 bool (*valid)(CxIterator const *) __attribute__ ((__nonnull__)); |
62 bool (*valid)(CxIterator const *) __attribute__ ((__nonnull__)); |
73 |
63 |
74 /** |
64 /** |
78 |
68 |
79 /** |
69 /** |
80 * Advances the iterator. |
70 * Advances the iterator. |
81 */ |
71 */ |
82 void (*next)(CxIterator *) __attribute__ ((__nonnull__)); |
72 void (*next)(CxIterator *) __attribute__ ((__nonnull__)); |
|
73 |
|
74 /** |
|
75 * Handle for the current element, if required. |
|
76 */ |
|
77 void *elem_handle; |
|
78 |
|
79 /** |
|
80 * Handle for the source collection, if any. |
|
81 */ |
|
82 void *src_handle; |
|
83 |
|
84 /** |
|
85 * If the iterator is position-aware, contains the index of the element in the underlying collection. |
|
86 * Otherwise, this field is usually uninitialized. |
|
87 */ |
|
88 size_t index; |
|
89 |
|
90 /** |
|
91 * Users may set this to true, if the current element shall be removed from the underlying collection |
|
92 * when the iterator advances. |
|
93 * Has no effect on iterators that are not based on a collection. |
|
94 */ |
|
95 bool remove; |
83 }; |
96 }; |
84 |
97 |
85 /** |
98 /** |
86 * Checks if the iterator points to valid data. |
99 * Checks if the iterator points to valid data. |
87 * |
100 * |