Cthulhu  0.2.10
Cthulhu compiler collection
map.h File Reference
#include <ctu_std_api.h>
#include "core/analyze.h"
#include "std/typeinfo.h"
Include dependency graph for map.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  map_t
 an unordered hash map More...
 
struct  map_entry_t
 a key-value pair in a map More...
 
struct  map_iter_t
 a map iterator handle More...
 

Macros

#define CTU_MAP_NEXT(iter, key, value)   map_next_pair(iter, (const void **)(key), (void **)(value))
 get the next key-value pair from a map iterator More...
 

Typedefs

typedef typedefCT_BEGIN_API struct arena_t arena_t
 

Functions

CT_STD_API void map_init (OUT_NOTNULL map_t *map, size_t size, hash_info_t info, arena_t *arena)
 initialize a map More...
 
CT_NODISCARD CT_STD_API map_t map_make (size_t size, hash_info_t info, arena_t *arena)
 create a new map on the stack More...
 
CT_NODISCARD CT_STD_API map_tmap_new (size_t size, hash_info_t info, arena_t *arena)
 create a new map on the heap More...
 
CT_NODISCARD CT_STD_API map_tmap_optimal (size_t size, hash_info_t info, arena_t *arena)
 create a new map with an optimal size More...
 
CT_STD_API void map_set (map_t *map, const void *key, void *value)
 set a key-value pair in a map More...
 
CT_NODISCARD CT_PUREFN CT_STD_API void * map_get (const map_t *map, const void *key)
 get a value from a map More...
 
CT_NODISCARD CT_PUREFN CT_STD_API void * map_get_default (const map_t *map, const void *key, void *other)
 get a value from a map or a default value More...
 
CT_NODISCARD CT_PUREFN CT_STD_API bool map_contains (const map_t *map, const void *key)
 check if a map contains a key More...
 
CT_STD_API bool map_delete (map_t *map, const void *key)
 delete a key-value pair from a map More...
 
CT_NODISCARD CT_STD_API vector_tmap_values (map_t *map)
 collect all the values from a map into a vector More...
 
CT_NODISCARD CT_STD_API typevec_tmap_entries (map_t *map)
 collect all key-value pairs in a map into a vector returns a typevec_t<map_entry_t> More...
 
CT_NODISCARD CT_PUREFN CT_STD_API size_t map_count (const map_t *map)
 get the number of key-value pairs in a map More...
 
CT_STD_API void map_reset (map_t *map)
 clear all key-value pairs from a map More...
 
CT_NODISCARD CT_PUREFN CT_STD_API map_iter_t map_iter (const map_t *map)
 create a new map iterator More...
 
CT_NODISCARD CT_NOALIAS CT_STD_API map_entry_t map_next (map_iter_t *iter)
 get the next key-value pair from a map iterator More...
 
CT_NODISCARD CT_PUREFN CT_STD_API bool map_has_next (const map_iter_t *iter)
 check if a map iterator has more elements More...
 
CT_NODISCARD CT_STD_API bool map_next_pair (map_iter_t *iter, const void **key, void **value)
 get the next key-value pair from a map iterator returns the values via out parameters for ease of use this also returns false if the iterator has no more elements this is intended to be used via CTU_MAP_NEXT for more idiomatic usage More...
 

Variables

CT_STD_API const map_t kEmptyMap
 an empty map More...
 

Typedef Documentation

◆ arena_t

typedef typedefCT_BEGIN_API struct arena_t arena_t

Definition at line 11 of file map.h.