src/cx/iterator.h

changeset 890
54565fd74e74
parent 858
d9ad7904c4c2
equal deleted inserted replaced
889:f549fd9fbd8f 890:54565fd74e74
41 struct cx_iterator_base_s { 41 struct cx_iterator_base_s {
42 /** 42 /**
43 * True iff the iterator points to valid data. 43 * True iff the iterator points to valid data.
44 */ 44 */
45 __attribute__ ((__nonnull__)) 45 __attribute__ ((__nonnull__))
46 bool (*valid)(void const *); 46 bool (*valid)(const void *);
47 47
48 /** 48 /**
49 * Returns a pointer to the current element. 49 * Returns a pointer to the current element.
50 * 50 *
51 * When valid returns false, the behavior of this function is undefined. 51 * When valid returns false, the behavior of this function is undefined.
52 */ 52 */
53 __attribute__ ((__nonnull__)) 53 __attribute__ ((__nonnull__))
54 void *(*current)(void const *); 54 void *(*current)(const void *);
55 55
56 /** 56 /**
57 * Original implementation in case the function needs to be wrapped. 57 * Original implementation in case the function needs to be wrapped.
58 */ 58 */
59 __attribute__ ((__nonnull__)) 59 __attribute__ ((__nonnull__))
60 void *(*current_impl)(void const *); 60 void *(*current_impl)(const void *);
61 61
62 /** 62 /**
63 * Advances the iterator. 63 * Advances the iterator.
64 * 64 *
65 * When valid returns false, the behavior of this function is undefined. 65 * When valid returns false, the behavior of this function is undefined.
102 */ 102 */
103 void *m; 103 void *m;
104 /** 104 /**
105 * Access for normal iterators. 105 * Access for normal iterators.
106 */ 106 */
107 void const *c; 107 const void *c;
108 } src_handle; 108 } src_handle;
109 109
110 /** 110 /**
111 * Field for storing a key-value pair. 111 * Field for storing a key-value pair.
112 * May be used by iterators that iterate over k/v-collections. 112 * May be used by iterators that iterate over k/v-collections.
113 */ 113 */
114 struct { 114 struct {
115 /** 115 /**
116 * A pointer to the key. 116 * A pointer to the key.
117 */ 117 */
118 void const *key; 118 const void *key;
119 /** 119 /**
120 * A pointer to the value. 120 * A pointer to the value.
121 */ 121 */
122 void *value; 122 void *value;
123 } kv_data; 123 } kv_data;
224 * @param elem_count the number of elements in the array 224 * @param elem_count the number of elements in the array
225 * @return an iterator for the specified array 225 * @return an iterator for the specified array
226 */ 226 */
227 __attribute__((__warn_unused_result__)) 227 __attribute__((__warn_unused_result__))
228 CxIterator cxIterator( 228 CxIterator cxIterator(
229 void const *array, 229 const void *array,
230 size_t elem_size, 230 size_t elem_size,
231 size_t elem_count 231 size_t elem_count
232 ); 232 );
233 233
234 /** 234 /**

mercurial