libdom
Loading...
Searching...
No Matches
hashtable.h
Go to the documentation of this file.
1/*
2 * This file is part of libdom.
3 * Licensed under the MIT License,
4 * http://www.opensource.org/licenses/mit-license.php
5 * Copyright 2006 Rob Kendrick <rjek@rjek.com>
6 * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
7 */
8
9#ifndef dom_utils_hashtable_h_
10#define dom_utils_hashtable_h_
11
12#include <stdbool.h>
13#include <dom/functypes.h>
14
16
17typedef struct dom_hash_vtable {
18 uint32_t (*hash)(void *key, void *pw);
19 void *(*clone_key)(void *key, void *pw);
20 void (*destroy_key)(void *key, void *pw);
21 void *(*clone_value)(void *value, void *pw);
22 void (*destroy_value)(void *value, void *pw);
23 bool (*key_isequal)(void *key1, void *key2, void *pw);
25
26dom_hash_table *_dom_hash_create(unsigned int chains,
27 const dom_hash_vtable *vtable, void *pw);
30bool _dom_hash_add(dom_hash_table *ht, void *key, void *value,
31 bool replace);
32void *_dom_hash_get(dom_hash_table *ht, void *key);
33void *_dom_hash_del(dom_hash_table *ht, void *key);
34void *_dom_hash_iterate(dom_hash_table *ht, uintptr_t *c1, uintptr_t **c2);
36
37#endif
bool _dom_hash_add(dom_hash_table *ht, void *key, void *value, bool replace)
Definition hashtable.c:152
void _dom_hash_destroy(dom_hash_table *ht)
Definition hashtable.c:119
dom_hash_table * _dom_hash_clone(dom_hash_table *ht)
Definition hashtable.c:78
struct dom_hash_vtable dom_hash_vtable
dom_hash_table * _dom_hash_create(unsigned int chains, const dom_hash_vtable *vtable, void *pw)
Definition hashtable.c:50
uint32_t _dom_hash_get_length(dom_hash_table *ht)
Definition hashtable.c:295
void * _dom_hash_del(dom_hash_table *ht, void *key)
Definition hashtable.c:223
void * _dom_hash_get(dom_hash_table *ht, void *key)
Definition hashtable.c:197
void * _dom_hash_iterate(dom_hash_table *ht, uintptr_t *c1, uintptr_t **c2)
Definition hashtable.c:263
Definition hashtable.c:29
Definition hashtable.h:17
uint32_t(* hash)(void *key, void *pw)
Definition hashtable.h:18
void(* destroy_value)(void *value, void *pw)
Definition hashtable.h:22
bool(* key_isequal)(void *key1, void *key2, void *pw)
Definition hashtable.h:23
void(* destroy_key)(void *key, void *pw)
Definition hashtable.h:20