📄 glib-keyed-data-lists.html
字号:
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td>the data element or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to remove any previous elementcorresponding to <em class="parameter"><code>key_id</code></em>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>destroy_func</code></em> :</span></p></td><td>the function to call when the data element is removed. Thisfunction will be called with the data element and can be used to free anymemory allocated for it. If <em class="parameter"><code>data</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then <em class="parameter"><code>destroy_func</code></em> mustalso be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3354068"></a><h3><a name="g-datalist-id-get-data"></a>g_datalist_id_get_data ()</h3><a class="indexterm" name="id3354080"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> g_datalist_id_get_data (<a class="link" href="glib-Keyed-Data-Lists.html#GData">GData</a> **datalist, <a class="link" href="glib-Quarks.html#GQuark">GQuark</a> key_id);</pre><p>Retrieves the data element corresponding to <em class="parameter"><code>key_id</code></em>. </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>datalist</code></em> :</span></p></td><td>a datalist.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>key_id</code></em> :</span></p></td><td>the <a class="link" href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifying a data element.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the data element, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if it is not found.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3354185"></a><h3><a name="g-datalist-id-remove-data"></a>g_datalist_id_remove_data()</h3><a class="indexterm" name="id3354198"></a><pre class="programlisting">#define g_datalist_id_remove_data(dl, q)</pre><p>Removes an element, using its <a class="link" href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifier.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>dl</code></em> :</span></p></td><td>a datalist.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>q</code></em> :</span></p></td><td>the <a class="link" href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifying the data element.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3354262"></a><h3><a name="g-datalist-id-remove-no-notify"></a>g_datalist_id_remove_no_notify ()</h3><a class="indexterm" name="id3354276"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> g_datalist_id_remove_no_notify (<a class="link" href="glib-Keyed-Data-Lists.html#GData">GData</a> **datalist, <a class="link" href="glib-Quarks.html#GQuark">GQuark</a> key_id);</pre><p>Removes an element, without calling its destroy notification function.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>datalist</code></em> :</span></p></td><td>a datalist.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>key_id</code></em> :</span></p></td><td>the <a class="link" href="glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> identifying a data element.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the data previously stored at <em class="parameter"><code>key_id</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if none.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3354381"></a><h3><a name="g-datalist-set-data"></a>g_datalist_set_data()</h3><a class="indexterm" name="id3354395"></a><pre class="programlisting">#define g_datalist_set_data(dl, k, d)</pre><p>Sets the data element corresponding to the given string identifier.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>dl</code></em> :</span></p></td><td>a datalist.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>k</code></em> :</span></p></td><td>the string to identify the data element.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>d</code></em> :</span></p></td><td>the data element, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to remove any previous elementcorresponding to <em class="parameter"><code>k</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3354474"></a><h3><a name="g-datalist-set-data-full"></a>g_datalist_set_data_full()</h3><a class="indexterm" name="id3354487"></a><pre class="programlisting">#define g_datalist_set_data_full(dl, k, d, f)</pre><p>Sets the data element corresponding to the given string identifier, and thefunction to be called when the data element is removed.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>dl</code></em> :</span></p></td><td>a datalist.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>k</code></em> :</span></p></td><td>the string to identify the data element.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>d</code></em> :</span></p></td><td>the data element, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to remove any previous element corresponding to<em class="parameter"><code>k</code></em>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>f</code></em> :</span></p></td><td>the function to call when the data element is removed. Thisfunction will be called with the data element and can be used to free anymemory allocated for it. If <em class="parameter"><code>d</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then <em class="parameter"><code>f</code></em> must also be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3354616"></a><h3><a name="g-datalist-get-data"></a>g_datalist_get_data()</h3><a class="indexterm" name="id3354629"></a><pre class="programlisting">#define g_datalist_get_data(dl, k)</pre><p>Gets a data element, using its string identifer.This is slower than <a class="link" href="glib-Keyed-Data-Lists.html#g-datalist-id-get-data"><code class="function">g_datalist_id_get_data()</code></a> because the string is firstconverted to a <a class="link" href="glib-Quarks.html#GQuark"><span class="type">GQuark</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>dl</code></em> :</span></p></td><td>a datalist.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>k</code></em> :</span></p></td><td>the string identifying a data element.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the data element, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if it is not found.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3354718"></a><h3><a name="g-datalist-remove-data"></a>g_datalist_remove_data()</h3><a class="indexterm" name="id3354732"></a><pre class="programlisting">#define g_datalist_remove_data(dl, k)</pre><p>Removes an element using its string identifier.The data element's destroy function is called if it has been set.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -