#include <GHashTable.h>
Public Member Functions | |
GHashTbl (int size=0, bool is_case=true, Key nullkey=0, Value nullvalue=(Value) 0) | |
ructs the hash table | |
virtual | ~GHashTbl () |
Deletes the hash table removing all contents from memory. | |
GHashTbl< Key, Value > & | operator= (GHashTbl< Key, Value > &c) |
Copy operator. | |
int64 | GetSize () |
Gets the total available entries. | |
bool | SetSize (int64 s) |
Sets the total available entries. | |
bool | GetStringPool () |
Gets the string pooling setting. | |
void | SetStringPool (bool b) |
bool | IsCase () |
Returns whether the keys are case sensitive. | |
void | IsCase (bool c) |
Sets whether the keys are case sensitive. | |
bool | IsOk () |
Returns true if the object appears to be valid. | |
int | Length () |
Gets the number of entries used. | |
bool | Add (Key k, Value v) |
Adds a value under a given key. | |
bool | Delete (Key k) |
Deletes a value at 'key'. | |
Value | Find (Key k) |
Returns the value at 'key'. | |
Value | First (Key *k=0) |
Returns the first value. | |
Value | Current (Key *k=0) |
Returns the current value. | |
Value | Next (Key *k=0) |
Returns the next value. | |
void | Empty () |
Removes all key/value pairs from memory. | |
int64 | Sizeof () |
Returns the amount of memory in use by the hash table. | |
void | DeleteObjects () |
Deletes values as objects. | |
void | DeleteArrays () |
Deletes values as arrays. |
GHashTbl< Key, Value >::GHashTbl | ( | int | size = 0 , |
|
bool | is_case = true , |
|||
Key | nullkey = 0 , |
|||
Value | nullvalue = (Value)0 | |||
) | [inline] |
ructs the hash table
size | Sets the initial table size. Should be 2x your data set. |
is_case | Sets the case sensitivity of the keys. |
nullkey | The default empty value |
nullvalue | The default empty value |
void GHashTbl< Key, Value >::SetStringPool | ( | bool | b | ) | [inline] |
Sets the string pooling setting. String pooling lowers the number of memory allocs/frees but will waste memory if you delete keys. Good for fairly large static tables.
(only works with using Key='char*')
bool GHashTbl< Key, Value >::Add | ( | Key | k, | |
Value | v | |||
) | [inline] |
Adds a value under a given key.
k | The key to insert the value under |
v | The value to insert |
Referenced by GCompilerPriv::DoStruct(), GDateTime::GetDaylightSavingsInfo(), GList::OnItemSelect(), GHashTbl< unsigned short *, GTypeDef * >::operator=(), and GHashTbl< unsigned short *, GTypeDef * >::SetSize().
bool GHashTbl< Key, Value >::Delete | ( | Key | k | ) | [inline] |
Deletes a value at 'key'.
k | The key of the value to delete |