#ifndef	V_HASH_H
#define	V_HASH_H

/*
 * Value types
 */
typedef enum
{
	hash_type_int    = 0,
	hash_type_float  = 1,
	hash_type_string	= 2,
	hash_type_binary = 3,
	hash_type_callback,	/* the only data which can't be saved in file */
	hash_type_max
}	hash_type_t;

vhandle_t	V_GLOBAL	hashCreateEx(u32_t hashsize);
vhandle_t	V_GLOBAL	hashCreate(void);

vboolean	V_GLOBAL	hashSetInt(vhandle_t handle,char *key,s32_t value);
vboolean	V_GLOBAL	hashSetFloat(vhandle_t handle,char *key,vec_t value);
vboolean	V_GLOBAL	hashSetString(vhandle_t handle,char *key,char *value);
vboolean	V_GLOBAL	hashSetBinary(vhandle_t handle,char *key,void *value,u32_t len);
vboolean	V_GLOBAL	hashSetCallback(vhandle_t handle,char *key,void (V_CALL *callback)(void *arg));

vboolean	V_GLOBAL	hashGetKeyType(vhandle_t handle,char *key,hash_type_t *type_ret);

vboolean	V_GLOBAL	hashRemoveKey(vhandle_t handle,char *key);

vboolean	V_GLOBAL	hashGetString(vhandle_t handle,char *key,char *dest,u32_t dest_len);
char_p		V_GLOBAL	hashStringForKey(vhandle_t handle,char *key,char *def);
vboolean	V_GLOBAL	hashGetInt(vhandle_t handle,char *key,s32_t *dest);
s32_t		V_GLOBAL	hashIntForKey(vhandle_t handle,char *key,s32_t def);
vboolean	V_GLOBAL	hashGetFloat(vhandle_t handle,char *key,vec_t *dest);
vec_t		V_GLOBAL	hashFloatForKey(vhandle_t handle,char *key,vec_t def);

void_p		V_GLOBAL	hashBinaryForKey(vhandle_t handle,char *key,void_p def,u32_t *len_ret);
vboolean	V_GLOBAL	hashCall(vhandle_t handle,char *key,void *arg);
void		V_GLOBAL	hashDestroy(vhandle_t handle);
void		V_GLOBAL	hashSaveToStream(vhandle_t handle,vhandle_t outstream);
void		V_GLOBAL	hashSave(vhandle_t handle,char *filename);

#endif	/* V_HASH_H */
