/Users/maurits/Documents/studie/afstuderen/biosphere/common/dict.c File Reference

#include "dict.h"
#include "str.h"
#include <apr_strings.h>
#include <assert.h>

Include dependency graph for dict.c:

Go to the source code of this file.

Functions

bs_dictnew_dict (apr_pool_t *mp)
void delete_dict (bs_dict *dict)
void * dict_get (const bs_dict *dict, const char *key)
bs_bool dict_add (bs_dict *dict, const char *key, void *data)
void dict_remove (bs_dict *dict, const char *key)
unsigned dict_size (const bs_dict *dict)


Function Documentation

void delete_dict ( bs_dict dict  ) 

Delete the dict object and its internal data structures. The data items it refers to is not deleted.

Parameters:
dict The dict to delete

Definition at line 63 of file dict.c.

References bs_dict::pool.

bs_bool dict_add ( bs_dict dict,
const char *  key,
void *  data 
)

Add a data item to the dict.

Parameters:
dict The dict to add the item to
key The key to use for the item
data The data to add
Returns:
True iff the addition was successfull.

Definition at line 89 of file dict.c.

References bs_dict::bucket, bs_dict_item::data, FALSE, bs_dict_item::key, list_index(), list_size(), new_list(), bs_dict::pool, bs_dict::size, streq(), and TRUE.

Here is the call graph for this function:

void* dict_get ( const bs_dict dict,
const char *  key 
)

Retrieve the first data item from the dict that matches the given the key.

Parameters:
dict The dict to retrieve from
key The key to the data item
Returns:
The item.

Definition at line 71 of file dict.c.

References bs_dict::bucket, list_index(), list_size(), and streq().

Here is the call graph for this function:

void dict_remove ( bs_dict dict,
const char *  key 
)

Remove the first data item in the dict that matches the key.

Parameters:
dict The dict to remove the item from
key The key to use

Definition at line 113 of file dict.c.

References bs_dict::bucket, list_index(), list_remove(), list_size(), bs_dict::size, and streq().

Here is the call graph for this function:

unsigned dict_size ( const bs_dict dict  )  [inline]

Returns the number of data items in the dict.

Parameters:
dict The dict to get the count for
Returns:
The size of the dict.

Definition at line 134 of file dict.c.

References bs_dict::size.

bs_dict* new_dict ( apr_pool_t *  mp  ) 

Allocate a new dict object from the pool.

Parameters:
mp Memory pool to allocate from
Returns:
The new dict object.

Definition at line 43 of file dict.c.

References pool, bs_dict::pool, runtestsuite::rv, and bs_dict::size.


Generated on Tue Jul 17 09:50:53 2007 for Bio-SPHERE by  doxygen 1.5.1