Stardew Engine
Loading...
Searching...
No Matches
StringKeyHashMap.h File Reference
#include <stdbool.h>
Include dependency graph for StringKeyHashMap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HashMap
 A hash map with strings for keys and any type for values doubles in size when the load factor is met, keeps KVPs as a linked list. More...
 
struct  HashmapKeyIterator
 

Functions

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.
 
void * HashmapInsert (struct HashMap *pMap, char *key, void *pVal)
 
bool HashmapDeleteItem (struct HashMap *pMap, char *key)
 
void HashmapDeInit (struct HashMap *pMap)
 
void HashmapPrintEntries (struct HashMap *pMap, const char *hashMapName)
 
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 *)
 

Function Documentation

◆ GetKeyIterator()

struct HashmapKeyIterator GetKeyIterator ( struct HashMap pHashMap)

Get an iterator object that you can call "NextHashmapKey" with to iterate through the hashmaps keys.

◆ HashmapDeInit()

void HashmapDeInit ( struct HashMap pMap)
Parameters
pMap

◆ HashmapDeleteItem()

bool HashmapDeleteItem ( struct HashMap pMap,
char *  key 
)
Parameters
pMap
key
Returns

◆ HashmapInit()

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

Parameters
pMap
capacity
valSizesize of individual values

◆ HashmapInitWithLoadFactor()

void HashmapInitWithLoadFactor ( struct HashMap pMap,
int  capacity,
int  valSize,
float  loadFactor 
)

same as HashmapInit but sets load factor as well

Parameters
pMap
capacity
valSize
loadFactorsize of individual values

◆ HashmapInsert()

void * HashmapInsert ( struct HashMap pMap,
char *  key,
void *  pVal 
)
Parameters
pMap
key
pVal
Returns
true if a new key and inserted, false if an existing key and value overwritten

◆ HashmapPrintEntries()

void HashmapPrintEntries ( struct HashMap pMap,
const char *  hashMapName 
)
Parameters
pMap
hashMapName

◆ HashmapSearch()

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.

Parameters
pMap
key
Returns

◆ NextHashmapKey()

char * NextHashmapKey ( struct HashmapKeyIterator itr)
Parameters
<br>
Returns