LuaHashMap
1.0.0
|
Functions | |
LuaHashMapIterator | LuaHashMap_GetIteratorAtBegin (LuaHashMap *hash_map) |
Returns an iterator at the start position of the hash table. | |
LuaHashMapIterator | LuaHashMap_GetIteratorAtEnd (LuaHashMap *hash_map) |
Returns an iterator at the end position of the hash table. | |
bool | LuaHashMap_IteratorNext (LuaHashMapIterator *hash_iterator) |
Increments the iterator to the next item in the hash table. | |
LuaHashMapIterator | LuaHashMap_GetIteratorForKeyString (LuaHashMap *restrict hash_map, const char *restrict key_string) |
Returns an iterator corresponding to the specified key. | |
LuaHashMapIterator | LuaHashMap_GetIteratorForKeyStringWithLength (LuaHashMap *restrict hash_map, const char *restrict key_string, size_t key_string_length) |
Returns an iterator corresponding to the specified key. | |
LuaHashMapIterator | LuaHashMap_GetIteratorForKeyPointer (LuaHashMap *hash_map, void *key_pointer) |
Returns an iterator corresponding to the specified key. | |
LuaHashMapIterator | LuaHashMap_GetIteratorForKeyNumber (LuaHashMap *hash_map, lua_Number key_number) |
Returns an iterator corresponding to the specified key. | |
LuaHashMapIterator | LuaHashMap_GetIteratorForKeyInteger (LuaHashMap *hash_map, lua_Integer key_integer) |
Returns an iterator corresponding to the specified key. | |
bool | LuaHashMap_IteratorIsNotFound (const LuaHashMapIterator *hash_iterator) |
Returns true if the iterator is "NotFound". | |
bool | LuaHashMap_IteratorIsEqual (const LuaHashMapIterator *hash_iterator1, const LuaHashMapIterator *hash_iterator2) |
Returns true if two iterators are equal. | |
void | LuaHashMap_SetValueStringAtIterator (LuaHashMapIterator *restrict hash_iterator, const char *restrict value_string) |
Updates a value in the hash table pointed to by the iterator. | |
void | LuaHashMap_SetValueStringAtIteratorWithLength (LuaHashMapIterator *restrict hash_iterator, const char *restrict value_string, size_t value_string_length) |
Updates a value in the hash table pointed to by the iterator. | |
void | LuaHashMap_SetValuePointerAtIterator (LuaHashMapIterator *hash_iterator, void *value_pointer) |
Updates a value in the hash table pointed to by the iterator. | |
void | LuaHashMap_SetValueNumberAtIterator (LuaHashMapIterator *hash_iterator, lua_Number value_number) |
Updates a value in the hash table pointed to by the iterator. | |
void | LuaHashMap_SetValueIntegerAtIterator (LuaHashMapIterator *hash_iterator, lua_Integer value_integer) |
Updates a value in the hash table pointed to by the iterator. | |
const char * | LuaHashMap_GetValueStringAtIterator (LuaHashMapIterator *hash_iterator) |
Returns the value in the hash table pointed to by the iterator. | |
const char * | LuaHashMap_GetValueStringAtIteratorWithLength (LuaHashMapIterator *restrict hash_iterator, size_t *restrict value_string_length_return) |
Returns the value in the hash table pointed to by the iterator. | |
void * | LuaHashMap_GetValuePointerAtIterator (LuaHashMapIterator *hash_iterator) |
Returns the value in the hash table pointed to by the iterator. | |
lua_Number | LuaHashMap_GetValueNumberAtIterator (LuaHashMapIterator *hash_iterator) |
Returns the value in the hash table pointed to by the iterator. | |
lua_Integer | LuaHashMap_GetValueIntegerAtIterator (LuaHashMapIterator *hash_iterator) |
Returns the value in the hash table pointed to by the iterator. | |
bool | LuaHashMap_ExistsAtIterator (LuaHashMapIterator *hash_iterator) |
Returns whether a key/value pair exists in the hash table pointed to by the iterator. | |
void | LuaHashMap_RemoveAtIterator (LuaHashMapIterator *hash_iterator) |
Removes a key/value pair in the hash table pointed to by the iterator. | |
int | LuaHashMap_GetValueTypeAtIterator (LuaHashMapIterator *hash_iterator) |
Returns the type of the value in the hash table pointed to by the iterator. | |
int | LuaHashMap_GetKeyTypeAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the type of the key in the iterator. | |
const char * | LuaHashMap_GetKeyStringAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the key corresponding to the iterator. | |
const char * | LuaHashMap_GetKeyStringAtIteratorWithLength (const LuaHashMapIterator *restrict hash_iterator, size_t *restrict key_string_length_return) |
Returns the key corresponding to the iterator. | |
size_t | LuaHashMap_GetKeyStringLengthAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the string length of the key corresponding to the iterator. | |
void * | LuaHashMap_GetKeyPointerAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the key corresponding to the iterator. | |
lua_Number | LuaHashMap_GetKeyNumberAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the key corresponding to the iterator. | |
lua_Integer | LuaHashMap_GetKeyIntegerAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the key corresponding to the iterator. | |
int | LuaHashMap_GetCachedValueTypeAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the type of the cached value in the iterator. | |
const char * | LuaHashMap_GetCachedValueStringAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the cached value saved in the iterator. | |
const char * | LuaHashMap_GetCachedValueStringAtIteratorWithLength (const LuaHashMapIterator *restrict hash_iterator, size_t *restrict value_string_length_return) |
Returns the cached value saved in the iterator. | |
size_t | LuaHashMap_GetCachedValueStringLengthAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the string length of the cached value saved in the iterator. | |
void * | LuaHashMap_GetCachedValuePointerAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the cached value saved in the iterator. | |
lua_Number | LuaHashMap_GetCachedValueNumberAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the cached value saved in the iterator. | |
lua_Integer | LuaHashMap_GetCachedValueIntegerAtIterator (const LuaHashMapIterator *hash_iterator) |
Returns the cached value saved in the iterator. | |
bool LuaHashMap_ExistsAtIterator | ( | LuaHashMapIterator * | hash_iterator | ) |
Returns whether a key/value pair exists in the hash table pointed to by the iterator.
Returns whether a key/value pair exists in the hash table pointed to by the iterator.
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair |
|
inline |
Returns the cached value saved in the iterator.
Returns the cached value saved in the iterator. integer version This version allows you to specify the string length for the string if you already know it as an optimization.
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the cached value saved in the iterator.
Returns the cached value saved in the iterator. integer version This version allows you to specify the string length for the string if you already know it as an optimization.
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the cached value saved in the iterator.
Returns the cached value saved in the iterator. pointer version This version allows you to specify the string length for the string if you already know it as an optimization.
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the cached value saved in the iterator.
Returns the cached value saved in the iterator. string version
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the cached value saved in the iterator.
Returns the cached value saved in the iterator. string version This version allows you to specify the string length for the string if you already know it as an optimization.
hash_iterator | The LuaHashMapIterator instance to operate on. |
value_string_length_return | This returns by reference the string length (strlen()) of the returned key string. You may pass NULL to ignore this result. |
|
inline |
Returns the string length of the cached value saved in the iterator.
Returns the string length of the cached value saved in the current location of the iterator.
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the type of the cached value in the iterator.
This returns the type (e.g. string, pointer, number) of the cached value in the iterator. The integer return value corresponds directly to Lua's types. Valid values are LUA_TSTRING, LUA_TLIGHTUSERDATA, LUA_TNUMBER. (LUA_TNONE may appear in the case of an error.)
This information is particularly useful if you want to store different types within the same hash table. You can use this information to dynamically discover which type is stored and then call the correct Get<T> function.
hash_iterator | The LuaHashMapIterator instance to operate on. |
LuaHashMapIterator LuaHashMap_GetIteratorAtBegin | ( | LuaHashMap * | hash_map | ) |
Returns an iterator at the start position of the hash table.
Returns an iterator at the start position of the hash table. This is what you use if you are going to iterate through the entire collection.
hash_map | The LuaHashMap instance to operate on. |
LuaHashMapIterator LuaHashMap_GetIteratorAtEnd | ( | LuaHashMap * | hash_map | ) |
Returns an iterator at the end position of the hash table.
Returns an iterator at the end position of the hash table. This is what you use if you are going to iterate through the entire collection.
hash_map | The LuaHashMap instance to operate on. |
LuaHashMapIterator LuaHashMap_GetIteratorForKeyInteger | ( | LuaHashMap * | hash_map, |
lua_Integer | key_integer | ||
) |
Returns an iterator corresponding to the specified key.
This returns an iterator corresponding to the specified key. integer version
The intent of this method is to allow you to do multiple operations at the current position without doing unnecessary additional hash look ups. The most common example is you want to test to see if a key/value pair actually exists in the hash table before trying to retrive the value. Using the GetIteratorForKey function, you do one hash lookup, and then you can test existence and extract the CachedValue from the iterator without any subsequent hash look ups.
hash_map | The LuaHashMap instance to operate on |
key_integer | The key for the key/value pair |
LuaHashMapIterator LuaHashMap_GetIteratorForKeyNumber | ( | LuaHashMap * | hash_map, |
lua_Number | key_number | ||
) |
Returns an iterator corresponding to the specified key.
This returns an iterator corresponding to the specified key. number version
The intent of this method is to allow you to do multiple operations at the current position without doing unnecessary additional hash look ups. The most common example is you want to test to see if a key/value pair actually exists in the hash table before trying to retrive the value. Using the GetIteratorForKey function, you do one hash lookup, and then you can test existence and extract the CachedValue from the iterator without any subsequent hash look ups.
hash_map | The LuaHashMap instance to operate on |
key_number | The key for the key/value pair |
LuaHashMapIterator LuaHashMap_GetIteratorForKeyPointer | ( | LuaHashMap * | hash_map, |
void * | key_pointer | ||
) |
Returns an iterator corresponding to the specified key.
This returns an iterator corresponding to the specified key. pointer version
The intent of this method is to allow you to do multiple operations at the current position without doing unnecessary additional hash look ups. The most common example is you want to test to see if a key/value pair actually exists in the hash table before trying to retrive the value. Using the GetIteratorForKey function, you do one hash lookup, and then you can test existence and extract the CachedValue from the iterator without any subsequent hash look ups.
hash_map | The LuaHashMap instance to operate on |
key_pointer | The key for the key/value pair |
LuaHashMapIterator LuaHashMap_GetIteratorForKeyString | ( | LuaHashMap *restrict | hash_map, |
const char *restrict | key_string | ||
) |
Returns an iterator corresponding to the specified key.
This returns an iterator corresponding to the specified key. string version
The intent of this method is to allow you to do multiple operations at the current position without doing unnecessary additional hash look ups. The most common example is you want to test to see if a key/value pair actually exists in the hash table before trying to retrive the value. Using the GetIteratorForKey function, you do one hash lookup, and then you can test existence and extract the CachedValue from the iterator without any subsequent hash look ups.
hash_map | The LuaHashMap instance to operate on |
key_string | The key for the key/value pair |
LuaHashMapIterator LuaHashMap_GetIteratorForKeyStringWithLength | ( | LuaHashMap *restrict | hash_map, |
const char *restrict | key_string, | ||
size_t | key_string_length | ||
) |
Returns an iterator corresponding to the specified key.
This returns an iterator corresponding to the specified key. string version This version allows you to specify the string length for the string if you already know it as an optimization.
The intent of this method is to allow you to do multiple operations at the current position without doing unnecessary additional hash look ups. The most common example is you want to test to see if a key/value pair actually exists in the hash table before trying to retrive the value. Using the GetIteratorForKey function, you do one hash lookup, and then you can test existence and extract the CachedValue from the iterator without any subsequent hash look ups.
hash_map | The LuaHashMap instance to operate on |
key_string | The key for the key/value pair |
key_string_length | The string length (strlen()) of the key string. (This does not count the \0 terminator character.) |
|
inline |
Returns the key corresponding to the iterator.
Returns the key corresponding to the current location of the iterator. integer version
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the key corresponding to the iterator.
Returns the key corresponding to the current location of the iterator. number version
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the key corresponding to the iterator.
Returns the key corresponding to the current location of the iterator. pointer version
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the key corresponding to the iterator.
Returns the key corresponding to the current location of the iterator. string version This version allows you to specify the string length for the string if you already know it as an optimization.
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the key corresponding to the iterator.
Returns the key corresponding to the current location of the iterator. string version This version allows you to specify the string length for the string if you already know it as an optimization.
hash_iterator | The LuaHashMapIterator instance to operate on. |
key_string_length_return | This returns by reference the string length (strlen()) of the returned key string. You may pass NULL to ignore this result. |
|
inline |
Returns the string length of the key corresponding to the iterator.
Returns the string length of the key corresponding to the current location of the iterator.
hash_iterator | The LuaHashMapIterator instance to operate on. |
|
inline |
Returns the type of the key in the iterator.
This returns the type (e.g. string, pointer, number) of the key in the iterator. The integer return value corresponds directly to Lua's types. Valid values are LUA_TSTRING, LUA_TLIGHTUSERDATA, LUA_TNUMBER. (LUA_TNONE may appear in the case of an error.)
This information is particularly useful if you want to store different types within the same hash table. You can use this information to dynamically discover which type is stored and then call the correct Get<T> function.
hash_iterator | The LuaHashMapIterator instance to operate on. |
lua_Integer LuaHashMap_GetValueIntegerAtIterator | ( | LuaHashMapIterator * | hash_iterator | ) |
Returns the value in the hash table pointed to by the iterator.
Returns the value in the hash table pointed to by the iterator. pointer version
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to retrieve. |
lua_Number LuaHashMap_GetValueNumberAtIterator | ( | LuaHashMapIterator * | hash_iterator | ) |
Returns the value in the hash table pointed to by the iterator.
Returns the value in the hash table pointed to by the iterator. pointer version
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to retrieve. |
void* LuaHashMap_GetValuePointerAtIterator | ( | LuaHashMapIterator * | hash_iterator | ) |
Returns the value in the hash table pointed to by the iterator.
Returns the value in the hash table pointed to by the iterator. pointer version
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to retrieve. |
const char* LuaHashMap_GetValueStringAtIterator | ( | LuaHashMapIterator * | hash_iterator | ) |
Returns the value in the hash table pointed to by the iterator.
Returns the value in the hash table pointed to by the iterator. string version
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to retrieve. |
const char* LuaHashMap_GetValueStringAtIteratorWithLength | ( | LuaHashMapIterator *restrict | hash_iterator, |
size_t *restrict | value_string_length_return | ||
) |
Returns the value in the hash table pointed to by the iterator.
Returns the value in the hash table pointed to by the iterator. string version This version allows you to specify the string length for the string if you already know it as an optimization.
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to retrieve. |
value_string_length_return | This returns by reference the string length (strlen()) of the returned value string. You may pass NULL to ignore this result. |
int LuaHashMap_GetValueTypeAtIterator | ( | LuaHashMapIterator * | hash_iterator | ) |
Returns the type of the value in the hash table pointed to by the iterator.
This returns the type (e.g. string, pointer, number) of the value in the hash table pointed to by the iterator. The integer return value corresponds directly to Lua's types. Valid values are LUA_TSTRING, LUA_TLIGHTUSERDATA, LUA_TNUMBER. (LUA_TNONE may appear in the case of an error.)
This information is particularly useful if you want to store different types within the same hash table. You can use this information to dynamically discover which type is stored and then call the correct Get<T> function.
hash_iterator | The LuaHashMapIterator instance to operate on. |
bool LuaHashMap_IteratorIsEqual | ( | const LuaHashMapIterator * | hash_iterator1, |
const LuaHashMapIterator * | hash_iterator2 | ||
) |
Returns true if two iterators are equal.
Returns true if two iterators are equal. This generally means they are pointing to the same key/value pair in the same hash table.
hash_iterator1 | The first iterator that will be compared. |
hash_iterator2 | The other iterator that will be compared. |
|
inline |
Returns true if the iterator is "NotFound".
Returns true if the iterator is bad (i.e. you tried to get an iterator for a key that doesn't exist).
hash_iterator | The LuaHashMapIterator instance to operate on. |
bool LuaHashMap_IteratorNext | ( | LuaHashMapIterator * | hash_iterator | ) |
Increments the iterator to the next item in the hash table.
Increments the iterator to the next item in the hash table.
hash_iterator | The LuaHashMapIterator instance to operate on. |
void LuaHashMap_RemoveAtIterator | ( | LuaHashMapIterator * | hash_iterator | ) |
Removes a key/value pair in the hash table pointed to by the iterator.
Removes a key/value pair in the hash table pointed to by the iterator.
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair |
void LuaHashMap_SetValueIntegerAtIterator | ( | LuaHashMapIterator * | hash_iterator, |
lua_Integer | value_integer | ||
) |
Updates a value in the hash table pointed to by the iterator.
Updates a value in the hash table pointed to by the iterator. The iterator must be a valid iterator (i.e. the key it points to must already be in the hash table). This will not insert new key/value pairs into the hash table. integer version
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to update the value to. |
value_integer | The value for the key. NULL key pointers are allowed as legitimate values. |
void LuaHashMap_SetValueNumberAtIterator | ( | LuaHashMapIterator * | hash_iterator, |
lua_Number | value_number | ||
) |
Updates a value in the hash table pointed to by the iterator.
Updates a value in the hash table pointed to by the iterator. The iterator must be a valid iterator (i.e. the key it points to must already be in the hash table). This will not insert new key/value pairs into the hash table. number version
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to update the value to. |
value_number | The value for the key. NULL key pointers are allowed as legitimate values. |
void LuaHashMap_SetValuePointerAtIterator | ( | LuaHashMapIterator * | hash_iterator, |
void * | value_pointer | ||
) |
Updates a value in the hash table pointed to by the iterator.
Updates a value in the hash table pointed to by the iterator. The iterator must be a valid iterator (i.e. the key it points to must already be in the hash table). This will not insert new key/value pairs into the hash table. pointer version
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to update the value to. |
value_pointer | The value for the key. NULL key pointers are allowed as legitimate values. |
void LuaHashMap_SetValueStringAtIterator | ( | LuaHashMapIterator *restrict | hash_iterator, |
const char *restrict | value_string | ||
) |
Updates a value in the hash table pointed to by the iterator.
Updates a value in the hash table pointed to by the iterator. The iterator must be a valid iterator (i.e. the key it points to must already be in the hash table). This will not insert new key/value pairs into the hash table. string version
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to update the value to. |
value_string | The value for the key. NULL value strings are treated as strings with length=0 (""). |
void LuaHashMap_SetValueStringAtIteratorWithLength | ( | LuaHashMapIterator *restrict | hash_iterator, |
const char *restrict | value_string, | ||
size_t | value_string_length | ||
) |
Updates a value in the hash table pointed to by the iterator.
Updates a value in the hash table pointed to by the iterator. The iterator must be a valid iterator (i.e. the key it points to must already be in the hash table). This will not insert new key/value pairs into the hash table. string version This version allows you to specify the string length for each string if you already know it as an optimization.
hash_iterator | The LuaHashMapIterator instance pointing to the key/value pair you want to update the value to. |
value_string | The value for the key. NULL value strings are treated as strings with length=0 (""). |
value_string_length | The string length (strlen()) of the value string. (This does not count the \0 terminator character.) |