47 */ |
47 */ |
48 struct cx_iterator_base_s { |
48 struct cx_iterator_base_s { |
49 /** |
49 /** |
50 * True iff the iterator points to valid data. |
50 * True iff the iterator points to valid data. |
51 */ |
51 */ |
52 cx_attr_nonnull |
|
53 bool (*valid)(const void *); |
52 bool (*valid)(const void *); |
54 |
53 |
55 /** |
54 /** |
56 * Returns a pointer to the current element. |
55 * Returns a pointer to the current element. |
57 * |
56 * |
58 * When valid returns false, the behavior of this function is undefined. |
57 * When valid returns false, the behavior of this function is undefined. |
59 */ |
58 */ |
60 cx_attr_nonnull |
|
61 cx_attr_nodiscard |
|
62 void *(*current)(const void *); |
59 void *(*current)(const void *); |
63 |
60 |
64 /** |
61 /** |
65 * Original implementation in case the function needs to be wrapped. |
62 * Original implementation in case the function needs to be wrapped. |
66 */ |
63 */ |
67 cx_attr_nonnull |
|
68 cx_attr_nodiscard |
|
69 void *(*current_impl)(const void *); |
64 void *(*current_impl)(const void *); |
70 |
65 |
71 /** |
66 /** |
72 * Advances the iterator. |
67 * Advances the iterator. |
73 * |
68 * |
74 * When valid returns false, the behavior of this function is undefined. |
69 * When valid returns false, the behavior of this function is undefined. |
75 */ |
70 */ |
76 cx_attr_nonnull |
|
77 void (*next)(void *); |
71 void (*next)(void *); |
78 /** |
72 /** |
79 * Indicates whether this iterator may remove elements. |
73 * Indicates whether this iterator may remove elements. |
80 */ |
74 */ |
81 bool mutating; |
75 bool mutating; |
255 * @param remove_keeps_order @c true if the order of elements must be preserved |
250 * @param remove_keeps_order @c true if the order of elements must be preserved |
256 * when removing an element |
251 * when removing an element |
257 * @return an iterator for the specified array |
252 * @return an iterator for the specified array |
258 */ |
253 */ |
259 cx_attr_nodiscard |
254 cx_attr_nodiscard |
|
255 cx_attr_export |
260 CxIterator cxMutIterator( |
256 CxIterator cxMutIterator( |
261 void *array, |
257 void *array, |
262 size_t elem_size, |
258 size_t elem_size, |
263 size_t elem_count, |
259 size_t elem_count, |
264 bool remove_keeps_order |
260 bool remove_keeps_order |
296 * @return an iterator for the specified array |
293 * @return an iterator for the specified array |
297 * @see cxMutIterator() |
294 * @see cxMutIterator() |
298 * @see cxIteratorPtr() |
295 * @see cxIteratorPtr() |
299 */ |
296 */ |
300 cx_attr_nodiscard |
297 cx_attr_nodiscard |
|
298 cx_attr_export |
301 CxIterator cxMutIteratorPtr( |
299 CxIterator cxMutIteratorPtr( |
302 void *array, |
300 void *array, |
303 size_t elem_count, |
301 size_t elem_count, |
304 bool remove_keeps_order |
302 bool remove_keeps_order |
305 ); |
303 ); |