1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 */ 6 module glib.ghash; 7 8 import glib.gtypes; 9 import glib.glist; 10 11 12 struct GHashTable; 13 14 struct GHashTableIter 15 { 16 gpointer dummy1; 17 gpointer dummy2; 18 gpointer dummy3; 19 int dummy4; 20 gboolean dummy5; 21 gpointer dummy6; 22 } 23 24 25 extern (C) { 26 27 alias GHRFunc = gboolean function (gpointer key, 28 gpointer value, 29 gpointer user_data); 30 31 GHashTable* g_hash_table_new (GHashFunc hash_func, 32 GEqualFunc key_equal_func); 33 34 GHashTable* g_hash_table_new_full (GHashFunc hash_func, 35 GEqualFunc key_equal_func, 36 GDestroyNotify key_destroy_func, 37 GDestroyNotify value_destroy_func); 38 39 void g_hash_table_destroy (GHashTable *hash_table); 40 41 gboolean g_hash_table_insert (GHashTable *hash_table, 42 gpointer key, 43 gpointer value); 44 45 gboolean g_hash_table_replace (GHashTable *hash_table, 46 gpointer key, 47 gpointer value); 48 49 gboolean g_hash_table_add (GHashTable *hash_table, 50 gpointer key); 51 52 gboolean g_hash_table_remove (GHashTable *hash_table, 53 gconstpointer key); 54 55 void g_hash_table_remove_all (GHashTable *hash_table); 56 57 gboolean g_hash_table_steal (GHashTable *hash_table, 58 gconstpointer key); 59 60 void g_hash_table_steal_all (GHashTable *hash_table); 61 62 gpointer g_hash_table_lookup (GHashTable *hash_table, 63 gconstpointer key); 64 65 gboolean g_hash_table_contains (GHashTable *hash_table, 66 gconstpointer key); 67 68 gboolean g_hash_table_lookup_extended (GHashTable *hash_table, 69 gconstpointer lookup_key, 70 gpointer *orig_key, 71 gpointer *value); 72 73 void g_hash_table_foreach (GHashTable *hash_table, 74 GHFunc func, 75 gpointer user_data); 76 77 gpointer g_hash_table_find (GHashTable *hash_table, 78 GHRFunc predicate, 79 gpointer user_data); 80 81 guint g_hash_table_foreach_remove (GHashTable *hash_table, 82 GHRFunc func, 83 gpointer user_data); 84 85 guint g_hash_table_foreach_steal (GHashTable *hash_table, 86 GHRFunc func, 87 gpointer user_data); 88 89 guint g_hash_table_size (GHashTable *hash_table); 90 91 GList * g_hash_table_get_keys (GHashTable *hash_table); 92 93 GList * g_hash_table_get_values (GHashTable *hash_table); 94 95 gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table, 96 guint *length); 97 98 99 void g_hash_table_iter_init (GHashTableIter *iter, 100 GHashTable *hash_table); 101 102 gboolean g_hash_table_iter_next (GHashTableIter *iter, 103 gpointer *key, 104 gpointer *value); 105 106 GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter); 107 108 void g_hash_table_iter_remove (GHashTableIter *iter); 109 110 void g_hash_table_iter_replace (GHashTableIter *iter, 111 gpointer value); 112 113 void g_hash_table_iter_steal (GHashTableIter *iter); 114 115 116 GHashTable* g_hash_table_ref (GHashTable *hash_table); 117 118 void g_hash_table_unref (GHashTable *hash_table); 119 120 121 122 gboolean g_str_equal (gconstpointer v1, 123 gconstpointer v2); 124 125 guint g_str_hash (gconstpointer v); 126 127 128 gboolean g_int_equal (gconstpointer v1, 129 gconstpointer v2); 130 131 guint g_int_hash (gconstpointer v); 132 133 134 gboolean g_int64_equal (gconstpointer v1, 135 gconstpointer v2); 136 137 guint g_int64_hash (gconstpointer v); 138 139 140 gboolean g_double_equal (gconstpointer v1, 141 gconstpointer v2); 142 143 guint g_double_hash (gconstpointer v); 144 145 146 guint g_direct_hash (gconstpointer v); 147 148 gboolean g_direct_equal (gconstpointer v1, 149 gconstpointer v2); 150 151 } 152