map.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* This file is part of nit.
  2. *
  3. * Nit is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU Lesser General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * Nit is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Lesser General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Lesser General Public License
  14. * along with nit. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef MAP_H
  17. #define MAP_H
  18. #include "set.h"
  19. #define map_foreach(...) set_foreach(__VA_ARGS__)
  20. typedef Set Map;
  21. #define map_init(...) set_init(__VA_ARGS__)
  22. void
  23. map_dispose(Map *map);
  24. Nit_error
  25. map_add(Map *map, uint32_t key_len, const void *key, void *val);
  26. Nit_error
  27. map_remove(Map *map, uint32_t key_len, const void *key, void **val);
  28. int
  29. map_get(const Map *map, uint32_t key_len, const void *key, void **val);
  30. void *
  31. map_val(void *dat, uint32_t key_len);
  32. #endif