44 |
44 |
45 struct cx_iterator_base_s { |
45 struct cx_iterator_base_s { |
46 /** |
46 /** |
47 * True iff the iterator points to valid data. |
47 * True iff the iterator points to valid data. |
48 */ |
48 */ |
49 __attribute__ ((__nonnull__)) |
49 cx_attr_nonnull |
50 bool (*valid)(const void *); |
50 bool (*valid)(const void *); |
51 |
51 |
52 /** |
52 /** |
53 * Returns a pointer to the current element. |
53 * Returns a pointer to the current element. |
54 * |
54 * |
55 * When valid returns false, the behavior of this function is undefined. |
55 * When valid returns false, the behavior of this function is undefined. |
56 */ |
56 */ |
57 __attribute__ ((__nonnull__)) |
57 cx_attr_nonnull |
|
58 cx_attr_nodiscard |
58 void *(*current)(const void *); |
59 void *(*current)(const void *); |
59 |
60 |
60 /** |
61 /** |
61 * Original implementation in case the function needs to be wrapped. |
62 * Original implementation in case the function needs to be wrapped. |
62 */ |
63 */ |
63 __attribute__ ((__nonnull__)) |
64 cx_attr_nonnull |
|
65 cx_attr_nodiscard |
64 void *(*current_impl)(const void *); |
66 void *(*current_impl)(const void *); |
65 |
67 |
66 /** |
68 /** |
67 * Advances the iterator. |
69 * Advances the iterator. |
68 * |
70 * |
69 * When valid returns false, the behavior of this function is undefined. |
71 * When valid returns false, the behavior of this function is undefined. |
70 */ |
72 */ |
71 __attribute__ ((__nonnull__)) |
73 cx_attr_nonnull |
72 void (*next)(void *); |
74 void (*next)(void *); |
73 /** |
75 /** |
74 * Indicates whether this iterator may remove elements. |
76 * Indicates whether this iterator may remove elements. |
75 */ |
77 */ |
76 bool mutating; |
78 bool mutating; |
226 * @param array a pointer to the array (can be \c NULL) |
228 * @param array a pointer to the array (can be \c NULL) |
227 * @param elem_size the size of one array element |
229 * @param elem_size the size of one array element |
228 * @param elem_count the number of elements in the array |
230 * @param elem_count the number of elements in the array |
229 * @return an iterator for the specified array |
231 * @return an iterator for the specified array |
230 */ |
232 */ |
231 __attribute__((__warn_unused_result__)) |
233 cx_attr_nodiscard |
232 CxIterator cxIterator( |
234 CxIterator cxIterator( |
233 const void *array, |
235 const void *array, |
234 size_t elem_size, |
236 size_t elem_size, |
235 size_t elem_count |
237 size_t elem_count |
236 ); |
238 ); |
256 * @param elem_count the number of elements in the array |
258 * @param elem_count the number of elements in the array |
257 * @param remove_keeps_order \c true if the order of elements must be preserved |
259 * @param remove_keeps_order \c true if the order of elements must be preserved |
258 * when removing an element |
260 * when removing an element |
259 * @return an iterator for the specified array |
261 * @return an iterator for the specified array |
260 */ |
262 */ |
261 __attribute__((__warn_unused_result__)) |
263 cx_attr_nodiscard |
262 CxIterator cxMutIterator( |
264 CxIterator cxMutIterator( |
263 void *array, |
265 void *array, |
264 size_t elem_size, |
266 size_t elem_size, |
265 size_t elem_count, |
267 size_t elem_count, |
266 bool remove_keeps_order |
268 bool remove_keeps_order |