File StringKeyHashMap.h

FileList > engine > include > StringKeyHashMap.h

Go to the source code of this file

  • #include <stdbool.h>

Classes

Type Name
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.
struct HashmapKeyIterator

Public Functions

Type Name
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)
bool HashmapDeleteItem (struct HashMap * pMap, char * 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
void HashmapInitWithLoadFactor (struct HashMap * pMap, int capacity, int valSize, float loadFactor)
same as HashmapInit but sets load factor as well
void * HashmapInsert (struct HashMap * pMap, char * key, void * pVal)
void HashmapPrintEntries (struct HashMap * pMap, const char * hashMapName)
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.
char * NextHashmapKey (struct HashmapKeyIterator * itr)

Public Functions Documentation

function GetKeyIterator

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

struct HashmapKeyIterator GetKeyIterator (
    struct HashMap * pHashMap
) 

function HashmapDeInit

void HashmapDeInit (
    struct HashMap * pMap
) 

Parameters:

  • pMap

function HashmapDeleteItem

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

Parameters:

  • pMap
  • key

Returns:


function HashmapInit

initializes the hashmap struct to a decfault value. you can change fLoadFactor afterwards but it sets it to a default value

void HashmapInit (
    struct HashMap * pMap,
    int capacity,
    int valSize
) 

Parameters:

  • pMap
  • capacity
  • valSize size of individual values

function HashmapInitWithLoadFactor

same as HashmapInit but sets load factor as well

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

Parameters:

  • pMap
  • capacity
  • valSize
  • loadFactor size of individual values

function 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


function HashmapPrintEntries

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

Parameters:

  • pMap
  • hashMapName

function HashmapSearch

Search for a key in the hash map, returns a pointer to the value or NULL if not present.

void * HashmapSearch (
    struct HashMap * pMap,
    char * key
) 

Parameters:

  • pMap
  • key

Returns:


function NextHashmapKey

char * NextHashmapKey (
    struct HashmapKeyIterator * itr
) 

Parameters:

  • <br>

Returns:



The documentation for this class was generated from the following file /home/runner/work/2DFarmingRPG/2DFarmingRPG/Stardew/engine/include/StringKeyHashMap.h