X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=vector%2Fitemkeyfun.h;h=7bbe62579d4313045aa1591ee44a27b692834010;hb=74eec6f62db4459232f95b5d39069b9b4ceeb830;hp=ee71ca5d9eae255ae218bda731fc27906eaa4202;hpb=b37fca0c4e84edd8f63b1d8ce51d94e4c59b294e;p=rrq%2Frrqmisc.git diff --git a/vector/itemkeyfun.h b/vector/itemkeyfun.h index ee71ca5..7bbe625 100644 --- a/vector/itemkeyfun.h +++ b/vector/itemkeyfun.h @@ -1,6 +1,8 @@ #ifndef itemkeyfun_H #define itemkeyfun_H +#include + /** * \struct itemkeyfun * @@ -13,9 +15,9 @@ * items that have that key. Different keys may yield the same * hashcode. */ -typedef struct _itemkeyfun { +typedef struct { -#define SELF struct _itemkeyfun *this +#define SELF void *this /** * This callback function should return the hashcode of a key. The * hashcode is used for indexing into the backing vector for @@ -48,6 +50,12 @@ typedef struct _itemkeyfun { */ void (*releasekey)(SELF,void *key); + /** + * This callback function writes a representation of an item into + * a character buffer. + */ + int (*tostring)(SELF,void *item,char *buffer,int limit); + #undef SELF } itemkeyfun;