/*  libhrel - Holyrel library
 *
 *  Copyright (C) 2005 Chong Kai Xiong <descender@phreaker.net>
 *
 *  HHashTable is an adaptation of GHashTable to allow users to pass
 *  custom data to the hash function and key comparator.
 */

/* GLIB - Library of useful routines for C programming
 * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/*
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the GLib Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GLib at ftp://ftp.gtk.org/pub/gtk/.
 */

#ifndef H_HASH_TABLE_H
#define H_HASH_TABLE_H

#include <glib.h>

G_BEGIN_DECLS

typedef struct _HHashTable  HHashTable;

typedef gboolean (*HHFunc)     (gpointer      key,
                                gpointer      value,
                                gpointer      user_data);
typedef guint    (*HHashFunc)  (gconstpointer key,
                                gpointer      user_data);
typedef guint    (*HEqualFunc) (gconstpointer key1,
                                gconstpointer key2,
                                gpointer      user_data);

HHashTable *h_hash_table_new      (HHashFunc       hash_func,
                                   gpointer        hash_func_data,
                                   HEqualFunc      key_equal_func,
                                   gpointer        key_equal_func_data);

HHashTable *h_hash_table_new_full (HHashFunc       hash_func,
                                   gpointer        hash_func_data,
                                   HEqualFunc      key_equal_func,
                                   gpointer        key_equal_func_data,
                                   GDestroyNotify  key_destroy_func,
                                   GDestroyNotify  value_destroy_func);

void        h_hash_table_destroy  (HHashTable     *hash_table);

void        h_hash_table_insert   (HHashTable     *hash_table,
                                   gpointer        key,
                                   gpointer        value);

gboolean    h_hash_table_remove   (HHashTable     *hash_table,
                                   gconstpointer   key);

gpointer    h_hash_table_lookup   (HHashTable     *hash_table,
                                   gconstpointer   key);

void        h_hash_table_foreach  (HHashTable     *hash_table,
                                   HHFunc          func,
                                   gpointer        user_data);

guint       h_hash_table_size     (HHashTable     *hash_table);

G_END_DECLS

#endif /* #ifndef H_HASH_TABLE_H */
