Add some more cases to the app-id unit tests
[glib.git] / glib / ghash.h
blobd353088d15475be23bb43928f3ff502b1fdb678c
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, see <http://www.gnu.org/licenses/>.
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/.
25 #ifndef __G_HASH_H__
26 #define __G_HASH_H__
28 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
29 #error "Only <glib.h> can be included directly."
30 #endif
32 #include <glib/gtypes.h>
33 #include <glib/glist.h>
35 G_BEGIN_DECLS
37 typedef struct _GHashTable GHashTable;
39 typedef gboolean (*GHRFunc) (gpointer key,
40 gpointer value,
41 gpointer user_data);
43 typedef struct _GHashTableIter GHashTableIter;
45 struct _GHashTableIter
47 /*< private >*/
48 gpointer dummy1;
49 gpointer dummy2;
50 gpointer dummy3;
51 int dummy4;
52 gboolean dummy5;
53 gpointer dummy6;
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_ALL
65 void g_hash_table_destroy (GHashTable *hash_table);
66 GLIB_AVAILABLE_IN_ALL
67 gboolean g_hash_table_insert (GHashTable *hash_table,
68 gpointer key,
69 gpointer value);
70 GLIB_AVAILABLE_IN_ALL
71 gboolean g_hash_table_replace (GHashTable *hash_table,
72 gpointer key,
73 gpointer value);
74 GLIB_AVAILABLE_IN_ALL
75 gboolean g_hash_table_add (GHashTable *hash_table,
76 gpointer key);
77 GLIB_AVAILABLE_IN_ALL
78 gboolean g_hash_table_remove (GHashTable *hash_table,
79 gconstpointer key);
80 GLIB_AVAILABLE_IN_ALL
81 void g_hash_table_remove_all (GHashTable *hash_table);
82 GLIB_AVAILABLE_IN_ALL
83 gboolean g_hash_table_steal (GHashTable *hash_table,
84 gconstpointer key);
85 GLIB_AVAILABLE_IN_ALL
86 void g_hash_table_steal_all (GHashTable *hash_table);
87 GLIB_AVAILABLE_IN_ALL
88 gpointer g_hash_table_lookup (GHashTable *hash_table,
89 gconstpointer key);
90 GLIB_AVAILABLE_IN_ALL
91 gboolean g_hash_table_contains (GHashTable *hash_table,
92 gconstpointer key);
93 GLIB_AVAILABLE_IN_ALL
94 gboolean g_hash_table_lookup_extended (GHashTable *hash_table,
95 gconstpointer lookup_key,
96 gpointer *orig_key,
97 gpointer *value);
98 GLIB_AVAILABLE_IN_ALL
99 void g_hash_table_foreach (GHashTable *hash_table,
100 GHFunc func,
101 gpointer user_data);
102 GLIB_AVAILABLE_IN_ALL
103 gpointer g_hash_table_find (GHashTable *hash_table,
104 GHRFunc predicate,
105 gpointer user_data);
106 GLIB_AVAILABLE_IN_ALL
107 guint g_hash_table_foreach_remove (GHashTable *hash_table,
108 GHRFunc func,
109 gpointer user_data);
110 GLIB_AVAILABLE_IN_ALL
111 guint g_hash_table_foreach_steal (GHashTable *hash_table,
112 GHRFunc func,
113 gpointer user_data);
114 GLIB_AVAILABLE_IN_ALL
115 guint g_hash_table_size (GHashTable *hash_table);
116 GLIB_AVAILABLE_IN_ALL
117 GList * g_hash_table_get_keys (GHashTable *hash_table);
118 GLIB_AVAILABLE_IN_ALL
119 GList * g_hash_table_get_values (GHashTable *hash_table);
120 GLIB_AVAILABLE_IN_2_40
121 gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table,
122 guint *length);
124 GLIB_AVAILABLE_IN_ALL
125 void g_hash_table_iter_init (GHashTableIter *iter,
126 GHashTable *hash_table);
127 GLIB_AVAILABLE_IN_ALL
128 gboolean g_hash_table_iter_next (GHashTableIter *iter,
129 gpointer *key,
130 gpointer *value);
131 GLIB_AVAILABLE_IN_ALL
132 GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter);
133 GLIB_AVAILABLE_IN_ALL
134 void g_hash_table_iter_remove (GHashTableIter *iter);
135 GLIB_AVAILABLE_IN_2_30
136 void g_hash_table_iter_replace (GHashTableIter *iter,
137 gpointer value);
138 GLIB_AVAILABLE_IN_ALL
139 void g_hash_table_iter_steal (GHashTableIter *iter);
141 GLIB_AVAILABLE_IN_ALL
142 GHashTable* g_hash_table_ref (GHashTable *hash_table);
143 GLIB_AVAILABLE_IN_ALL
144 void g_hash_table_unref (GHashTable *hash_table);
146 #ifndef G_DISABLE_DEPRECATED
147 #define g_hash_table_freeze(hash_table) ((void)0)
148 #define g_hash_table_thaw(hash_table) ((void)0)
149 #endif
151 /* Hash Functions
153 GLIB_AVAILABLE_IN_ALL
154 gboolean g_str_equal (gconstpointer v1,
155 gconstpointer v2);
156 GLIB_AVAILABLE_IN_ALL
157 guint g_str_hash (gconstpointer v);
159 GLIB_AVAILABLE_IN_ALL
160 gboolean g_int_equal (gconstpointer v1,
161 gconstpointer v2);
162 GLIB_AVAILABLE_IN_ALL
163 guint g_int_hash (gconstpointer v);
165 GLIB_AVAILABLE_IN_ALL
166 gboolean g_int64_equal (gconstpointer v1,
167 gconstpointer v2);
168 GLIB_AVAILABLE_IN_ALL
169 guint g_int64_hash (gconstpointer v);
171 GLIB_AVAILABLE_IN_ALL
172 gboolean g_double_equal (gconstpointer v1,
173 gconstpointer v2);
174 GLIB_AVAILABLE_IN_ALL
175 guint g_double_hash (gconstpointer v);
177 GLIB_AVAILABLE_IN_ALL
178 guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
179 GLIB_AVAILABLE_IN_ALL
180 gboolean g_direct_equal (gconstpointer v1,
181 gconstpointer v2) G_GNUC_CONST;
183 G_END_DECLS
185 #endif /* __G_HASH_H__ */