- /** @brief Cursor on dictionnaries (opaque type) */
- typedef struct xbt_dict_cursor_ *xbt_dict_cursor_t;
- xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t head);
- void xbt_dict_cursor_free(xbt_dict_cursor_t *cursor);
-
- void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor);
-
-
- char * xbt_dict_cursor_get_key (xbt_dict_cursor_t cursor);
- void * xbt_dict_cursor_get_data (xbt_dict_cursor_t cursor);
-
- void xbt_dict_cursor_first (const xbt_dict_t dict,
- xbt_dict_cursor_t *cursor);
- void xbt_dict_cursor_step (xbt_dict_cursor_t cursor);
- int xbt_dict_cursor_get_or_free (xbt_dict_cursor_t *cursor,
- char **key,
- void **data);
- /** @def xbt_dict_foreach
- @hideinitializer */
-# define xbt_dict_foreach(dict,cursor,key,data) \
- for (cursor=NULL, xbt_dict_cursor_first((dict),&(cursor)) ; \
- xbt_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));\
- xbt_dict_cursor_step(cursor) )
-
-/** @} */
-/** @defgroup XBT_dict_multi Multi-level dictionnaries
- * @ingroup XBT_dict
- *
- * <center><table><tr><td><b>Top</b> <td> [\ref index]::[\ref XBT_API]::[\ref XBT_dict]
- * <tr><td><b>Prev</b> <td> [\ref XBT_dict_curs]
- * <tr><td> Next <td> </table></center>
- *
- * They can be seen as dictionnary of multiple keys or as dictionnary of
- * dictionnary of ... of data. Most of the functions here work the same way
- * than their simple dictionnary counterpart.
- *
- * Note that there is no xbt_multidict_free neither xbt_multi_dict_new functions.
- * Use xbt_dict_free() and xbt_dict_new() instead.
- *
- * @{
+/** @brief Cursor on dictionaries (opaque type) */
+typedef struct s_xbt_dict_cursor *xbt_dict_cursor_t;
+typedef const struct s_xbt_dict_cursor* const_xbt_dict_cursor_t;
+
+XBT_PUBLIC xbt_dict_cursor_t xbt_dict_cursor_new(const_xbt_dict_t dict);
+XBT_PUBLIC void xbt_dict_cursor_free(xbt_dict_cursor_t* cursor);
+
+XBT_PUBLIC void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor);
+
+XBT_PUBLIC char* xbt_dict_cursor_get_key(const_xbt_dict_cursor_t cursor);
+XBT_PUBLIC void* xbt_dict_cursor_get_data(const_xbt_dict_cursor_t cursor);
+
+XBT_PUBLIC void xbt_dict_cursor_first(const_xbt_dict_t dict, xbt_dict_cursor_t* cursor);
+XBT_PUBLIC void xbt_dict_cursor_step(xbt_dict_cursor_t cursor);
+XBT_PUBLIC int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t* cursor, char** key, void** data);
+/** @def xbt_dict_foreach
+ * @param dict a @ref xbt_dict_t iterator
+ * @param cursor an @ref xbt_dict_cursor_t used as cursor
+ * @param key a char*
+ * @param data a void** output
+ * @hideinitializer
+ *
+ * @note An example of usage:
+ * @code
+xbt_dict_cursor_t cursor = NULL;
+char *key;
+char *data;
+
+xbt_dict_foreach(head, cursor, key, data) {
+ printf("Key %s with data %s\n",key,data);
+}
+@endcode