1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
34 typedef struct _GHashTable GHashTable;
36 typedef gboolean (*GHRFunc) (gpointer key,
42 GHashTable* g_hash_table_new (GHashFunc hash_func,
43 GEqualFunc key_equal_func);
44 void g_hash_table_destroy (GHashTable *hash_table);
45 void g_hash_table_insert (GHashTable *hash_table,
48 gboolean g_hash_table_remove (GHashTable *hash_table,
50 gpointer g_hash_table_lookup (GHashTable *hash_table,
52 gboolean g_hash_table_lookup_extended(GHashTable *hash_table,
53 gconstpointer lookup_key,
56 void g_hash_table_foreach (GHashTable *hash_table,
59 guint g_hash_table_foreach_remove (GHashTable *hash_table,
62 guint g_hash_table_size (GHashTable *hash_table);
64 /* The following two functions are deprecated and will be removed in
65 * the next major release. They do no good. */
66 void g_hash_table_freeze (GHashTable *hash_table);
67 void g_hash_table_thaw (GHashTable *hash_table);
71 gboolean g_str_equal (gconstpointer v,
73 guint g_str_hash (gconstpointer v);
75 gboolean g_int_equal (gconstpointer v,
76 gconstpointer v2) G_GNUC_CONST;
77 guint g_int_hash (gconstpointer v) G_GNUC_CONST;
79 /* This "hash" function will just return the key's adress as an
80 * unsigned integer. Useful for hashing on plain adresses or
81 * simple integer values.
82 * passing NULL into g_hash_table_new() as GHashFunc has the
83 * same effect as passing g_direct_hash().
85 guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
86 gboolean g_direct_equal (gconstpointer v,
87 gconstpointer v2) G_GNUC_CONST;
91 #endif /* __G_HASH_H__ */