gobject: Clean up logic in property checks
[glib.git] / glib / ghash.h
blobfdff5fd6e0c9bd1aaa6a8744a788eeb6bc9873fb
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/.
27 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
28 #error "Only <glib.h> can be included directly."
29 #endif
31 #ifndef __G_HASH_H__
32 #define __G_HASH_H__
34 #include <glib/gtypes.h>
35 #include <glib/glist.h>
37 G_BEGIN_DECLS
39 typedef struct _GHashTable GHashTable;
41 typedef gboolean (*GHRFunc) (gpointer key,
42 gpointer value,
43 gpointer user_data);
45 typedef struct _GHashTableIter GHashTableIter;
47 struct _GHashTableIter
49 /*< private >*/
50 gpointer dummy1;
51 gpointer dummy2;
52 gpointer dummy3;
53 int dummy4;
54 gboolean dummy5;
55 gpointer dummy6;
58 GHashTable* g_hash_table_new (GHashFunc hash_func,
59 GEqualFunc key_equal_func);
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 void g_hash_table_destroy (GHashTable *hash_table);
65 void g_hash_table_insert (GHashTable *hash_table,
66 gpointer key,
67 gpointer value);
68 void g_hash_table_replace (GHashTable *hash_table,
69 gpointer key,
70 gpointer value);
71 gboolean g_hash_table_remove (GHashTable *hash_table,
72 gconstpointer key);
73 void g_hash_table_remove_all (GHashTable *hash_table);
74 gboolean g_hash_table_steal (GHashTable *hash_table,
75 gconstpointer key);
76 void g_hash_table_steal_all (GHashTable *hash_table);
77 gpointer g_hash_table_lookup (GHashTable *hash_table,
78 gconstpointer key);
79 gboolean g_hash_table_lookup_extended (GHashTable *hash_table,
80 gconstpointer lookup_key,
81 gpointer *orig_key,
82 gpointer *value);
83 void g_hash_table_foreach (GHashTable *hash_table,
84 GHFunc func,
85 gpointer user_data);
86 gpointer g_hash_table_find (GHashTable *hash_table,
87 GHRFunc predicate,
88 gpointer user_data);
89 guint g_hash_table_foreach_remove (GHashTable *hash_table,
90 GHRFunc func,
91 gpointer user_data);
92 guint g_hash_table_foreach_steal (GHashTable *hash_table,
93 GHRFunc func,
94 gpointer user_data);
95 guint g_hash_table_size (GHashTable *hash_table);
96 GList * g_hash_table_get_keys (GHashTable *hash_table);
97 GList * g_hash_table_get_values (GHashTable *hash_table);
99 void g_hash_table_iter_init (GHashTableIter *iter,
100 GHashTable *hash_table);
101 gboolean g_hash_table_iter_next (GHashTableIter *iter,
102 gpointer *key,
103 gpointer *value);
104 GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter);
105 void g_hash_table_iter_remove (GHashTableIter *iter);
106 void g_hash_table_iter_replace (GHashTableIter *iter,
107 gpointer value);
108 void g_hash_table_iter_steal (GHashTableIter *iter);
110 GHashTable* g_hash_table_ref (GHashTable *hash_table);
111 void g_hash_table_unref (GHashTable *hash_table);
113 #ifndef G_DISABLE_DEPRECATED
114 #define g_hash_table_freeze(hash_table) ((void)0)
115 #define g_hash_table_thaw(hash_table) ((void)0)
116 #endif
118 /* Hash Functions
120 gboolean g_str_equal (gconstpointer v1,
121 gconstpointer v2);
122 guint g_str_hash (gconstpointer v);
124 gboolean g_int_equal (gconstpointer v1,
125 gconstpointer v2);
126 guint g_int_hash (gconstpointer v);
128 gboolean g_int64_equal (gconstpointer v1,
129 gconstpointer v2);
130 guint g_int64_hash (gconstpointer v);
132 gboolean g_double_equal (gconstpointer v1,
133 gconstpointer v2);
134 guint g_double_hash (gconstpointer v);
136 guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
137 gboolean g_direct_equal (gconstpointer v1,
138 gconstpointer v2) G_GNUC_CONST;
140 G_END_DECLS
142 #endif /* __G_HASH_H__ */