Functions | |
Q_HASHTBL * | qHashtblInit (int max) |
Initialize dynamic-hash table. | |
bool | qHashtblFree (Q_HASHTBL *tbl) |
De-allocate hash table. | |
bool | qHashtblPut (Q_HASHTBL *tbl, const char *key, const void *value, int size) |
Put object into hash table. | |
bool | qHashtblPutStr (Q_HASHTBL *tbl, const char *key, const char *value) |
Put string into hash table. | |
bool | qHashtblPutInt (Q_HASHTBL *tbl, const char *key, const int value) |
Put integer into hash table. | |
void * | qHashtblGet (Q_HASHTBL *tbl, const char *key, int *size) |
Get object from hash table. | |
char * | qHashtblGetStr (Q_HASHTBL *tbl, const char *key) |
Get string from hash table. | |
int | qHashtblGetInt (Q_HASHTBL *tbl, const char *key) |
Get integer from hash table. | |
const char * | qHashtblGetFirstKey (Q_HASHTBL *tbl, int *idx) |
Get first key name. | |
const char * | qHashtblGetNextKey (Q_HASHTBL *tbl, int *idx) |
Get next key name. | |
bool | qHashtblRemove (Q_HASHTBL *tbl, const char *key) |
Remove key from hash table. | |
bool | qHashtblPrint (Q_HASHTBL *tbl, FILE *out, bool showvalue) |
Print hash table for debugging purpose. | |
bool | qHashtblStatus (Q_HASHTBL *tbl, int *used, int *max) |
Get hash table internal status. |
Q_HASHTBL* qHashtblInit | ( | int | max | ) |
Initialize dynamic-hash table.
max | a number of maximum size of Q_HASHARR |
Q_HASHTBL *hashtbl = qHashtblInit(1000); qHashtblFree(hashtbl);
bool qHashtblFree | ( | Q_HASHTBL * | tbl | ) |
De-allocate hash table.
tbl | a pointer of Q_HASHTBL |
bool qHashtblPut | ( | Q_HASHTBL * | tbl, | |
const char * | key, | |||
const void * | value, | |||
int | size | |||
) |
Put object into hash table.
tbl | a pointer of Q_HASHTBL | |
key | key string | |
value | value object data | |
size | size of value |
bool qHashtblPutStr | ( | Q_HASHTBL * | tbl, | |
const char * | key, | |||
const char * | value | |||
) |
Put string into hash table.
tbl | a pointer of Q_HASHTBL | |
key | key string | |
value | value string |
bool qHashtblPutInt | ( | Q_HASHTBL * | tbl, | |
const char * | key, | |||
const int | value | |||
) |
Put integer into hash table.
tbl | a pointer of Q_HASHTBL | |
key | key string | |
value | value integer |
void* qHashtblGet | ( | Q_HASHTBL * | tbl, | |
const char * | key, | |||
int * | size | |||
) |
Get object from hash table.
tbl | a pointer of Q_HASHTBL | |
key | key string | |
size | if not NULL, oject size will be stored |
char* qHashtblGetStr | ( | Q_HASHTBL * | tbl, | |
const char * | key | |||
) |
Get string from hash table.
tbl | a pointer of Q_HASHTBL | |
key | key string |
int qHashtblGetInt | ( | Q_HASHTBL * | tbl, | |
const char * | key | |||
) |
Get integer from hash table.
tbl | a pointer of Q_HASHARR | |
key | key string |
const char* qHashtblGetFirstKey | ( | Q_HASHTBL * | tbl, | |
int * | idx | |||
) |
Get first key name.
tbl | a pointer of Q_HASHTBL | |
idx | index pointer |
char *key; int idx; for(key = qHashtblGetFirstKey(tbl, &idx); key != NULL; key = qHashtblGetNextKey(tbl, &idx) { char *value = qHashtblGetStr(tbl, key); if(value != NULL) free(value); }
const char* qHashtblGetNextKey | ( | Q_HASHTBL * | tbl, | |
int * | idx | |||
) |
Get next key name.
tbl | a pointer of Q_HASHTBL | |
idx | index pointer |
bool qHashtblRemove | ( | Q_HASHTBL * | tbl, | |
const char * | key | |||
) |
Remove key from hash table.
tbl | a pointer of Q_HASHTBL | |
key | key string |
bool qHashtblPrint | ( | Q_HASHTBL * | tbl, | |
FILE * | out, | |||
bool | showvalue | |||
) |
Print hash table for debugging purpose.
tbl | a pointer of Q_HASHTBL | |
out | output stream | |
showvalue | print out value if set to true |
bool qHashtblStatus | ( | Q_HASHTBL * | tbl, | |
int * | used, | |||
int * | max | |||
) |
Get hash table internal status.
tbl | a pointer of Q_HASHARR | |
used | if not NULL, a number of used keys will be stored | |
max | if not NULL, the maximum usable number of keys will be stored |
[Home] [About] [Examples] [Changes] [Download] [SVN Repository] [Install] [Reference] |