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/.
30 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
31 #error "Only <glib.h> can be included directly."
34 #include <glib/gtypes.h>
35 #include <glib/glist.h>
39 typedef struct _GHashTable GHashTable;
41 typedef gboolean (*GHRFunc) (gpointer key,
45 typedef struct _GHashTableIter GHashTableIter;
47 struct _GHashTableIter
59 GHashTable* g_hash_table_new (GHashFunc hash_func,
60 GEqualFunc key_equal_func);
62 GHashTable* g_hash_table_new_full (GHashFunc hash_func,
63 GEqualFunc key_equal_func,
64 GDestroyNotify key_destroy_func,
65 GDestroyNotify value_destroy_func);
67 void g_hash_table_destroy (GHashTable *hash_table);
69 void g_hash_table_insert (GHashTable *hash_table,
73 void g_hash_table_replace (GHashTable *hash_table,
77 void g_hash_table_add (GHashTable *hash_table,
80 gboolean g_hash_table_remove (GHashTable *hash_table,
83 void g_hash_table_remove_all (GHashTable *hash_table);
85 gboolean g_hash_table_steal (GHashTable *hash_table,
88 void g_hash_table_steal_all (GHashTable *hash_table);
90 gpointer g_hash_table_lookup (GHashTable *hash_table,
93 gboolean g_hash_table_contains (GHashTable *hash_table,
96 gboolean g_hash_table_lookup_extended (GHashTable *hash_table,
97 gconstpointer lookup_key,
100 GLIB_AVAILABLE_IN_ALL
101 void g_hash_table_foreach (GHashTable *hash_table,
104 GLIB_AVAILABLE_IN_ALL
105 gpointer g_hash_table_find (GHashTable *hash_table,
108 GLIB_AVAILABLE_IN_ALL
109 guint g_hash_table_foreach_remove (GHashTable *hash_table,
112 GLIB_AVAILABLE_IN_ALL
113 guint g_hash_table_foreach_steal (GHashTable *hash_table,
116 GLIB_AVAILABLE_IN_ALL
117 guint g_hash_table_size (GHashTable *hash_table);
118 GLIB_AVAILABLE_IN_ALL
119 GList * g_hash_table_get_keys (GHashTable *hash_table);
120 GLIB_AVAILABLE_IN_ALL
121 GList * g_hash_table_get_values (GHashTable *hash_table);
122 GLIB_AVAILABLE_IN_2_40
123 gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table,
126 GLIB_AVAILABLE_IN_ALL
127 void g_hash_table_iter_init (GHashTableIter *iter,
128 GHashTable *hash_table);
129 GLIB_AVAILABLE_IN_ALL
130 gboolean g_hash_table_iter_next (GHashTableIter *iter,
133 GLIB_AVAILABLE_IN_ALL
134 GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter);
135 GLIB_AVAILABLE_IN_ALL
136 void g_hash_table_iter_remove (GHashTableIter *iter);
137 GLIB_AVAILABLE_IN_2_30
138 void g_hash_table_iter_replace (GHashTableIter *iter,
140 GLIB_AVAILABLE_IN_ALL
141 void g_hash_table_iter_steal (GHashTableIter *iter);
143 GLIB_AVAILABLE_IN_ALL
144 GHashTable* g_hash_table_ref (GHashTable *hash_table);
145 GLIB_AVAILABLE_IN_ALL
146 void g_hash_table_unref (GHashTable *hash_table);
148 #ifndef G_DISABLE_DEPRECATED
149 #define g_hash_table_freeze(hash_table) ((void)0)
150 #define g_hash_table_thaw(hash_table) ((void)0)
155 GLIB_AVAILABLE_IN_ALL
156 gboolean g_str_equal (gconstpointer v1,
158 GLIB_AVAILABLE_IN_ALL
159 guint g_str_hash (gconstpointer v);
161 GLIB_AVAILABLE_IN_ALL
162 gboolean g_int_equal (gconstpointer v1,
164 GLIB_AVAILABLE_IN_ALL
165 guint g_int_hash (gconstpointer v);
167 GLIB_AVAILABLE_IN_ALL
168 gboolean g_int64_equal (gconstpointer v1,
170 GLIB_AVAILABLE_IN_ALL
171 guint g_int64_hash (gconstpointer v);
173 GLIB_AVAILABLE_IN_ALL
174 gboolean g_double_equal (gconstpointer v1,
176 GLIB_AVAILABLE_IN_ALL
177 guint g_double_hash (gconstpointer v);
179 GLIB_AVAILABLE_IN_ALL
180 guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
181 GLIB_AVAILABLE_IN_ALL
182 gboolean g_direct_equal (gconstpointer v1,
183 gconstpointer v2) G_GNUC_CONST;
187 #endif /* __G_HASH_H__ */