map.h 795 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef MAP_H_
  2. #define MAP_H_
  3. #include "rb_tree.h"
  4. typedef struct {
  5. rb_node_t node;
  6. void *key;
  7. void *value;
  8. } node_entry_t;
  9. typedef int (*cmp_t)(void** a, void** b);
  10. void* new_map(cmp_t compare);
  11. void map_set(void* self, void* key, void* value);
  12. void* map_get(void* self, void* key);
  13. void map_erase(void* self, void* key);
  14. void* map_begin(void *self);
  15. void* map_next(void *self, void *iter);
  16. void* map_iter_key(void* iter);
  17. void* map_iter_value(void* iter);
  18. void* new_dict();
  19. void dict_set(void* self, const char *key, void* value);
  20. void* dict_get(void* self, const char* key);
  21. void dict_erase(void* self, const char* key);
  22. void* dict_begin(void *self);
  23. void* dict_next(void *self, void *iter);
  24. const char* dict_iter_key(void* iter);
  25. void* dict_iter_value(void* iter);
  26. #endif