|
Stardew Engine
|
#include "StringKeyHashMap.h"#include <stdlib.h>#include <stdbool.h>#include <string.h>#include <stdio.h>#include "AssertLib.h"#include "Log.h"
Data Structures | |
| struct | KVP |
Macros | |
| #define | STARDEW_HASHMAP_DEFAULT_LOAD_FACTOR 0.75f |
Functions | |
| unsigned int | djb2 (char *str) |
| void | HashmapInit (struct HashMap *pMap, int capacity, int valSize) |
| initializes the hashmap struct to a decfault value. you can change fLoadFactor afterwards but it sets it to a default value | |
| void | HashmapInitWithLoadFactor (struct HashMap *pMap, int capacity, int valSize, float loadFactor) |
| same as HashmapInit but sets load factor as well | |
| void * | HashmapSearch (struct HashMap *pMap, char *key) |
| Search for a key in the hash map, returns a pointer to the value or NULL if not present. | |
| struct KVP * | HashmapSearchKVP (struct HashMap *pMap, char *key) |
| struct KVP * | InsertKVPIntoNewAlloc (struct HashMap *pMap, struct KVP *pKVPsrc, char *pNewAlloc) |
| insert from the old allocation to the new | |
| void | HashmapPrintEntries (struct HashMap *pMap, const char *hashMapName) |
| void | HashmapResize (struct HashMap *pMap) |
| void * | HashmapInsert (struct HashMap *pMap, char *key, void *pVal) |
| struct KVP * | FindMoveableKey (struct KVP *pHole, struct HashMap *pMap) |
| bool | HashmapDeleteItem (struct HashMap *pMap, char *key) |
| struct HashmapKeyIterator | GetKeyIterator (struct HashMap *pHashMap) |
| Get an iterator object that you can call "NextHashmapKey" with to iterate through the hashmaps keys. | |
| char * | NextHashmapKey (struct HashmapKeyIterator *itr) |
| void | HashmapDeInit (struct HashMap *pMap) |
| #define STARDEW_HASHMAP_DEFAULT_LOAD_FACTOR 0.75f |
| unsigned int djb2 | ( | char * | str | ) |
| struct HashmapKeyIterator GetKeyIterator | ( | struct HashMap * | pHashMap | ) |
Get an iterator object that you can call "NextHashmapKey" with to iterate through the hashmaps keys.
| void HashmapDeInit | ( | struct HashMap * | pMap | ) |
| pMap |
| bool HashmapDeleteItem | ( | struct HashMap * | pMap, |
| char * | key | ||
| ) |
| pMap | |
| key |
| void HashmapInit | ( | struct HashMap * | pMap, |
| int | capacity, | ||
| int | valSize | ||
| ) |
initializes the hashmap struct to a decfault value. you can change fLoadFactor afterwards but it sets it to a default value
| pMap | |
| capacity | |
| valSize | size of individual values |
| void HashmapInitWithLoadFactor | ( | struct HashMap * | pMap, |
| int | capacity, | ||
| int | valSize, | ||
| float | loadFactor | ||
| ) |
same as HashmapInit but sets load factor as well
| pMap | |
| capacity | |
| valSize | |
| loadFactor | size of individual values |
| void * HashmapInsert | ( | struct HashMap * | pMap, |
| char * | key, | ||
| void * | pVal | ||
| ) |
| pMap | |
| key | |
| pVal |
| void HashmapPrintEntries | ( | struct HashMap * | pMap, |
| const char * | hashMapName | ||
| ) |
| pMap | |
| hashMapName |
| void HashmapResize | ( | struct HashMap * | pMap | ) |
| void * HashmapSearch | ( | struct HashMap * | pMap, |
| char * | key | ||
| ) |
Search for a key in the hash map, returns a pointer to the value or NULL if not present.
| pMap | |
| key |
| struct KVP * InsertKVPIntoNewAlloc | ( | struct HashMap * | pMap, |
| struct KVP * | pKVPsrc, | ||
| char * | pNewAlloc | ||
| ) |
insert from the old allocation to the new
| pMap | |
| pKVPsrc | kvp from old allocation |
| pNewAlloc | New allocation |
| char * NextHashmapKey | ( | struct HashmapKeyIterator * | itr | ) |
| <br> |