Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  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.  
  15. typedef struct dom_hash_table dom_hash_table;
  16.  
  17. typedef 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);
  24. } dom_hash_vtable;
  25.  
  26. dom_hash_table *_dom_hash_create(unsigned int chains,
  27.                 const dom_hash_vtable *vtable, void *pw);
  28. dom_hash_table *_dom_hash_clone(dom_hash_table *ht);
  29. void _dom_hash_destroy(dom_hash_table *ht);
  30. bool _dom_hash_add(dom_hash_table *ht, void *key, void *value,
  31.                 bool replace);
  32. void *_dom_hash_get(dom_hash_table *ht, void *key);
  33. void *_dom_hash_del(dom_hash_table *ht, void *key);
  34. void *_dom_hash_iterate(dom_hash_table *ht, unsigned long int *c1, unsigned long int **c2);
  35. uint32_t _dom_hash_get_length(dom_hash_table *ht);
  36.  
  37. #endif
  38.