Go to the source code of this file.
Defines | |
#define | HASHMAP_ILLEGAL 0 |
Flags an illegal access. | |
#define | HASHMAP_INSERT 1 |
New element inserted - flag. | |
#define | HASHMAP_UPDATE 2 |
Update of existing element. | |
Typedefs | |
typedef void(* | fHashmapProc )(const char *key, const void *datum) |
Prototype of a function that processes an item. | |
Functions | |
hashmap * | newHashmap (unsigned int hint) |
Creates a new hashmap. | |
void | deleteHashmap (hashmap *map) |
Destroys the hashmap without touching saved data. | |
int | hashmapSet (hashmap *map, void *data, const char *key) |
Inserts a new element into the map or updates an existing one. | |
void * | hashmapGet (const hashmap *map, const char *key) |
Returns the element associated with a given key. | |
void * | hashmapRemove (hashmap *map, const char *key) |
Removes the element associated with a given key from the map and returns it. | |
void | hashmapProcess (const hashmap *map, fHashmapProc proc) |
Processes all elements of the map in lexicographical order of their keys. |
Definition in file hashmap.h.
typedef void(* fHashmapProc)(const char *key, const void *datum) |
void deleteHashmap | ( | hashmap * | map | ) |
void* hashmapGet | ( | const hashmap * | map, | |
const char * | key | |||
) |
void hashmapProcess | ( | const hashmap * | map, | |
fHashmapProc | proc | |||
) |
void* hashmapRemove | ( | hashmap * | map, | |
const char * | key | |||
) |
int hashmapSet | ( | hashmap * | map, | |
void * | data, | |||
const char * | key | |||
) |
Inserts a new element into the map or updates an existing one.
key
is not NULL
or empty.[in] | map | target hashmap |
[in] | data | pointer to the data |
[in] | key | the key |
HASHMAP_ILLEGAL
, if the key is invalid (NULL
or empty) HASHMAP_INSERT
, if the element was inserted HASHMAP_UPDATE
, if the element got updated (overwritten) hashmap* newHashmap | ( | unsigned int | hint | ) |