2 * Trampoline functions for the ItemKeyFun callbacks.
6 #include <ItemKeyFun.h>
9 * \brief Trampoline function for the ItemKeyFun.hashcode callback.
11 * The default is to use the pointer itself.
13 unsigned long ItemKeyFun_hashcode(void *this,void *key) {
14 ItemKeyFun *type = (ItemKeyFun*) this;
16 return type->hashcode? type->hashcode( type, key ) : (unsigned long) key;
20 * \brief Trampoline function for the ItemKeyFun.itemkey callback.
22 void *ItemKeyFun_itemkey(void *this,void *item) {
23 ItemKeyFun *type = (ItemKeyFun*) this;
24 return ( type && type->itemkey )? type->itemkey( type, item ) : item;
28 * \brief Trampoline function for the ItemKeyFun.haskey callback.
30 int ItemKeyFun_haskey(void *this,void *item,void *key) {
31 ItemKeyFun *type = (ItemKeyFun*) this;
32 if ( type && type->haskey ) {
33 return type->haskey( this, item, key );
35 void *ikey = ItemKeyFun_itemkey( this, item );
37 ItemKeyFun_releasekey( this, ikey );
42 * \brief Trampoline function for the ItemKeyFun.releasekey callback.
44 void ItemKeyFun_releasekey(void *this,void *key) {
45 ItemKeyFun *type = (ItemKeyFun*) this;
46 if( type && type->releasekey ) {
47 type->releasekey( type, key );
52 * \brief Trampoline function for the ItemKeyFun.tostring callback.
54 int ItemKeyFun_tostring(void *this,void *item,char *buffer,int limit) {
55 ItemKeyFun *type = (ItemKeyFun*) this;
56 if( type && type->tostring ) {
57 return type->tostring( type, item, buffer, limit );
59 void *key = ItemKeyFun_itemkey( this, item );
60 int n = snprintf( buffer, limit, "{%p/%p@%p}", type, key, item );
61 ItemKeyFun_releasekey( this, key );