src/cx/iterator.h

changeset 551
2946e13c89a4
parent 516
7bcea73303ce
child 628
1e2be40f0cb5
equal deleted inserted replaced
550:89b2a83728b1 551:2946e13c89a4
44 */ 44 */
45 struct cx_iterator_s { 45 struct cx_iterator_s {
46 /** 46 /**
47 * True iff the iterator points to valid data. 47 * True iff the iterator points to valid data.
48 */ 48 */
49 bool (*valid)(struct cx_iterator_s const *) __attribute__ ((__nonnull__)); 49 __attribute__ ((__nonnull__))
50 bool (*valid)(struct cx_iterator_s const *);
50 51
51 /** 52 /**
52 * Returns a pointer to the current element. 53 * Returns a pointer to the current element.
53 */ 54 */
54 void *(*current)(struct cx_iterator_s const *) __attribute__ ((__nonnull__)); 55 __attribute__ ((__nonnull__))
56 void *(*current)(struct cx_iterator_s const *);
55 57
56 /** 58 /**
57 * Advances the iterator. 59 * Advances the iterator.
58 */ 60 */
59 void (*next)(struct cx_iterator_s *) __attribute__ ((__nonnull__)); 61 __attribute__ ((__nonnull__))
62 void (*next)(struct cx_iterator_s *);
60 63
61 /** 64 /**
62 * Handle for the current element, if required. 65 * Handle for the current element, if required.
63 */ 66 */
64 void *elem_handle; 67 void *elem_handle;
65 68
66 /** 69 /**
67 * Handle for the source collection, if any. 70 * Handle for the source collection, if any.
68 */ 71 */
69 void *src_handle; 72 void *src_handle;
73
74 /**
75 * Field for storing a key-value pair.
76 * May be used by iterators that iterate over k/v-collections.
77 */
78 struct {
79 /**
80 * A pointer to the key.
81 */
82 void *key;
83 /**
84 * A pointer to the value.
85 */
86 void *value;
87 } kv_data;
88
89 /**
90 * Field for storing a slot number.
91 * May be used by iterators that iterate over multi-bucket collections.
92 */
93 size_t slot;
70 94
71 /** 95 /**
72 * If the iterator is position-aware, contains the index of the element in the underlying collection. 96 * If the iterator is position-aware, contains the index of the element in the underlying collection.
73 * Otherwise, this field is usually uninitialized. 97 * Otherwise, this field is usually uninitialized.
74 */ 98 */

mercurial