Initial commit
[platform/upstream/glib2.0.git] / docs / reference / glib / html / glib-Hash-Tables.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Hash Tables</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib-data-types.html" title="GLib Data Types">
9 <link rel="prev" href="glib-Trash-Stacks.html" title="Trash Stacks">
10 <link rel="next" href="glib-Strings.html" title="Strings">
11 <meta name="generator" content="GTK-Doc V1.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="chapter" href="glib.html" title="GLib Overview">
14 <link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
15 <link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
16 <link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
17 <link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
18 <link rel="chapter" href="tools.html" title="GLib Tools">
19 <link rel="index" href="api-index-full.html" title="Index">
20 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
21 <link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
22 <link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
23 <link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
24 <link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
25 <link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
26 <link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
27 <link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
28 <link rel="index" href="api-index-2-16.html" title="Index of new symbols in 2.16">
29 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
30 <link rel="index" href="api-index-2-20.html" title="Index of new symbols in 2.20">
31 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
32 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
33 </head>
34 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
35 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
36 <tr valign="middle">
37 <td><a accesskey="p" href="glib-Trash-Stacks.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
38 <td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
39 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
40 <th width="100%" align="center">GLib Reference Manual</th>
41 <td><a accesskey="n" href="glib-Strings.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
42 </tr>
43 <tr><td colspan="5" class="shortcuts">
44 <a href="#glib-Hash-Tables.synopsis" class="shortcut">Top</a>
45                    | 
46                   <a href="#glib-Hash-Tables.description" class="shortcut">Description</a>
47 </td></tr>
48 </table>
49 <div class="refentry" title="Hash Tables">
50 <a name="glib-Hash-Tables"></a><div class="titlepage"></div>
51 <div class="refnamediv"><table width="100%"><tr>
52 <td valign="top">
53 <h2><span class="refentrytitle"><a name="glib-Hash-Tables.top_of_page"></a>Hash Tables</span></h2>
54 <p>Hash Tables — associations between keys and values so that
55                     given a key the value can be found quickly</p>
56 </td>
57 <td valign="top" align="right"></td>
58 </tr></table></div>
59 <div class="refsynopsisdiv" title="Synopsis">
60 <a name="glib-Hash-Tables.synopsis"></a><h2>Synopsis</h2>
61 <pre class="synopsis">
62 #include &lt;glib.h&gt;
63
64                     <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable">GHashTable</a>;
65 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a>*         <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()">g_hash_table_new</a>                    (<a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()"><span class="returnvalue">GHashFunc</span></a> hash_func,
66                                                          <a class="link" href="glib-Hash-Tables.html#GEqualFunc" title="GEqualFunc ()"><span class="returnvalue">GEqualFunc</span></a> key_equal_func);
67 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a>*         <a class="link" href="glib-Hash-Tables.html#g-hash-table-new-full" title="g_hash_table_new_full ()">g_hash_table_new_full</a>               (<a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()"><span class="returnvalue">GHashFunc</span></a> hash_func,
68                                                          <a class="link" href="glib-Hash-Tables.html#GEqualFunc" title="GEqualFunc ()"><span class="returnvalue">GEqualFunc</span></a> key_equal_func,
69                                                          <a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="returnvalue">GDestroyNotify</span></a> key_destroy_func,
70                                                          <a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="returnvalue">GDestroyNotify</span></a> value_destroy_func);
71 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               (<a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()">*GHashFunc</a>)                        (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> key);
72 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            (<a class="link" href="glib-Hash-Tables.html#GEqualFunc" title="GEqualFunc ()">*GEqualFunc</a>)                       (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> a,
73                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> b);
74 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-insert" title="g_hash_table_insert ()">g_hash_table_insert</a>                 (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
75                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> key,
76                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> value);
77 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-replace" title="g_hash_table_replace ()">g_hash_table_replace</a>                (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
78                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> key,
79                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> value);
80 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Hash-Tables.html#g-hash-table-size" title="g_hash_table_size ()">g_hash_table_size</a>                   (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
81 <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            <a class="link" href="glib-Hash-Tables.html#g-hash-table-lookup" title="g_hash_table_lookup ()">g_hash_table_lookup</a>                 (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
82                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> key);
83 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-hash-table-lookup-extended" title="g_hash_table_lookup_extended ()">g_hash_table_lookup_extended</a>        (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
84                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> lookup_key,
85                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> *orig_key,
86                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> *value);
87 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach" title="g_hash_table_foreach ()">g_hash_table_foreach</a>                (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
88                                                          <a class="link" href="glib-Hash-Tables.html#GHFunc" title="GHFunc ()"><span class="returnvalue">GHFunc</span></a> func,
89                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);
90 <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            <a class="link" href="glib-Hash-Tables.html#g-hash-table-find" title="g_hash_table_find ()">g_hash_table_find</a>                   (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
91                                                          <a class="link" href="glib-Hash-Tables.html#GHRFunc" title="GHRFunc ()"><span class="returnvalue">GHRFunc</span></a> predicate,
92                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);
93 <span class="returnvalue">void</span>                (<a class="link" href="glib-Hash-Tables.html#GHFunc" title="GHFunc ()">*GHFunc</a>)                           (<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> key,
94                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> value,
95                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);
96 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-hash-table-remove" title="g_hash_table_remove ()">g_hash_table_remove</a>                 (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
97                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> key);
98 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-hash-table-steal" title="g_hash_table_steal ()">g_hash_table_steal</a>                  (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
99                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> key);
100 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach-remove" title="g_hash_table_foreach_remove ()">g_hash_table_foreach_remove</a>         (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
101                                                          <a class="link" href="glib-Hash-Tables.html#GHRFunc" title="GHRFunc ()"><span class="returnvalue">GHRFunc</span></a> func,
102                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);
103 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach-steal" title="g_hash_table_foreach_steal ()">g_hash_table_foreach_steal</a>          (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
104                                                          <a class="link" href="glib-Hash-Tables.html#GHRFunc" title="GHRFunc ()"><span class="returnvalue">GHRFunc</span></a> func,
105                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);
106 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-remove-all" title="g_hash_table_remove_all ()">g_hash_table_remove_all</a>             (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
107 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-steal-all" title="g_hash_table_steal_all ()">g_hash_table_steal_all</a>              (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
108 <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a> *             <a class="link" href="glib-Hash-Tables.html#g-hash-table-get-keys" title="g_hash_table_get_keys ()">g_hash_table_get_keys</a>               (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
109 <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a> *             <a class="link" href="glib-Hash-Tables.html#g-hash-table-get-values" title="g_hash_table_get_values ()">g_hash_table_get_values</a>             (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
110 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            (<a class="link" href="glib-Hash-Tables.html#GHRFunc" title="GHRFunc ()">*GHRFunc</a>)                          (<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> key,
111                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> value,
112                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);
113 #define             <a class="link" href="glib-Hash-Tables.html#g-hash-table-freeze" title="g_hash_table_freeze()">g_hash_table_freeze</a>                 (hash_table)
114 #define             <a class="link" href="glib-Hash-Tables.html#g-hash-table-thaw" title="g_hash_table_thaw()">g_hash_table_thaw</a>                   (hash_table)
115 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-destroy" title="g_hash_table_destroy ()">g_hash_table_destroy</a>                (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
116 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a>*         <a class="link" href="glib-Hash-Tables.html#g-hash-table-ref" title="g_hash_table_ref ()">g_hash_table_ref</a>                    (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
117 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-unref" title="g_hash_table_unref ()">g_hash_table_unref</a>                  (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
118                     <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter">GHashTableIter</a>;
119 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-iter-init" title="g_hash_table_iter_init ()">g_hash_table_iter_init</a>              (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter,
120                                                          <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);
121 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-hash-table-iter-next" title="g_hash_table_iter_next ()">g_hash_table_iter_next</a>              (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter,
122                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> *key,
123                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> *value);
124 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a>*         <a class="link" href="glib-Hash-Tables.html#g-hash-table-iter-get-hash-table" title="g_hash_table_iter_get_hash_table ()">g_hash_table_iter_get_hash_table</a>    (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter);
125 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-iter-remove" title="g_hash_table_iter_remove ()">g_hash_table_iter_remove</a>            (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter);
126 <span class="returnvalue">void</span>                <a class="link" href="glib-Hash-Tables.html#g-hash-table-iter-steal" title="g_hash_table_iter_steal ()">g_hash_table_iter_steal</a>             (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter);
127
128 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-direct-equal" title="g_direct_equal ()">g_direct_equal</a>                      (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
129                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);
130 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Hash-Tables.html#g-direct-hash" title="g_direct_hash ()">g_direct_hash</a>                       (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);
131 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-int-equal" title="g_int_equal ()">g_int_equal</a>                         (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
132                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);
133 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Hash-Tables.html#g-int-hash" title="g_int_hash ()">g_int_hash</a>                          (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);
134 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-int64-equal" title="g_int64_equal ()">g_int64_equal</a>                       (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
135                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);
136 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Hash-Tables.html#g-int64-hash" title="g_int64_hash ()">g_int64_hash</a>                        (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);
137 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-double-equal" title="g_double_equal ()">g_double_equal</a>                      (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
138                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);
139 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Hash-Tables.html#g-double-hash" title="g_double_hash ()">g_double_hash</a>                       (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);
140 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Hash-Tables.html#g-str-equal" title="g_str_equal ()">g_str_equal</a>                         (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
141                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);
142 <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Hash-Tables.html#g-str-hash" title="g_str_hash ()">g_str_hash</a>                          (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);
143 </pre>
144 </div>
145 <div class="refsect1" title="Description">
146 <a name="glib-Hash-Tables.description"></a><h2>Description</h2>
147 <p>
148 A <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> provides associations between keys and values which is
149 optimized so that given a key, the associated value can be found
150 very quickly.
151 </p>
152 <p>
153 Note that neither keys nor values are copied when inserted into the
154 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, so they must exist for the lifetime of the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
155 This means that the use of static strings is OK, but temporary
156 strings (i.e. those created in buffers and those returned by GTK+
157 widgets) should be copied with <a class="link" href="glib-String-Utility-Functions.html#g-strdup" title="g_strdup ()"><code class="function">g_strdup()</code></a> before being inserted.
158 </p>
159 <p>
160 If keys or values are dynamically allocated, you must be careful to
161 ensure that they are freed when they are removed from the
162 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, and also when they are overwritten by new insertions
163 into the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>. It is also not advisable to mix static strings
164 and dynamically-allocated strings in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, because it then
165 becomes difficult to determine whether the string should be freed.
166 </p>
167 <p>
168 To create a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, use <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a>.
169 </p>
170 <p>
171 To insert a key and value into a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, use
172 <a class="link" href="glib-Hash-Tables.html#g-hash-table-insert" title="g_hash_table_insert ()"><code class="function">g_hash_table_insert()</code></a>.
173 </p>
174 <p>
175 To lookup a value corresponding to a given key, use
176 <a class="link" href="glib-Hash-Tables.html#g-hash-table-lookup" title="g_hash_table_lookup ()"><code class="function">g_hash_table_lookup()</code></a> and <a class="link" href="glib-Hash-Tables.html#g-hash-table-lookup-extended" title="g_hash_table_lookup_extended ()"><code class="function">g_hash_table_lookup_extended()</code></a>.
177 </p>
178 <p>
179 To remove a key and value, use <a class="link" href="glib-Hash-Tables.html#g-hash-table-remove" title="g_hash_table_remove ()"><code class="function">g_hash_table_remove()</code></a>.
180 </p>
181 <p>
182 To call a function for each key and value pair use
183 <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach" title="g_hash_table_foreach ()"><code class="function">g_hash_table_foreach()</code></a> or use a iterator to iterate over the
184 key/value pairs in the hash table, see <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="type">GHashTableIter</span></a>.
185 </p>
186 <p>
187 To destroy a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> use <a class="link" href="glib-Hash-Tables.html#g-hash-table-destroy" title="g_hash_table_destroy ()"><code class="function">g_hash_table_destroy()</code></a>.</p>
188 </div>
189 <div class="refsect1" title="Details">
190 <a name="glib-Hash-Tables.details"></a><h2>Details</h2>
191 <div class="refsect2" title="GHashTable">
192 <a name="GHashTable"></a><h3>GHashTable</h3>
193 <pre class="programlisting">typedef struct _GHashTable GHashTable;</pre>
194 <p>
195 The <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> struct is an opaque data structure to represent a
196 <a class="link" href="glib-Hash-Tables.html" title="Hash Tables">Hash Table</a>. It should only be
197 accessed via the following functions.</p>
198 </div>
199 <hr>
200 <div class="refsect2" title="g_hash_table_new ()">
201 <a name="g-hash-table-new"></a><h3>g_hash_table_new ()</h3>
202 <pre class="programlisting"><a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a>*         g_hash_table_new                    (<a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()"><span class="returnvalue">GHashFunc</span></a> hash_func,
203                                                          <a class="link" href="glib-Hash-Tables.html#GEqualFunc" title="GEqualFunc ()"><span class="returnvalue">GEqualFunc</span></a> key_equal_func);</pre>
204 <p>
205 Creates a new <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> with a reference count of 1.</p>
206 <div class="variablelist"><table border="0">
207 <col align="left" valign="top">
208 <tbody>
209 <tr>
210 <td><p><span class="term"><em class="parameter"><code>hash_func</code></em> :</span></p></td>
211 <td> a function to create a hash value from a key.
212   Hash values are used to determine where keys are stored within the
213   <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> data structure. The <a class="link" href="glib-Hash-Tables.html#g-direct-hash" title="g_direct_hash ()"><code class="function">g_direct_hash()</code></a>, <a class="link" href="glib-Hash-Tables.html#g-int-hash" title="g_int_hash ()"><code class="function">g_int_hash()</code></a>,
214   <a class="link" href="glib-Hash-Tables.html#g-int64-hash" title="g_int64_hash ()"><code class="function">g_int64_hash()</code></a>, <a class="link" href="glib-Hash-Tables.html#g-double-hash" title="g_double_hash ()"><code class="function">g_double_hash()</code></a> and <a class="link" href="glib-Hash-Tables.html#g-str-hash" title="g_str_hash ()"><code class="function">g_str_hash()</code></a> functions are provided
215   for some common types of keys.
216   If hash_func is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, <a class="link" href="glib-Hash-Tables.html#g-direct-hash" title="g_direct_hash ()"><code class="function">g_direct_hash()</code></a> is used.
217 </td>
218 </tr>
219 <tr>
220 <td><p><span class="term"><em class="parameter"><code>key_equal_func</code></em> :</span></p></td>
221 <td> a function to check two keys for equality.  This is
222   used when looking up keys in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.  The <a class="link" href="glib-Hash-Tables.html#g-direct-equal" title="g_direct_equal ()"><code class="function">g_direct_equal()</code></a>,
223   <a class="link" href="glib-Hash-Tables.html#g-int-equal" title="g_int_equal ()"><code class="function">g_int_equal()</code></a>, <a class="link" href="glib-Hash-Tables.html#g-int64-equal" title="g_int64_equal ()"><code class="function">g_int64_equal()</code></a>, <a class="link" href="glib-Hash-Tables.html#g-double-equal" title="g_double_equal ()"><code class="function">g_double_equal()</code></a> and <a class="link" href="glib-Hash-Tables.html#g-str-equal" title="g_str_equal ()"><code class="function">g_str_equal()</code></a>
224   functions are provided for the most common types of keys.
225   If <em class="parameter"><code>key_equal_func</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, keys are compared directly in a similar
226   fashion to <a class="link" href="glib-Hash-Tables.html#g-direct-equal" title="g_direct_equal ()"><code class="function">g_direct_equal()</code></a>, but without the overhead of a function call.
227 </td>
228 </tr>
229 <tr>
230 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
231 <td> a new <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
232 </td>
233 </tr>
234 </tbody>
235 </table></div>
236 </div>
237 <hr>
238 <div class="refsect2" title="g_hash_table_new_full ()">
239 <a name="g-hash-table-new-full"></a><h3>g_hash_table_new_full ()</h3>
240 <pre class="programlisting"><a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a>*         g_hash_table_new_full               (<a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()"><span class="returnvalue">GHashFunc</span></a> hash_func,
241                                                          <a class="link" href="glib-Hash-Tables.html#GEqualFunc" title="GEqualFunc ()"><span class="returnvalue">GEqualFunc</span></a> key_equal_func,
242                                                          <a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="returnvalue">GDestroyNotify</span></a> key_destroy_func,
243                                                          <a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="returnvalue">GDestroyNotify</span></a> value_destroy_func);</pre>
244 <p>
245 Creates a new <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> like <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> with a reference count
246 of 1 and allows to specify functions to free the memory allocated for the
247 key and value that get called when removing the entry from the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
248 <div class="variablelist"><table border="0">
249 <col align="left" valign="top">
250 <tbody>
251 <tr>
252 <td><p><span class="term"><em class="parameter"><code>hash_func</code></em> :</span></p></td>
253 <td> a function to create a hash value from a key.
254 </td>
255 </tr>
256 <tr>
257 <td><p><span class="term"><em class="parameter"><code>key_equal_func</code></em> :</span></p></td>
258 <td> a function to check two keys for equality.
259 </td>
260 </tr>
261 <tr>
262 <td><p><span class="term"><em class="parameter"><code>key_destroy_func</code></em> :</span></p></td>
263 <td> a function to free the memory allocated for the key
264   used when removing the entry from the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if you
265   don't want to supply such a function.
266 </td>
267 </tr>
268 <tr>
269 <td><p><span class="term"><em class="parameter"><code>value_destroy_func</code></em> :</span></p></td>
270 <td> a function to free the memory allocated for the
271   value used when removing the entry from the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if
272   you don't want to supply such a function.
273 </td>
274 </tr>
275 <tr>
276 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
277 <td> a new <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
278 </td>
279 </tr>
280 </tbody>
281 </table></div>
282 </div>
283 <hr>
284 <div class="refsect2" title="GHashFunc ()">
285 <a name="GHashFunc"></a><h3>GHashFunc ()</h3>
286 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               (*GHashFunc)                        (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> key);</pre>
287 <p>
288 Specifies the type of the hash function which is passed to
289 <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> when a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> is created.
290 </p>
291 <p>
292 The function is passed a key and should return a <a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> hash value.
293 The functions <a class="link" href="glib-Hash-Tables.html#g-direct-hash" title="g_direct_hash ()"><code class="function">g_direct_hash()</code></a>, <a class="link" href="glib-Hash-Tables.html#g-int-hash" title="g_int_hash ()"><code class="function">g_int_hash()</code></a> and <a class="link" href="glib-Hash-Tables.html#g-str-hash" title="g_str_hash ()"><code class="function">g_str_hash()</code></a> provide
294 hash functions which can be used when the key is a <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a>, <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a>,
295 and <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a>* respectively.
296 </p>
297 <p>
298  The hash values should be evenly
299 distributed over a fairly large range? The modulus is taken with the
300 hash table size (a prime number) to find the 'bucket' to place each
301 key into. The function should also be very fast, since it is called
302 for each key lookup.</p>
303 <div class="variablelist"><table border="0">
304 <col align="left" valign="top">
305 <tbody>
306 <tr>
307 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
308 <td> a key.
309 </td>
310 </tr>
311 <tr>
312 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
313 <td> the hash value corresponding to the key.
314 </td>
315 </tr>
316 </tbody>
317 </table></div>
318 </div>
319 <hr>
320 <div class="refsect2" title="GEqualFunc ()">
321 <a name="GEqualFunc"></a><h3>GEqualFunc ()</h3>
322 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            (*GEqualFunc)                       (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> a,
323                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> b);</pre>
324 <p>
325 Specifies the type of a function used to test two values for
326 equality. The function should return <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if both values are equal
327 and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise.</p>
328 <div class="variablelist"><table border="0">
329 <col align="left" valign="top">
330 <tbody>
331 <tr>
332 <td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td>
333 <td> a value.
334 </td>
335 </tr>
336 <tr>
337 <td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td>
338 <td> a value to compare with.
339 </td>
340 </tr>
341 <tr>
342 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
343 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>a</code></em> = <em class="parameter"><code>b</code></em>; <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise.
344 </td>
345 </tr>
346 </tbody>
347 </table></div>
348 </div>
349 <hr>
350 <div class="refsect2" title="g_hash_table_insert ()">
351 <a name="g-hash-table-insert"></a><h3>g_hash_table_insert ()</h3>
352 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_insert                 (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
353                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> key,
354                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> value);</pre>
355 <p>
356 Inserts a new key and value into a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
357 </p>
358 <p>
359 If the key already exists in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> its current value is replaced
360 with the new value. If you supplied a <em class="parameter"><code>value_destroy_func</code></em> when creating the
361 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, the old value is freed using that function. If you supplied
362 a <em class="parameter"><code>key_destroy_func</code></em> when creating the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, the passed key is freed
363 using that function.</p>
364 <div class="variablelist"><table border="0">
365 <col align="left" valign="top">
366 <tbody>
367 <tr>
368 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
369 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
370 </td>
371 </tr>
372 <tr>
373 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
374 <td> a key to insert.
375 </td>
376 </tr>
377 <tr>
378 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
379 <td> the value to associate with the key.
380 </td>
381 </tr>
382 </tbody>
383 </table></div>
384 </div>
385 <hr>
386 <div class="refsect2" title="g_hash_table_replace ()">
387 <a name="g-hash-table-replace"></a><h3>g_hash_table_replace ()</h3>
388 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_replace                (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
389                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> key,
390                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> value);</pre>
391 <p>
392 Inserts a new key and value into a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> similar to
393 <a class="link" href="glib-Hash-Tables.html#g-hash-table-insert" title="g_hash_table_insert ()"><code class="function">g_hash_table_insert()</code></a>. The difference is that if the key already exists
394 in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, it gets replaced by the new key. If you supplied a
395 <em class="parameter"><code>value_destroy_func</code></em> when creating the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, the old value is freed
396 using that function. If you supplied a <em class="parameter"><code>key_destroy_func</code></em> when creating the
397 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, the old key is freed using that function.</p>
398 <div class="variablelist"><table border="0">
399 <col align="left" valign="top">
400 <tbody>
401 <tr>
402 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
403 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
404 </td>
405 </tr>
406 <tr>
407 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
408 <td> a key to insert.
409 </td>
410 </tr>
411 <tr>
412 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
413 <td> the value to associate with the key.
414 </td>
415 </tr>
416 </tbody>
417 </table></div>
418 </div>
419 <hr>
420 <div class="refsect2" title="g_hash_table_size ()">
421 <a name="g-hash-table-size"></a><h3>g_hash_table_size ()</h3>
422 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_hash_table_size                   (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
423 <p>
424 Returns the number of elements contained in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
425 <div class="variablelist"><table border="0">
426 <col align="left" valign="top">
427 <tbody>
428 <tr>
429 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
430 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
431 </td>
432 </tr>
433 <tr>
434 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
435 <td> the number of key/value pairs in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
436 </td>
437 </tr>
438 </tbody>
439 </table></div>
440 </div>
441 <hr>
442 <div class="refsect2" title="g_hash_table_lookup ()">
443 <a name="g-hash-table-lookup"></a><h3>g_hash_table_lookup ()</h3>
444 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            g_hash_table_lookup                 (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
445                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> key);</pre>
446 <p>
447 Looks up a key in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>. Note that this function cannot
448 distinguish between a key that is not present and one which is present
449 and has the value <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If you need this distinction, use
450 <a class="link" href="glib-Hash-Tables.html#g-hash-table-lookup-extended" title="g_hash_table_lookup_extended ()"><code class="function">g_hash_table_lookup_extended()</code></a>.</p>
451 <div class="variablelist"><table border="0">
452 <col align="left" valign="top">
453 <tbody>
454 <tr>
455 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
456 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
457 </td>
458 </tr>
459 <tr>
460 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
461 <td> the key to look up.
462 </td>
463 </tr>
464 <tr>
465 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
466 <td> the associated value, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if the key is not found.
467 </td>
468 </tr>
469 </tbody>
470 </table></div>
471 </div>
472 <hr>
473 <div class="refsect2" title="g_hash_table_lookup_extended ()">
474 <a name="g-hash-table-lookup-extended"></a><h3>g_hash_table_lookup_extended ()</h3>
475 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_hash_table_lookup_extended        (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
476                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> lookup_key,
477                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> *orig_key,
478                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> *value);</pre>
479 <p>
480 Looks up a key in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, returning the original key and the
481 associated value and a <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> which is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the key was found. This
482 is useful if you need to free the memory allocated for the original key,
483 for example before calling <a class="link" href="glib-Hash-Tables.html#g-hash-table-remove" title="g_hash_table_remove ()"><code class="function">g_hash_table_remove()</code></a>.
484 </p>
485 <p>
486 You can actually pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> for <em class="parameter"><code>lookup_key</code></em> to test
487 whether the <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> key exists.</p>
488 <div class="variablelist"><table border="0">
489 <col align="left" valign="top">
490 <tbody>
491 <tr>
492 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
493 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>
494 </td>
495 </tr>
496 <tr>
497 <td><p><span class="term"><em class="parameter"><code>lookup_key</code></em> :</span></p></td>
498 <td> the key to look up
499 </td>
500 </tr>
501 <tr>
502 <td><p><span class="term"><em class="parameter"><code>orig_key</code></em> :</span></p></td>
503 <td> return location for the original key, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
504 </td>
505 </tr>
506 <tr>
507 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
508 <td> return location for the value associated with the key, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
509 </td>
510 </tr>
511 <tr>
512 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
513 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the key was found in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
514 </td>
515 </tr>
516 </tbody>
517 </table></div>
518 </div>
519 <hr>
520 <div class="refsect2" title="g_hash_table_foreach ()">
521 <a name="g-hash-table-foreach"></a><h3>g_hash_table_foreach ()</h3>
522 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_foreach                (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
523                                                          <a class="link" href="glib-Hash-Tables.html#GHFunc" title="GHFunc ()"><span class="returnvalue">GHFunc</span></a> func,
524                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);</pre>
525 <p>
526 Calls the given function for each of the key/value pairs in the
527 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.  The function is passed the key and value of each
528 pair, and the given <em class="parameter"><code>user_data</code></em> parameter.  The hash table may not
529 be modified while iterating over it (you can't add/remove
530 items). To remove all items matching a predicate, use
531 <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach-remove" title="g_hash_table_foreach_remove ()"><code class="function">g_hash_table_foreach_remove()</code></a>.
532 </p>
533 <p>
534 See <a class="link" href="glib-Hash-Tables.html#g-hash-table-find" title="g_hash_table_find ()"><code class="function">g_hash_table_find()</code></a> for performance caveats for linear
535 order searches in contrast to <a class="link" href="glib-Hash-Tables.html#g-hash-table-lookup" title="g_hash_table_lookup ()"><code class="function">g_hash_table_lookup()</code></a>.</p>
536 <div class="variablelist"><table border="0">
537 <col align="left" valign="top">
538 <tbody>
539 <tr>
540 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
541 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
542 </td>
543 </tr>
544 <tr>
545 <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
546 <td> the function to call for each key/value pair.
547 </td>
548 </tr>
549 <tr>
550 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
551 <td> user data to pass to the function.
552 </td>
553 </tr>
554 </tbody>
555 </table></div>
556 </div>
557 <hr>
558 <div class="refsect2" title="g_hash_table_find ()">
559 <a name="g-hash-table-find"></a><h3>g_hash_table_find ()</h3>
560 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            g_hash_table_find                   (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
561                                                          <a class="link" href="glib-Hash-Tables.html#GHRFunc" title="GHRFunc ()"><span class="returnvalue">GHRFunc</span></a> predicate,
562                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);</pre>
563 <p>
564 Calls the given function for key/value pairs in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> until
565 <em class="parameter"><code>predicate</code></em> returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.  The function is passed the key and value of
566 each pair, and the given <em class="parameter"><code>user_data</code></em> parameter. The hash table may not
567 be modified while iterating over it (you can't add/remove items).
568 </p>
569 <p>
570 Note, that hash tables are really only optimized for forward lookups,
571 i.e. <a class="link" href="glib-Hash-Tables.html#g-hash-table-lookup" title="g_hash_table_lookup ()"><code class="function">g_hash_table_lookup()</code></a>.
572 So code that frequently issues <a class="link" href="glib-Hash-Tables.html#g-hash-table-find" title="g_hash_table_find ()"><code class="function">g_hash_table_find()</code></a> or
573 <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach" title="g_hash_table_foreach ()"><code class="function">g_hash_table_foreach()</code></a> (e.g. in the order of once per every entry in a
574 hash table) should probably be reworked to use additional or different
575 data structures for reverse lookups (keep in mind that an O(n) find/foreach
576 operation issued for all n values in a hash table ends up needing O(n*n)
577 operations).</p>
578 <div class="variablelist"><table border="0">
579 <col align="left" valign="top">
580 <tbody>
581 <tr>
582 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
583 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
584 </td>
585 </tr>
586 <tr>
587 <td><p><span class="term"><em class="parameter"><code>predicate</code></em> :</span></p></td>
588 <td>  function to test the key/value pairs for a certain property.
589 </td>
590 </tr>
591 <tr>
592 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
593 <td>  user data to pass to the function.
594 </td>
595 </tr>
596 <tr>
597 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
598 <td> The value of the first key/value pair is returned, for which
599 func evaluates to <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. If no pair with the requested property is found,
600 <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.
601
602 </td>
603 </tr>
604 </tbody>
605 </table></div>
606 <p class="since">Since 2.4</p>
607 </div>
608 <hr>
609 <div class="refsect2" title="GHFunc ()">
610 <a name="GHFunc"></a><h3>GHFunc ()</h3>
611 <pre class="programlisting"><span class="returnvalue">void</span>                (*GHFunc)                           (<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> key,
612                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> value,
613                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);</pre>
614 <p>
615 Specifies the type of the function passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach" title="g_hash_table_foreach ()"><code class="function">g_hash_table_foreach()</code></a>.
616 It is called with each key/value pair, together with the <em class="parameter"><code>user_data</code></em>
617 parameter which is passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach" title="g_hash_table_foreach ()"><code class="function">g_hash_table_foreach()</code></a>.</p>
618 <div class="variablelist"><table border="0">
619 <col align="left" valign="top">
620 <tbody>
621 <tr>
622 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
623 <td> a key.
624 </td>
625 </tr>
626 <tr>
627 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
628 <td> the value corresponding to the key.
629 </td>
630 </tr>
631 <tr>
632 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
633 <td> user data passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach" title="g_hash_table_foreach ()"><code class="function">g_hash_table_foreach()</code></a>.
634 </td>
635 </tr>
636 </tbody>
637 </table></div>
638 </div>
639 <hr>
640 <div class="refsect2" title="g_hash_table_remove ()">
641 <a name="g-hash-table-remove"></a><h3>g_hash_table_remove ()</h3>
642 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_hash_table_remove                 (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
643                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> key);</pre>
644 <p>
645 Removes a key and its associated value from a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
646 </p>
647 <p>
648 If the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> was created using <a class="link" href="glib-Hash-Tables.html#g-hash-table-new-full" title="g_hash_table_new_full ()"><code class="function">g_hash_table_new_full()</code></a>, the
649 key and value are freed using the supplied destroy functions, otherwise
650 you have to make sure that any dynamically allocated values are freed
651 yourself.</p>
652 <div class="variablelist"><table border="0">
653 <col align="left" valign="top">
654 <tbody>
655 <tr>
656 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
657 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
658 </td>
659 </tr>
660 <tr>
661 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
662 <td> the key to remove.
663 </td>
664 </tr>
665 <tr>
666 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
667 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the key was found and removed from the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
668 </td>
669 </tr>
670 </tbody>
671 </table></div>
672 </div>
673 <hr>
674 <div class="refsect2" title="g_hash_table_steal ()">
675 <a name="g-hash-table-steal"></a><h3>g_hash_table_steal ()</h3>
676 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_hash_table_steal                  (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
677                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> key);</pre>
678 <p>
679 Removes a key and its associated value from a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> without
680 calling the key and value destroy functions.</p>
681 <div class="variablelist"><table border="0">
682 <col align="left" valign="top">
683 <tbody>
684 <tr>
685 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
686 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
687 </td>
688 </tr>
689 <tr>
690 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
691 <td> the key to remove.
692 </td>
693 </tr>
694 <tr>
695 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
696 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the key was found and removed from the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
697 </td>
698 </tr>
699 </tbody>
700 </table></div>
701 </div>
702 <hr>
703 <div class="refsect2" title="g_hash_table_foreach_remove ()">
704 <a name="g-hash-table-foreach-remove"></a><h3>g_hash_table_foreach_remove ()</h3>
705 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_hash_table_foreach_remove         (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
706                                                          <a class="link" href="glib-Hash-Tables.html#GHRFunc" title="GHRFunc ()"><span class="returnvalue">GHRFunc</span></a> func,
707                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);</pre>
708 <p>
709 Calls the given function for each key/value pair in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
710 If the function returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, then the key/value pair is removed from the
711 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>. If you supplied key or value destroy functions when creating
712 the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, they are used to free the memory allocated for the removed
713 keys and values.
714 </p>
715 <p>
716 See <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="type">GHashTableIter</span></a> for an alternative way to loop over the 
717 key/value pairs in the hash table.</p>
718 <div class="variablelist"><table border="0">
719 <col align="left" valign="top">
720 <tbody>
721 <tr>
722 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
723 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
724 </td>
725 </tr>
726 <tr>
727 <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
728 <td> the function to call for each key/value pair.
729 </td>
730 </tr>
731 <tr>
732 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
733 <td> user data to pass to the function.
734 </td>
735 </tr>
736 <tr>
737 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
738 <td> the number of key/value pairs removed.
739 </td>
740 </tr>
741 </tbody>
742 </table></div>
743 </div>
744 <hr>
745 <div class="refsect2" title="g_hash_table_foreach_steal ()">
746 <a name="g-hash-table-foreach-steal"></a><h3>g_hash_table_foreach_steal ()</h3>
747 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_hash_table_foreach_steal          (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table,
748                                                          <a class="link" href="glib-Hash-Tables.html#GHRFunc" title="GHRFunc ()"><span class="returnvalue">GHRFunc</span></a> func,
749                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);</pre>
750 <p>
751 Calls the given function for each key/value pair in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
752 If the function returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, then the key/value pair is removed from the
753 <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, but no key or value destroy functions are called.
754 </p>
755 <p>
756 See <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="type">GHashTableIter</span></a> for an alternative way to loop over the 
757 key/value pairs in the hash table.</p>
758 <div class="variablelist"><table border="0">
759 <col align="left" valign="top">
760 <tbody>
761 <tr>
762 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
763 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
764 </td>
765 </tr>
766 <tr>
767 <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
768 <td> the function to call for each key/value pair.
769 </td>
770 </tr>
771 <tr>
772 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
773 <td> user data to pass to the function.
774 </td>
775 </tr>
776 <tr>
777 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
778 <td> the number of key/value pairs removed.
779 </td>
780 </tr>
781 </tbody>
782 </table></div>
783 </div>
784 <hr>
785 <div class="refsect2" title="g_hash_table_remove_all ()">
786 <a name="g-hash-table-remove-all"></a><h3>g_hash_table_remove_all ()</h3>
787 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_remove_all             (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
788 <p>
789 Removes all keys and their associated values from a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
790 </p>
791 <p>
792 If the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> was created using <a class="link" href="glib-Hash-Tables.html#g-hash-table-new-full" title="g_hash_table_new_full ()"><code class="function">g_hash_table_new_full()</code></a>, the keys
793 and values are freed using the supplied destroy functions, otherwise you
794 have to make sure that any dynamically allocated values are freed
795 yourself.</p>
796 <div class="variablelist"><table border="0">
797 <col align="left" valign="top">
798 <tbody><tr>
799 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
800 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>
801 </td>
802 </tr></tbody>
803 </table></div>
804 <p class="since">Since 2.12</p>
805 </div>
806 <hr>
807 <div class="refsect2" title="g_hash_table_steal_all ()">
808 <a name="g-hash-table-steal-all"></a><h3>g_hash_table_steal_all ()</h3>
809 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_steal_all              (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
810 <p>
811 Removes all keys and their associated values from a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>
812 without calling the key and value destroy functions.</p>
813 <div class="variablelist"><table border="0">
814 <col align="left" valign="top">
815 <tbody><tr>
816 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
817 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
818 </td>
819 </tr></tbody>
820 </table></div>
821 <p class="since">Since 2.12</p>
822 </div>
823 <hr>
824 <div class="refsect2" title="g_hash_table_get_keys ()">
825 <a name="g-hash-table-get-keys"></a><h3>g_hash_table_get_keys ()</h3>
826 <pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a> *             g_hash_table_get_keys               (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
827 <p>
828 Retrieves every key inside <em class="parameter"><code>hash_table</code></em>. The returned data is valid
829 until <em class="parameter"><code>hash_table</code></em> is modified.</p>
830 <div class="variablelist"><table border="0">
831 <col align="left" valign="top">
832 <tbody>
833 <tr>
834 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
835 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>
836 </td>
837 </tr>
838 <tr>
839 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
840 <td> a <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="type">GList</span></a> containing all the keys inside the hash
841   table. The content of the list is owned by the hash table and
842   should not be modified or freed. Use <a class="link" href="glib-Doubly-Linked-Lists.html#g-list-free" title="g_list_free ()"><code class="function">g_list_free()</code></a> when done
843   using the list.
844
845 </td>
846 </tr>
847 </tbody>
848 </table></div>
849 <p class="since">Since 2.14</p>
850 </div>
851 <hr>
852 <div class="refsect2" title="g_hash_table_get_values ()">
853 <a name="g-hash-table-get-values"></a><h3>g_hash_table_get_values ()</h3>
854 <pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="returnvalue">GList</span></a> *             g_hash_table_get_values             (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
855 <p>
856 Retrieves every value inside <em class="parameter"><code>hash_table</code></em>. The returned data is
857 valid until <em class="parameter"><code>hash_table</code></em> is modified.</p>
858 <div class="variablelist"><table border="0">
859 <col align="left" valign="top">
860 <tbody>
861 <tr>
862 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
863 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>
864 </td>
865 </tr>
866 <tr>
867 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
868 <td> a <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="GList"><span class="type">GList</span></a> containing all the values inside the hash
869   table. The content of the list is owned by the hash table and
870   should not be modified or freed. Use <a class="link" href="glib-Doubly-Linked-Lists.html#g-list-free" title="g_list_free ()"><code class="function">g_list_free()</code></a> when done
871   using the list.
872
873 </td>
874 </tr>
875 </tbody>
876 </table></div>
877 <p class="since">Since 2.14</p>
878 </div>
879 <hr>
880 <div class="refsect2" title="GHRFunc ()">
881 <a name="GHRFunc"></a><h3>GHRFunc ()</h3>
882 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            (*GHRFunc)                          (<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> key,
883                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> value,
884                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);</pre>
885 <p>
886 Specifies the type of the function passed to
887 <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach-remove" title="g_hash_table_foreach_remove ()"><code class="function">g_hash_table_foreach_remove()</code></a>. It is called with each key/value
888 pair, together with the <em class="parameter"><code>user_data</code></em> parameter passed to
889 <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach-remove" title="g_hash_table_foreach_remove ()"><code class="function">g_hash_table_foreach_remove()</code></a>. It should return <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the
890 key/value pair should be removed from the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
891 <div class="variablelist"><table border="0">
892 <col align="left" valign="top">
893 <tbody>
894 <tr>
895 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
896 <td> a key.
897 </td>
898 </tr>
899 <tr>
900 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
901 <td> the value associated with the key.
902 </td>
903 </tr>
904 <tr>
905 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
906 <td> user data passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-remove" title="g_hash_table_remove ()"><code class="function">g_hash_table_remove()</code></a>.
907 </td>
908 </tr>
909 <tr>
910 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
911 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the key/value pair should be removed from the
912           <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
913 </td>
914 </tr>
915 </tbody>
916 </table></div>
917 </div>
918 <hr>
919 <div class="refsect2" title="g_hash_table_freeze()">
920 <a name="g-hash-table-freeze"></a><h3>g_hash_table_freeze()</h3>
921 <pre class="programlisting">#define             g_hash_table_freeze(hash_table)</pre>
922 <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;">
923 <h3 class="title">Warning</h3>
924 <p><code class="literal">g_hash_table_freeze</code> is deprecated and should not be used in newly-written code.</p>
925 </div>
926 <p>
927 This function is deprecated and will be removed in the next major
928 release of GLib. It does nothing.</p>
929 <div class="variablelist"><table border="0">
930 <col align="left" valign="top">
931 <tbody><tr>
932 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
933 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>
934 </td>
935 </tr></tbody>
936 </table></div>
937 </div>
938 <hr>
939 <div class="refsect2" title="g_hash_table_thaw()">
940 <a name="g-hash-table-thaw"></a><h3>g_hash_table_thaw()</h3>
941 <pre class="programlisting">#define             g_hash_table_thaw(hash_table)</pre>
942 <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;">
943 <h3 class="title">Warning</h3>
944 <p><code class="literal">g_hash_table_thaw</code> is deprecated and should not be used in newly-written code.</p>
945 </div>
946 <p>
947 This function is deprecated and will be removed in the next major
948 release of GLib. It does nothing.</p>
949 <div class="variablelist"><table border="0">
950 <col align="left" valign="top">
951 <tbody><tr>
952 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
953 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>
954 </td>
955 </tr></tbody>
956 </table></div>
957 </div>
958 <hr>
959 <div class="refsect2" title="g_hash_table_destroy ()">
960 <a name="g-hash-table-destroy"></a><h3>g_hash_table_destroy ()</h3>
961 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_destroy                (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
962 <p>
963 Destroys all keys and values in the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> and decrements its
964 reference count by 1. If keys and/or values are dynamically allocated,
965 you should either free them first or create the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> with destroy
966 notifiers using <a class="link" href="glib-Hash-Tables.html#g-hash-table-new-full" title="g_hash_table_new_full ()"><code class="function">g_hash_table_new_full()</code></a>. In the latter case the destroy
967 functions you supplied will be called on all keys and values during the
968 destruction phase.</p>
969 <div class="variablelist"><table border="0">
970 <col align="left" valign="top">
971 <tbody><tr>
972 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
973 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
974 </td>
975 </tr></tbody>
976 </table></div>
977 </div>
978 <hr>
979 <div class="refsect2" title="g_hash_table_ref ()">
980 <a name="g-hash-table-ref"></a><h3>g_hash_table_ref ()</h3>
981 <pre class="programlisting"><a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a>*         g_hash_table_ref                    (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
982 <p>
983 Atomically increments the reference count of <em class="parameter"><code>hash_table</code></em> by one.
984 This function is MT-safe and may be called from any thread.</p>
985 <div class="variablelist"><table border="0">
986 <col align="left" valign="top">
987 <tbody>
988 <tr>
989 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
990 <td> a valid <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
991 </td>
992 </tr>
993 <tr>
994 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
995 <td> the passed in <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
996
997 </td>
998 </tr>
999 </tbody>
1000 </table></div>
1001 <p class="since">Since 2.10</p>
1002 </div>
1003 <hr>
1004 <div class="refsect2" title="g_hash_table_unref ()">
1005 <a name="g-hash-table-unref"></a><h3>g_hash_table_unref ()</h3>
1006 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_unref                  (<a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
1007 <p>
1008 Atomically decrements the reference count of <em class="parameter"><code>hash_table</code></em> by one.
1009 If the reference count drops to 0, all keys and values will be
1010 destroyed, and all memory allocated by the hash table is released.
1011 This function is MT-safe and may be called from any thread.</p>
1012 <div class="variablelist"><table border="0">
1013 <col align="left" valign="top">
1014 <tbody><tr>
1015 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
1016 <td> a valid <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
1017 </td>
1018 </tr></tbody>
1019 </table></div>
1020 <p class="since">Since 2.10</p>
1021 </div>
1022 <hr>
1023 <div class="refsect2" title="GHashTableIter">
1024 <a name="GHashTableIter"></a><h3>GHashTableIter</h3>
1025 <pre class="programlisting">typedef struct {
1026 } GHashTableIter;
1027 </pre>
1028 <p>
1029 A GHashTableIter structure represents an iterator that can be used
1030 to iterate over the elements of a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>. GHashTableIter
1031 structures are typically allocated on the stack and then initialized
1032 with <a class="link" href="glib-Hash-Tables.html#g-hash-table-iter-init" title="g_hash_table_iter_init ()"><code class="function">g_hash_table_iter_init()</code></a>.</p>
1033 </div>
1034 <hr>
1035 <div class="refsect2" title="g_hash_table_iter_init ()">
1036 <a name="g-hash-table-iter-init"></a><h3>g_hash_table_iter_init ()</h3>
1037 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_iter_init              (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter,
1038                                                          <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a> *hash_table);</pre>
1039 <p>
1040 Initializes a key/value pair iterator and associates it with
1041 <em class="parameter"><code>hash_table</code></em>. Modifying the hash table after calling this function
1042 invalidates the returned iterator.
1043 </p>
1044 <div class="informalexample"><pre class="programlisting">
1045 GHashTableIter iter;
1046 gpointer key, value;
1047
1048 g_hash_table_iter_init (&amp;iter, hash_table);
1049 while (g_hash_table_iter_next (&amp;iter, &amp;key, &amp;value)) 
1050   {
1051     /* do something with key and value */
1052   }
1053 </pre></div>
1054 <div class="variablelist"><table border="0">
1055 <col align="left" valign="top">
1056 <tbody>
1057 <tr>
1058 <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td>
1059 <td> an uninitialized <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="type">GHashTableIter</span></a>.
1060 </td>
1061 </tr>
1062 <tr>
1063 <td><p><span class="term"><em class="parameter"><code>hash_table</code></em> :</span></p></td>
1064 <td> a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
1065 </td>
1066 </tr>
1067 </tbody>
1068 </table></div>
1069 <p class="since">Since 2.16</p>
1070 </div>
1071 <hr>
1072 <div class="refsect2" title="g_hash_table_iter_next ()">
1073 <a name="g-hash-table-iter-next"></a><h3>g_hash_table_iter_next ()</h3>
1074 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_hash_table_iter_next              (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter,
1075                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> *key,
1076                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> *value);</pre>
1077 <p>
1078 Advances <em class="parameter"><code>iter</code></em> and retrieves the key and/or value that are now
1079 pointed to as a result of this advancement. If <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> is returned,
1080 <em class="parameter"><code>key</code></em> and <em class="parameter"><code>value</code></em> are not set, and the iterator becomes invalid.</p>
1081 <div class="variablelist"><table border="0">
1082 <col align="left" valign="top">
1083 <tbody>
1084 <tr>
1085 <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td>
1086 <td> an initialized <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="type">GHashTableIter</span></a>.
1087 </td>
1088 </tr>
1089 <tr>
1090 <td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
1091 <td> a location to store the key, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
1092 </td>
1093 </tr>
1094 <tr>
1095 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
1096 <td> a location to store the value, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
1097 </td>
1098 </tr>
1099 <tr>
1100 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1101 <td> <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if the end of the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> has been reached.
1102
1103 </td>
1104 </tr>
1105 </tbody>
1106 </table></div>
1107 <p class="since">Since 2.16</p>
1108 </div>
1109 <hr>
1110 <div class="refsect2" title="g_hash_table_iter_get_hash_table ()">
1111 <a name="g-hash-table-iter-get-hash-table"></a><h3>g_hash_table_iter_get_hash_table ()</h3>
1112 <pre class="programlisting"><a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="returnvalue">GHashTable</span></a>*         g_hash_table_iter_get_hash_table    (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter);</pre>
1113 <p>
1114 Returns the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> associated with <em class="parameter"><code>iter</code></em>.</p>
1115 <div class="variablelist"><table border="0">
1116 <col align="left" valign="top">
1117 <tbody>
1118 <tr>
1119 <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td>
1120 <td> an initialized <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="type">GHashTableIter</span></a>.
1121 </td>
1122 </tr>
1123 <tr>
1124 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1125 <td> the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> associated with <em class="parameter"><code>iter</code></em>.
1126
1127 </td>
1128 </tr>
1129 </tbody>
1130 </table></div>
1131 <p class="since">Since 2.16</p>
1132 </div>
1133 <hr>
1134 <div class="refsect2" title="g_hash_table_iter_remove ()">
1135 <a name="g-hash-table-iter-remove"></a><h3>g_hash_table_iter_remove ()</h3>
1136 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_iter_remove            (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter);</pre>
1137 <p>
1138 Removes the key/value pair currently pointed to by the iterator
1139 from its associated <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>. Can only be called after
1140 <a class="link" href="glib-Hash-Tables.html#g-hash-table-iter-next" title="g_hash_table_iter_next ()"><code class="function">g_hash_table_iter_next()</code></a> returned <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, and cannot be called more
1141 than once for the same key/value pair.
1142 </p>
1143 <p>
1144 If the <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> was created using <a class="link" href="glib-Hash-Tables.html#g-hash-table-new-full" title="g_hash_table_new_full ()"><code class="function">g_hash_table_new_full()</code></a>, the
1145 key and value are freed using the supplied destroy functions, otherwise
1146 you have to make sure that any dynamically allocated values are freed 
1147 yourself.</p>
1148 <div class="variablelist"><table border="0">
1149 <col align="left" valign="top">
1150 <tbody><tr>
1151 <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td>
1152 <td> an initialized <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="type">GHashTableIter</span></a>.
1153 </td>
1154 </tr></tbody>
1155 </table></div>
1156 <p class="since">Since 2.16</p>
1157 </div>
1158 <hr>
1159 <div class="refsect2" title="g_hash_table_iter_steal ()">
1160 <a name="g-hash-table-iter-steal"></a><h3>g_hash_table_iter_steal ()</h3>
1161 <pre class="programlisting"><span class="returnvalue">void</span>                g_hash_table_iter_steal             (<a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="returnvalue">GHashTableIter</span></a> *iter);</pre>
1162 <p>
1163 Removes the key/value pair currently pointed to by the iterator
1164 from its associated <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>, without calling the key and value
1165 destroy functions. Can only be called after
1166 <a class="link" href="glib-Hash-Tables.html#g-hash-table-iter-next" title="g_hash_table_iter_next ()"><code class="function">g_hash_table_iter_next()</code></a> returned <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, and cannot be called more
1167 than once for the same key/value pair.</p>
1168 <div class="variablelist"><table border="0">
1169 <col align="left" valign="top">
1170 <tbody><tr>
1171 <td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td>
1172 <td> an initialized <a class="link" href="glib-Hash-Tables.html#GHashTableIter" title="GHashTableIter"><span class="type">GHashTableIter</span></a>.
1173 </td>
1174 </tr></tbody>
1175 </table></div>
1176 <p class="since">Since 2.16</p>
1177 </div>
1178 <hr>
1179 <div class="refsect2" title="g_direct_equal ()">
1180 <a name="g-direct-equal"></a><h3>g_direct_equal ()</h3>
1181 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_direct_equal                      (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
1182                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);</pre>
1183 <p>
1184 Compares two <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> arguments and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if they are equal.
1185 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>key_equal_func</code></em>
1186 parameter, when using pointers as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1187 <div class="variablelist"><table border="0">
1188 <col align="left" valign="top">
1189 <tbody>
1190 <tr>
1191 <td><p><span class="term"><em class="parameter"><code>v1</code></em> :</span></p></td>
1192 <td> a key.
1193 </td>
1194 </tr>
1195 <tr>
1196 <td><p><span class="term"><em class="parameter"><code>v2</code></em> :</span></p></td>
1197 <td> a key to compare with <em class="parameter"><code>v1</code></em>.
1198 </td>
1199 </tr>
1200 <tr>
1201 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1202 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the two keys match.
1203 </td>
1204 </tr>
1205 </tbody>
1206 </table></div>
1207 </div>
1208 <hr>
1209 <div class="refsect2" title="g_direct_hash ()">
1210 <a name="g-direct-hash"></a><h3>g_direct_hash ()</h3>
1211 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_direct_hash                       (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);</pre>
1212 <p>
1213 Converts a gpointer to a hash value.
1214 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>hash_func</code></em> parameter, 
1215 when using pointers as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1216 <div class="variablelist"><table border="0">
1217 <col align="left" valign="top">
1218 <tbody>
1219 <tr>
1220 <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td>
1221 <td> a <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> key
1222 </td>
1223 </tr>
1224 <tr>
1225 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1226 <td> a hash value corresponding to the key.
1227 </td>
1228 </tr>
1229 </tbody>
1230 </table></div>
1231 </div>
1232 <hr>
1233 <div class="refsect2" title="g_int_equal ()">
1234 <a name="g-int-equal"></a><h3>g_int_equal ()</h3>
1235 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_int_equal                         (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
1236                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);</pre>
1237 <p>
1238 Compares the two <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> values being pointed to and returns 
1239 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if they are equal.
1240 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>key_equal_func</code></em>
1241 parameter, when using pointers to integers as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1242 <div class="variablelist"><table border="0">
1243 <col align="left" valign="top">
1244 <tbody>
1245 <tr>
1246 <td><p><span class="term"><em class="parameter"><code>v1</code></em> :</span></p></td>
1247 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> key.
1248 </td>
1249 </tr>
1250 <tr>
1251 <td><p><span class="term"><em class="parameter"><code>v2</code></em> :</span></p></td>
1252 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> key to compare with <em class="parameter"><code>v1</code></em>.
1253 </td>
1254 </tr>
1255 <tr>
1256 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1257 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the two keys match.
1258 </td>
1259 </tr>
1260 </tbody>
1261 </table></div>
1262 </div>
1263 <hr>
1264 <div class="refsect2" title="g_int_hash ()">
1265 <a name="g-int-hash"></a><h3>g_int_hash ()</h3>
1266 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_int_hash                          (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);</pre>
1267 <p>
1268 Converts a pointer to a <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> to a hash value.
1269 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>hash_func</code></em> parameter, 
1270 when using pointers to integers values as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1271 <div class="variablelist"><table border="0">
1272 <col align="left" valign="top">
1273 <tbody>
1274 <tr>
1275 <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td>
1276 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> key
1277 </td>
1278 </tr>
1279 <tr>
1280 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1281 <td> a hash value corresponding to the key.
1282 </td>
1283 </tr>
1284 </tbody>
1285 </table></div>
1286 </div>
1287 <hr>
1288 <div class="refsect2" title="g_int64_equal ()">
1289 <a name="g-int64-equal"></a><h3>g_int64_equal ()</h3>
1290 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_int64_equal                       (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
1291                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);</pre>
1292 <p>
1293 Compares the two <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> values being pointed to and returns 
1294 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if they are equal.
1295 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>key_equal_func</code></em>
1296 parameter, when using pointers to 64-bit integers as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1297 <div class="variablelist"><table border="0">
1298 <col align="left" valign="top">
1299 <tbody>
1300 <tr>
1301 <td><p><span class="term"><em class="parameter"><code>v1</code></em> :</span></p></td>
1302 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> key.
1303 </td>
1304 </tr>
1305 <tr>
1306 <td><p><span class="term"><em class="parameter"><code>v2</code></em> :</span></p></td>
1307 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> key to compare with <em class="parameter"><code>v1</code></em>.
1308 </td>
1309 </tr>
1310 <tr>
1311 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1312 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the two keys match.
1313
1314 </td>
1315 </tr>
1316 </tbody>
1317 </table></div>
1318 <p class="since">Since 2.22</p>
1319 </div>
1320 <hr>
1321 <div class="refsect2" title="g_int64_hash ()">
1322 <a name="g-int64-hash"></a><h3>g_int64_hash ()</h3>
1323 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_int64_hash                        (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);</pre>
1324 <p>
1325 Converts a pointer to a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> to a hash value.
1326 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>hash_func</code></em> parameter, 
1327 when using pointers to 64-bit integers values as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1328 <div class="variablelist"><table border="0">
1329 <col align="left" valign="top">
1330 <tbody>
1331 <tr>
1332 <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td>
1333 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="type">gint64</span></a> key
1334 </td>
1335 </tr>
1336 <tr>
1337 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1338 <td> a hash value corresponding to the key.
1339
1340 </td>
1341 </tr>
1342 </tbody>
1343 </table></div>
1344 <p class="since">Since 2.22</p>
1345 </div>
1346 <hr>
1347 <div class="refsect2" title="g_double_equal ()">
1348 <a name="g-double-equal"></a><h3>g_double_equal ()</h3>
1349 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_double_equal                      (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
1350                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);</pre>
1351 <p>
1352 Compares the two <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> values being pointed to and returns 
1353 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if they are equal.
1354 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>key_equal_func</code></em>
1355 parameter, when using pointers to doubles as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1356 <div class="variablelist"><table border="0">
1357 <col align="left" valign="top">
1358 <tbody>
1359 <tr>
1360 <td><p><span class="term"><em class="parameter"><code>v1</code></em> :</span></p></td>
1361 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> key.
1362 </td>
1363 </tr>
1364 <tr>
1365 <td><p><span class="term"><em class="parameter"><code>v2</code></em> :</span></p></td>
1366 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> key to compare with <em class="parameter"><code>v1</code></em>.
1367 </td>
1368 </tr>
1369 <tr>
1370 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1371 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the two keys match.
1372
1373 </td>
1374 </tr>
1375 </tbody>
1376 </table></div>
1377 <p class="since">Since 2.22</p>
1378 </div>
1379 <hr>
1380 <div class="refsect2" title="g_double_hash ()">
1381 <a name="g-double-hash"></a><h3>g_double_hash ()</h3>
1382 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_double_hash                       (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);</pre>
1383 <p>
1384 Converts a pointer to a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> to a hash value.
1385 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>hash_func</code></em> parameter, 
1386 when using pointers to doubles as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1387 <div class="variablelist"><table border="0">
1388 <col align="left" valign="top">
1389 <tbody>
1390 <tr>
1391 <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td>
1392 <td> a pointer to a <a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> key
1393 </td>
1394 </tr>
1395 <tr>
1396 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1397 <td> a hash value corresponding to the key.
1398
1399 </td>
1400 </tr>
1401 </tbody>
1402 </table></div>
1403 <p class="since">Since 2.22</p>
1404 </div>
1405 <hr>
1406 <div class="refsect2" title="g_str_equal ()">
1407 <a name="g-str-equal"></a><h3>g_str_equal ()</h3>
1408 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_str_equal                         (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v1,
1409                                                          <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v2);</pre>
1410 <p>
1411 Compares two strings for byte-by-byte equality and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>
1412 if they are equal. It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the
1413 <em class="parameter"><code>key_equal_func</code></em> parameter, when using strings as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.
1414 </p>
1415 <p>
1416 Note that this function is primarily meant as a hash table comparison
1417 function. For a general-purpose, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>-safe string comparison function,
1418 see <a class="link" href="glib-String-Utility-Functions.html#g-strcmp0" title="g_strcmp0 ()"><code class="function">g_strcmp0()</code></a>.</p>
1419 <div class="variablelist"><table border="0">
1420 <col align="left" valign="top">
1421 <tbody>
1422 <tr>
1423 <td><p><span class="term"><em class="parameter"><code>v1</code></em> :</span></p></td>
1424 <td> a key
1425 </td>
1426 </tr>
1427 <tr>
1428 <td><p><span class="term"><em class="parameter"><code>v2</code></em> :</span></p></td>
1429 <td> a key to compare with <em class="parameter"><code>v1</code></em>
1430 </td>
1431 </tr>
1432 <tr>
1433 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1434 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the two keys match
1435 </td>
1436 </tr>
1437 </tbody>
1438 </table></div>
1439 </div>
1440 <hr>
1441 <div class="refsect2" title="g_str_hash ()">
1442 <a name="g-str-hash"></a><h3>g_str_hash ()</h3>
1443 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_str_hash                          (<a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="returnvalue">gconstpointer</span></a> v);</pre>
1444 <p>
1445 Converts a string to a hash value.
1446 It can be passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-new" title="g_hash_table_new ()"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>hash_func</code></em> 
1447 parameter, when using strings as keys in a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a>.</p>
1448 <div class="variablelist"><table border="0">
1449 <col align="left" valign="top">
1450 <tbody>
1451 <tr>
1452 <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td>
1453 <td> a string key
1454 </td>
1455 </tr>
1456 <tr>
1457 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1458 <td> a hash value corresponding to the key
1459 </td>
1460 </tr>
1461 </tbody>
1462 </table></div>
1463 </div>
1464 </div>
1465 </div>
1466 <div class="footer">
1467 <hr>
1468           Generated by GTK-Doc V1.13</div>
1469 </body>
1470 </html>