1 | /* GLIB - Library of useful routines for C programming |
2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
3 | * |
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.1 of the License, or (at your option) any later version. |
8 | * |
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. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
16 | */ |
17 | |
18 | /* |
19 | * Modified by the GLib Team and others 1997-2000. See the AUTHORS |
20 | * file for a list of people on the GLib Team. See the ChangeLog |
21 | * files for a list of changes. These files are distributed with |
22 | * GLib at ftp://ftp.gtk.org/pub/gtk/. |
23 | */ |
24 | |
25 | #ifndef __G_HASH_H__ |
26 | #define __G_HASH_H__ |
27 | |
28 | #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) |
29 | #error "Only <glib.h> can be included directly." |
30 | #endif |
31 | |
32 | #include <glib/gtypes.h> |
33 | #include <glib/glist.h> |
34 | |
35 | G_BEGIN_DECLS |
36 | |
37 | typedef struct _GHashTable GHashTable; |
38 | |
39 | typedef gboolean (*GHRFunc) (gpointer key, |
40 | gpointer value, |
41 | gpointer user_data); |
42 | |
43 | typedef struct _GHashTableIter GHashTableIter; |
44 | |
45 | struct _GHashTableIter |
46 | { |
47 | /*< private >*/ |
48 | gpointer dummy1; |
49 | gpointer dummy2; |
50 | gpointer dummy3; |
51 | int dummy4; |
52 | gboolean dummy5; |
53 | gpointer dummy6; |
54 | }; |
55 | |
56 | GLIB_AVAILABLE_IN_ALL |
57 | GHashTable* g_hash_table_new (GHashFunc hash_func, |
58 | GEqualFunc key_equal_func); |
59 | GLIB_AVAILABLE_IN_ALL |
60 | GHashTable* g_hash_table_new_full (GHashFunc hash_func, |
61 | GEqualFunc key_equal_func, |
62 | GDestroyNotify key_destroy_func, |
63 | GDestroyNotify value_destroy_func); |
64 | GLIB_AVAILABLE_IN_2_72 |
65 | GHashTable *g_hash_table_new_similar (GHashTable *other_hash_table); |
66 | GLIB_AVAILABLE_IN_ALL |
67 | void g_hash_table_destroy (GHashTable *hash_table); |
68 | GLIB_AVAILABLE_IN_ALL |
69 | gboolean g_hash_table_insert (GHashTable *hash_table, |
70 | gpointer key, |
71 | gpointer value); |
72 | GLIB_AVAILABLE_IN_ALL |
73 | gboolean g_hash_table_replace (GHashTable *hash_table, |
74 | gpointer key, |
75 | gpointer value); |
76 | GLIB_AVAILABLE_IN_ALL |
77 | gboolean g_hash_table_add (GHashTable *hash_table, |
78 | gpointer key); |
79 | GLIB_AVAILABLE_IN_ALL |
80 | gboolean g_hash_table_remove (GHashTable *hash_table, |
81 | gconstpointer key); |
82 | GLIB_AVAILABLE_IN_ALL |
83 | void g_hash_table_remove_all (GHashTable *hash_table); |
84 | GLIB_AVAILABLE_IN_ALL |
85 | gboolean g_hash_table_steal (GHashTable *hash_table, |
86 | gconstpointer key); |
87 | GLIB_AVAILABLE_IN_2_58 |
88 | gboolean g_hash_table_steal_extended (GHashTable *hash_table, |
89 | gconstpointer lookup_key, |
90 | gpointer *stolen_key, |
91 | gpointer *stolen_value); |
92 | GLIB_AVAILABLE_IN_ALL |
93 | void g_hash_table_steal_all (GHashTable *hash_table); |
94 | GLIB_AVAILABLE_IN_ALL |
95 | gpointer g_hash_table_lookup (GHashTable *hash_table, |
96 | gconstpointer key); |
97 | GLIB_AVAILABLE_IN_ALL |
98 | gboolean g_hash_table_contains (GHashTable *hash_table, |
99 | gconstpointer key); |
100 | GLIB_AVAILABLE_IN_ALL |
101 | gboolean g_hash_table_lookup_extended (GHashTable *hash_table, |
102 | gconstpointer lookup_key, |
103 | gpointer *orig_key, |
104 | gpointer *value); |
105 | GLIB_AVAILABLE_IN_ALL |
106 | void g_hash_table_foreach (GHashTable *hash_table, |
107 | GHFunc func, |
108 | gpointer user_data); |
109 | GLIB_AVAILABLE_IN_ALL |
110 | gpointer g_hash_table_find (GHashTable *hash_table, |
111 | GHRFunc predicate, |
112 | gpointer user_data); |
113 | GLIB_AVAILABLE_IN_ALL |
114 | guint g_hash_table_foreach_remove (GHashTable *hash_table, |
115 | GHRFunc func, |
116 | gpointer user_data); |
117 | GLIB_AVAILABLE_IN_ALL |
118 | guint g_hash_table_foreach_steal (GHashTable *hash_table, |
119 | GHRFunc func, |
120 | gpointer user_data); |
121 | GLIB_AVAILABLE_IN_ALL |
122 | guint g_hash_table_size (GHashTable *hash_table); |
123 | GLIB_AVAILABLE_IN_ALL |
124 | GList * g_hash_table_get_keys (GHashTable *hash_table); |
125 | GLIB_AVAILABLE_IN_ALL |
126 | GList * g_hash_table_get_values (GHashTable *hash_table); |
127 | GLIB_AVAILABLE_IN_2_40 |
128 | gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table, |
129 | guint *length); |
130 | |
131 | GLIB_AVAILABLE_IN_ALL |
132 | void g_hash_table_iter_init (GHashTableIter *iter, |
133 | GHashTable *hash_table); |
134 | GLIB_AVAILABLE_IN_ALL |
135 | gboolean g_hash_table_iter_next (GHashTableIter *iter, |
136 | gpointer *key, |
137 | gpointer *value); |
138 | GLIB_AVAILABLE_IN_ALL |
139 | GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter); |
140 | GLIB_AVAILABLE_IN_ALL |
141 | void g_hash_table_iter_remove (GHashTableIter *iter); |
142 | GLIB_AVAILABLE_IN_2_30 |
143 | void g_hash_table_iter_replace (GHashTableIter *iter, |
144 | gpointer value); |
145 | GLIB_AVAILABLE_IN_ALL |
146 | void g_hash_table_iter_steal (GHashTableIter *iter); |
147 | |
148 | GLIB_AVAILABLE_IN_ALL |
149 | GHashTable* g_hash_table_ref (GHashTable *hash_table); |
150 | GLIB_AVAILABLE_IN_ALL |
151 | void g_hash_table_unref (GHashTable *hash_table); |
152 | |
153 | #define g_hash_table_freeze(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 |
154 | #define g_hash_table_thaw(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 |
155 | |
156 | /* Hash Functions |
157 | */ |
158 | GLIB_AVAILABLE_IN_ALL |
159 | gboolean g_str_equal (gconstpointer v1, |
160 | gconstpointer v2); |
161 | GLIB_AVAILABLE_IN_ALL |
162 | guint g_str_hash (gconstpointer v); |
163 | |
164 | GLIB_AVAILABLE_IN_ALL |
165 | gboolean g_int_equal (gconstpointer v1, |
166 | gconstpointer v2); |
167 | GLIB_AVAILABLE_IN_ALL |
168 | guint g_int_hash (gconstpointer v); |
169 | |
170 | GLIB_AVAILABLE_IN_ALL |
171 | gboolean g_int64_equal (gconstpointer v1, |
172 | gconstpointer v2); |
173 | GLIB_AVAILABLE_IN_ALL |
174 | guint g_int64_hash (gconstpointer v); |
175 | |
176 | GLIB_AVAILABLE_IN_ALL |
177 | gboolean g_double_equal (gconstpointer v1, |
178 | gconstpointer v2); |
179 | GLIB_AVAILABLE_IN_ALL |
180 | guint g_double_hash (gconstpointer v); |
181 | |
182 | GLIB_AVAILABLE_IN_ALL |
183 | guint g_direct_hash (gconstpointer v) G_GNUC_CONST; |
184 | GLIB_AVAILABLE_IN_ALL |
185 | gboolean g_direct_equal (gconstpointer v1, |
186 | gconstpointer v2) G_GNUC_CONST; |
187 | |
188 | G_END_DECLS |
189 | |
190 | #endif /* __G_HASH_H__ */ |
191 | |