| 112 |
112 |
| 113 /** |
113 /** |
| 114 * Iterator over the key/value pairs. |
114 * Iterator over the key/value pairs. |
| 115 */ |
115 */ |
| 116 __attribute__((__nonnull__, __warn_unused_result__)) |
116 __attribute__((__nonnull__, __warn_unused_result__)) |
| 117 CxIterator (*iterator)(CxMap *map); |
117 CxIterator (*iterator)(CxMap const *map); |
| 118 |
118 |
| 119 /** |
119 /** |
| 120 * Iterator over the keys. |
120 * Iterator over the keys. |
| 121 */ |
121 */ |
| 122 __attribute__((__nonnull__, __warn_unused_result__)) |
122 __attribute__((__nonnull__, __warn_unused_result__)) |
| 123 CxIterator (*iterator_keys)(CxMap *map); |
123 CxIterator (*iterator_keys)(CxMap const *map); |
| 124 |
124 |
| 125 /** |
125 /** |
| 126 * Iterator over the values. |
126 * Iterator over the values. |
| 127 */ |
127 */ |
| 128 __attribute__((__nonnull__, __warn_unused_result__)) |
128 __attribute__((__nonnull__, __warn_unused_result__)) |
| 129 CxIterator (*iterator_values)(CxMap *map); |
129 CxIterator (*iterator_values)(CxMap const *map); |
| |
130 |
| |
131 /** |
| |
132 * Mutating iterator over the key/value pairs. |
| |
133 */ |
| |
134 __attribute__((__nonnull__, __warn_unused_result__)) |
| |
135 CxMutIterator (*mut_iterator)(CxMap *map); |
| |
136 |
| |
137 /** |
| |
138 * Mutating iterator over the keys. |
| |
139 */ |
| |
140 __attribute__((__nonnull__, __warn_unused_result__)) |
| |
141 CxMutIterator (*mut_iterator_keys)(CxMap *map); |
| |
142 |
| |
143 /** |
| |
144 * Mutating iterator over the values. |
| |
145 */ |
| |
146 __attribute__((__nonnull__, __warn_unused_result__)) |
| |
147 CxMutIterator (*mut_iterator_values)(CxMap *map); |
| 130 }; |
148 }; |
| 131 |
149 |
| 132 /** |
150 /** |
| 133 * A map entry. |
151 * A map entry. |
| 134 */ |
152 */ |
| 261 __attribute__((__nonnull__, __warn_unused_result__)) |
279 __attribute__((__nonnull__, __warn_unused_result__)) |
| 262 static inline CxIterator cxMapIterator(CxMap *map) { |
280 static inline CxIterator cxMapIterator(CxMap *map) { |
| 263 return map->cl->iterator(map); |
281 return map->cl->iterator(map); |
| 264 } |
282 } |
| 265 |
283 |
| |
284 |
| |
285 /** |
| |
286 * Creates a mutating iterator over the values of a map. |
| |
287 * |
| |
288 * \note An iterator iterates over all elements successively. Therefore the order |
| |
289 * highly depends on the map implementation and may change arbitrarily when the contents change. |
| |
290 * |
| |
291 * @param map the map to create the iterator for |
| |
292 * @return an iterator for the currently stored values |
| |
293 */ |
| |
294 __attribute__((__nonnull__, __warn_unused_result__)) |
| |
295 static inline CxMutIterator cxMapMutIteratorValues(CxMap *map) { |
| |
296 return map->cl->mut_iterator_values(map); |
| |
297 } |
| |
298 |
| |
299 /** |
| |
300 * Creates a mutating iterator over the keys of a map. |
| |
301 * |
| |
302 * The elements of the iterator are keys of type CxHashKey. |
| |
303 * |
| |
304 * \note An iterator iterates over all elements successively. Therefore the order |
| |
305 * highly depends on the map implementation and may change arbitrarily when the contents change. |
| |
306 * |
| |
307 * @param map the map to create the iterator for |
| |
308 * @return an iterator for the currently stored keys |
| |
309 */ |
| |
310 __attribute__((__nonnull__, __warn_unused_result__)) |
| |
311 static inline CxMutIterator cxMapMutIteratorKeys(CxMap *map) { |
| |
312 return map->cl->mut_iterator_keys(map); |
| |
313 } |
| |
314 |
| |
315 /** |
| |
316 * Creates a mutating iterator for a map. |
| |
317 * |
| |
318 * The elements of the iterator are key/value pairs of type CxMapEntry. |
| |
319 * |
| |
320 * \note An iterator iterates over all elements successively. Therefore the order |
| |
321 * highly depends on the map implementation and may change arbitrarily when the contents change. |
| |
322 * |
| |
323 * @param map the map to create the iterator for |
| |
324 * @return an iterator for the currently stored entries |
| |
325 * @see cxMapMutIteratorKeys() |
| |
326 * @see cxMapMutIteratorValues() |
| |
327 */ |
| |
328 __attribute__((__nonnull__, __warn_unused_result__)) |
| |
329 static inline CxMutIterator cxMapMutIterator(CxMap *map) { |
| |
330 return map->cl->mut_iterator(map); |
| |
331 } |
| |
332 |
| 266 #ifdef __cplusplus |
333 #ifdef __cplusplus |
| 267 } |
334 } |
| 268 #endif |
335 #endif |
| 269 |
336 |
| 270 #endif // UCX_MAP_H |
337 #endif // UCX_MAP_H |