glib-hash-tables.html

来自「最新gtk中文资料集」· HTML 代码 · 共 1,055 行 · 第 1/5 页

HTML
1,055
字号
<p>Removes all keys and their associated values from a <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p><p>If the <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> was created using <a class="link" href="glib-Hash-Tables.html#g-hash-table-new-full"><code class="function">g_hash_table_new_full()</code></a>, the keysand values are freed using the supplied destroy functions, otherwise youhave to make sure that any dynamically allocated values are freedyourself.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></p></td><td> a <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a></td></tr></tbody></table></div><p class="since">Since  2.12</p></div><hr><div class="refsect2" lang="en"><a name="id3291397"></a><h3><a name="g-hash-table-steal-all"></a>g_hash_table_steal_all ()</h3><a class="indexterm" name="id3291412"></a><pre class="programlisting">void                g_hash_table_steal_all              (<a class="link" href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre><p>Removes all keys and their associated values from a <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>without calling the key and value destroy functions.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></p></td><td> a <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</td></tr></tbody></table></div><p class="since">Since  2.12</p></div><hr><div class="refsect2" lang="en"><a name="id3291487"></a><h3><a name="g-hash-table-get-keys"></a>g_hash_table_get_keys ()</h3><a class="indexterm" name="id3291502"></a><pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList">GList</a>*              g_hash_table_get_keys               (<a class="link" href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre><p>Retrieves every key inside <em class="parameter"><code>hash_table</code></em>. The returned data is validuntil <em class="parameter"><code>hash_table</code></em> is modified.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></p></td><td> a <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a <a class="link" href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> containing all the keys inside the hash  table. The content of the list is owned by the hash table and  should not be modified or freed. Use <a class="link" href="glib-Doubly-Linked-Lists.html#g-list-free"><code class="function">g_list_free()</code></a> when done  using the list.</td></tr></tbody></table></div><p class="since">Since  2.14</p></div><hr><div class="refsect2" lang="en"><a name="id3291611"></a><h3><a name="g-hash-table-get-values"></a>g_hash_table_get_values ()</h3><a class="indexterm" name="id3291626"></a><pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList">GList</a>*              g_hash_table_get_values             (<a class="link" href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre><p>Retrieves every value inside <em class="parameter"><code>hash_table</code></em>. The returned data isvalid until <em class="parameter"><code>hash_table</code></em> is modified.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></p></td><td> a <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a <a class="link" href="glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> containing all the values inside the hash  table. The content of the list is owned by the hash table and  should not be modified or freed. Use <a class="link" href="glib-Doubly-Linked-Lists.html#g-list-free"><code class="function">g_list_free()</code></a> when done  using the list.</td></tr></tbody></table></div><p class="since">Since  2.14</p></div><hr><div class="refsect2" lang="en"><a name="id3291735"></a><h3><a name="GHRFunc"></a>GHRFunc ()</h3><a class="indexterm" name="id3291747"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            (*GHRFunc)                          (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> key,                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> value,                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Specifies the type of the function passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach-remove"><code class="function">g_hash_table_foreach_remove()</code></a>.It is called with each key/value pair, together with the <em class="parameter"><code>user_data</code></em> parameterpassed to <a class="link" href="glib-Hash-Tables.html#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"><code class="literal">TRUE</code></a> if the key/value pair should be removed from the<a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></p></td><td>a key.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></p></td><td>the value associated with the key.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></p></td><td>user data passed to <a class="link" href="glib-Hash-Tables.html#g-hash-table-remove"><code class="function">g_hash_table_remove()</code></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the key/value pair should be removed from the <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3291924"></a><h3><a name="g-hash-table-freeze"></a>g_hash_table_freeze()</h3><a class="indexterm" name="id3291940"></a><pre class="programlisting">#define             g_hash_table_freeze(hash_table)</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_hash_table_freeze</code> is deprecated and should not be used in newly-written code.</p></div><p>This function is deprecated and will be removed in the next major release of GLib. It does nothing.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></p></td><td>a <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3291995"></a><h3><a name="g-hash-table-thaw"></a>g_hash_table_thaw()</h3><a class="indexterm" name="id3292010"></a><pre class="programlisting">#define             g_hash_table_thaw(hash_table)</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_hash_table_thaw</code> is deprecated and should not be used in newly-written code.</p></div><p>This function is deprecated and will be removed in the next major release of GLib. It does nothing.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></p></td><td>a <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3292066"></a><h3><a name="g-hash-table-destroy"></a>g_hash_table_destroy ()</h3><a class="indexterm" name="id3292078"></a><pre class="programlisting">void                g_hash_table_destroy                (<a class="link" href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre><p>Destroys all keys and values in the <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> and decrements itsreference count by 1. If keys and/or values are dynamically allocated,you should either free them first or create the <a class="link" href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> with destroynotifiers using <a class="link" href="glib-Hash-Tables.html#g-hash-table-new-full"><code class="function">g_hash_table_new_full

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?