228 /** |
228 /** |
229 * A shared instance of an empty map. |
229 * A shared instance of an empty map. |
230 * |
230 * |
231 * Writing to that map is not allowed. |
231 * Writing to that map is not allowed. |
232 * |
232 * |
233 * You can use this is a placeholder for initializing CxMap pointers |
233 * You can use this as a placeholder for initializing CxMap pointers |
234 * for which you do not want to reserve memory right from the beginning. |
234 * for which you do not want to reserve memory right from the beginning. |
235 */ |
235 */ |
236 cx_attr_export |
236 cx_attr_export |
237 extern CxMap *const cxEmptyMap; |
237 extern CxMap *const cxEmptyMap; |
238 |
238 |
290 } |
290 } |
291 |
291 |
292 /** |
292 /** |
293 * Creates a key iterator for a map. |
293 * Creates a key iterator for a map. |
294 * |
294 * |
295 * The elements of the iterator are keys of type CxHashKey and the pointer returned |
295 * The elements of the iterator are keys of type CxHashKey, and the pointer returned |
296 * during iterator shall be treated as @c const @c CxHashKey* . |
296 * during iterator shall be treated as @c const @c CxHashKey* . |
297 * |
297 * |
298 * @note An iterator iterates over all elements successively. Therefore, the order |
298 * @note An iterator iterates over all elements successively. Therefore, the order |
299 * highly depends on the map implementation and may change arbitrarily when the contents change. |
299 * highly depends on the map implementation and may change arbitrarily when the contents change. |
300 * |
300 * |
308 } |
308 } |
309 |
309 |
310 /** |
310 /** |
311 * Creates an iterator for a map. |
311 * Creates an iterator for a map. |
312 * |
312 * |
313 * The elements of the iterator are key/value pairs of type CxMapEntry and the pointer returned |
313 * The elements of the iterator are key/value pairs of type CxMapEntry, and the pointer returned |
314 * during iterator shall be treated as @c const @c CxMapEntry* . |
314 * during iterator shall be treated as @c const @c CxMapEntry* . |
315 * |
315 * |
316 * @note An iterator iterates over all elements successively. Therefore, the order |
316 * @note An iterator iterates over all elements successively. Therefore, the order |
317 * highly depends on the map implementation and may change arbitrarily when the contents change. |
317 * highly depends on the map implementation and may change arbitrarily when the contents change. |
318 * |
318 * |
346 CxMapIterator cxMapMutIteratorValues(CxMap *map); |
346 CxMapIterator cxMapMutIteratorValues(CxMap *map); |
347 |
347 |
348 /** |
348 /** |
349 * Creates a mutating iterator over the keys of a map. |
349 * Creates a mutating iterator over the keys of a map. |
350 * |
350 * |
351 * The elements of the iterator are keys of type CxHashKey and the pointer returned |
351 * The elements of the iterator are keys of type CxHashKey, and the pointer returned |
352 * during iterator shall be treated as @c const @c CxHashKey* . |
352 * during iterator shall be treated as @c const @c CxHashKey* . |
353 * |
353 * |
354 * @note An iterator iterates over all elements successively. Therefore, the order |
354 * @note An iterator iterates over all elements successively. Therefore, the order |
355 * highly depends on the map implementation and may change arbitrarily when the contents change. |
355 * highly depends on the map implementation and may change arbitrarily when the contents change. |
356 * |
356 * |
362 CxMapIterator cxMapMutIteratorKeys(CxMap *map); |
362 CxMapIterator cxMapMutIteratorKeys(CxMap *map); |
363 |
363 |
364 /** |
364 /** |
365 * Creates a mutating iterator for a map. |
365 * Creates a mutating iterator for a map. |
366 * |
366 * |
367 * The elements of the iterator are key/value pairs of type CxMapEntry and the pointer returned |
367 * The elements of the iterator are key/value pairs of type CxMapEntry, and the pointer returned |
368 * during iterator shall be treated as @c const @c CxMapEntry* . |
368 * during iterator shall be treated as @c const @c CxMapEntry* . |
369 * |
369 * |
370 * @note An iterator iterates over all elements successively. Therefore, the order |
370 * @note An iterator iterates over all elements successively. Therefore, the order |
371 * highly depends on the map implementation and may change arbitrarily when the contents change. |
371 * highly depends on the map implementation and may change arbitrarily when the contents change. |
372 * |
372 * |
514 #define cxMapGet(map, key) cx_map_get(map, CX_HASH_KEY(key)) |
514 #define cxMapGet(map, key) cx_map_get(map, CX_HASH_KEY(key)) |
515 |
515 |
516 /** |
516 /** |
517 * Removes a key/value-pair from the map by using the key. |
517 * Removes a key/value-pair from the map by using the key. |
518 * |
518 * |
519 * Invokes the destructor functions, if any, on the removed element, if and only if the |
519 * Invokes the destructor functions, if any, on the removed element if and only if the |
520 * @p targetbuf is @c NULL. |
520 * @p targetbuf is @c NULL. |
521 * |
521 * |
522 * @param map the map |
522 * @param map the map |
523 * @param key the key |
523 * @param key the key |
524 * @param targetbuf the optional buffer where the removed element shall be copied to |
524 * @param targetbuf the optional buffer where the removed element shall be copied to |