From 4da7be39827ea5888ef9c97b1aadf61b0d76347c Mon Sep 17 00:00:00 2001 From: Silas Bartha Date: Fri, 7 Feb 2025 11:27:18 -0500 Subject: initial commit (lol) --- mons_collections/include/hashmap.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 mons_collections/include/hashmap.h (limited to 'mons_collections/include/hashmap.h') diff --git a/mons_collections/include/hashmap.h b/mons_collections/include/hashmap.h new file mode 100644 index 0000000..e5e59c4 --- /dev/null +++ b/mons_collections/include/hashmap.h @@ -0,0 +1,23 @@ +#ifndef MONS_HASHMAP_H +#define MONS_HASHMAP_H + +typedef struct mons_hashmap_pair { + char *key; + void *value; + struct mons_hashmap_pair *next; +} mons_hashmap_pair; + +typedef struct mons_hashmap { + mons_hashmap_pair **data; + unsigned int bucket_count; + unsigned int member_size; + unsigned int len; +} mons_hashmap; + +mons_hashmap mons_hashmap_new(unsigned int member_size, unsigned int buckets); +void mons_hashmap_free(mons_hashmap *hashmap); +int mons_hashmap_insert(mons_hashmap *map, char *key, void *value); +int mons_hashmap_get(mons_hashmap map, char *key, void *out); +int mons_hashmap_remove(mons_hashmap *map, char *key); +int mons_hashmap_at(mons_hashmap map, unsigned int index, mons_hashmap_pair *out); +#endif -- cgit v1.2.3