Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / gnulib-lib / glib / ghash.in.h
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 General Public
6  * License as published by the Free Software Foundation; either
7  * version 3 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  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU 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.
18  */
19
20 /*
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/. 
25  */
26
27 /*
28  * Modified by Bruno Haible for use as a gnulib module.
29  */
30
31 #ifndef __G_HASH_H__
32 #define __G_HASH_H__
33
34 #include <glib/gtypes.h>
35
36 G_BEGIN_DECLS
37
38 typedef struct _GHashTable  GHashTable;
39
40 typedef gboolean  (*GHRFunc)  (gpointer  key,
41                                gpointer  value,
42                                gpointer  user_data);
43
44 /* Hash tables
45  */
46 GHashTable* g_hash_table_new               (GHashFunc       hash_func,
47                                             GEqualFunc      key_equal_func);
48 GHashTable* g_hash_table_new_full          (GHashFunc       hash_func,
49                                             GEqualFunc      key_equal_func,
50                                             GDestroyNotify  key_destroy_func,
51                                             GDestroyNotify  value_destroy_func);
52 #if 0
53 void        g_hash_table_destroy           (GHashTable     *hash_table);
54 #endif
55 void        g_hash_table_insert            (GHashTable     *hash_table,
56                                             gpointer        key,
57                                             gpointer        value);
58 #if 0
59 void        g_hash_table_replace           (GHashTable     *hash_table,
60                                             gpointer        key,
61                                             gpointer        value);
62 gboolean    g_hash_table_remove            (GHashTable     *hash_table,
63                                             gconstpointer   key);
64 void        g_hash_table_remove_all        (GHashTable     *hash_table);
65 gboolean    g_hash_table_steal             (GHashTable     *hash_table,
66                                             gconstpointer   key);
67 void        g_hash_table_steal_all         (GHashTable     *hash_table);
68 #endif
69 gpointer    g_hash_table_lookup            (GHashTable     *hash_table,
70                                             gconstpointer   key);
71 #if 0
72 gboolean    g_hash_table_lookup_extended   (GHashTable     *hash_table,
73                                             gconstpointer   lookup_key,
74                                             gpointer       *orig_key,
75                                             gpointer       *value);
76 void        g_hash_table_foreach           (GHashTable     *hash_table,
77                                             GHFunc          func,
78                                             gpointer        user_data);
79 gpointer    g_hash_table_find              (GHashTable     *hash_table,
80                                             GHRFunc         predicate,
81                                             gpointer        user_data);
82 guint       g_hash_table_foreach_remove    (GHashTable     *hash_table,
83                                             GHRFunc         func,
84                                             gpointer        user_data);
85 guint       g_hash_table_foreach_steal     (GHashTable     *hash_table,
86                                             GHRFunc         func,
87                                             gpointer        user_data);
88 guint       g_hash_table_size              (GHashTable     *hash_table);
89
90 /* keeping hash tables alive */
91 GHashTable* g_hash_table_ref               (GHashTable     *hash_table);
92 void        g_hash_table_unref             (GHashTable     *hash_table);
93
94 #ifndef G_DISABLE_DEPRECATED
95
96 /* The following two functions are deprecated and will be removed in
97  * the next major release. They do no good. */
98 #define g_hash_table_freeze(hash_table) ((void)0)
99 #define g_hash_table_thaw(hash_table) ((void)0)
100
101 #endif /* G_DISABLE_DEPRECATED */
102
103 #endif
104
105 /* Hash Functions
106  */
107 gboolean g_str_equal (gconstpointer  v1,
108                       gconstpointer  v2);
109 guint    g_str_hash  (gconstpointer  v);
110
111 #if 0
112
113 gboolean g_int_equal (gconstpointer  v1,
114                       gconstpointer  v2);
115 guint    g_int_hash  (gconstpointer  v);
116
117 /* This "hash" function will just return the key's address as an
118  * unsigned integer. Useful for hashing on plain addresses or
119  * simple integer values.
120  * Passing NULL into g_hash_table_new() as GHashFunc has the
121  * same effect as passing g_direct_hash().
122  */
123 guint    g_direct_hash  (gconstpointer  v) G_GNUC_CONST;
124 gboolean g_direct_equal (gconstpointer  v1,
125                          gconstpointer  v2) G_GNUC_CONST;
126
127 #endif
128
129 G_END_DECLS
130
131 #endif /* __G_HASH_H__ */
132