xhash.cc File Reference

implements a hashmap using STL containers More...

#include <jabberdlib.h>

Namespaces

namespace  xmppd

Functions

xht xhash_new (int prima)
void xhash_put (xht h, const char *key, void *val)
void * xhash_get (xht h, const char *key)
void * xhash_get_by_domain (xht h, const char *domain)
void xhash_zap (xht h, const char *key)
void xhash_free (xht h)
void xhash_walk (xht h, xhash_walker w, void *arg)
xmlnode xhash_to_xml (xht h)
xht xhash_from_xml (xmlnode hash, pool p)


Detailed Description

implements a hashmap using STL containers


Function Documentation

void xhash_free ( xht  h  ) 

free a xhash structure

Parameters:
h the xhash to free

xht xhash_from_xml ( xmlnode  hash,
pool  p 
)

convert the xmlnode representation of an xhash back to an xhash

Note:
the result has to be freed by the caller using xhash_free()
Parameters:
hash the xhash in xml notation
Returns:
xhash that has been created

References j_atoi(), NS_JABBERD_HASH, pstrdup(), xhash_free(), xhash_new(), xhash_put(), xmlnode_get_attrib_ns(), xmlnode_get_data(), xmlnode_get_list_item(), and xmlnode_get_tags().

Referenced by xdb_file_phandler().

void* xhash_get ( xht  h,
const char *  key 
)

retrive a value from a xhash

Parameters:
h the xhash to get the value from
key which value to get
Returns:
pointer to the value, NULL if no such key

void* xhash_get_by_domain ( xht  h,
const char *  domain 
)

retrive a value from a xhash ... considering the key to be a domain

In contrast to xhash_get() this function interprets the key as a domain and checks all higher level domains, if the key is not found in the hash. If now higher level domains are found either, the key '*' is tried.

Example: For the domain 'a.example.com' the following lookups are done in this order until there is the first match: 'a.example.com', 'example.com', 'com', and '*'.

Parameters:
h the xhash to get the value from
domain the domain which should be used as the key

References xmppd::xhash< value_type >::get_by_domain().

xht xhash_new ( int  prima  ) 

void xhash_put ( xht  h,
const char *  key,
void *  val 
)

put an entry in the xhash

Parameters:
h the hash to insert the entry in
key with which key the value should be entered
val the value, that should be entered

xmlnode xhash_to_xml ( xht  h  ) 

write the contents of an xhash to an xmlnode

Note:
the result has to be freed by the caller using xmlnode_free()
Parameters:
h the xhash to be converted
Returns:
xmlnode tree containing the content of the xhash

References NS_JABBERD_HASH, xhash_walk(), and xmlnode_new_tag_ns().

void xhash_walk ( xht  h,
xhash_walker  w,
void *  arg 
)

iterate over a xhash strucutre

Parameters:
h the xhash to iterave over
w which function should be called for each value
arg what to pass to the optional argument of the xhash_walker function

void xhash_zap ( xht  h,
const char *  key 
)

remove an entry from the xhash

Parameters:
h the xhash where a value should be removed
key the key of the value, that should be removed


Generated on Wed Sep 10 01:59:48 2008 for jabberd14 by  doxygen 1.5.5