📄 glib-hook-functions.html
字号:
<a class="indexterm" name="id3056566"></a><pre class="programlisting">void (*GHookFinalizeFunc) (<a class="link" href="glib-Hook-Functions.html#GHookList">GHookList</a> *hook_list, <a class="link" href="glib-Hook-Functions.html#GHook">GHook</a> *hook);</pre><p>Defines the type of function to be called when a hook in a list of hooks gets finalized.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hook_list</code></em> :</span></p></td><td>a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>hook</code></em> :</span></p></td><td>the hook in <em class="parameter"><code>hook_list</code></em> that gets finalized</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3056649"></a><h3><a name="GHook"></a>GHook</h3><a class="indexterm" name="id3056662"></a><pre class="programlisting">typedef struct { gpointer data; GHook *next; GHook *prev; guint ref_count; gulong hook_id; guint flags; gpointer func; GDestroyNotify destroy;} GHook;</pre><p>The <span class="structname">GHook</span> struct represents a single hook function in a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <em class="structfield"><code>data</code></em>;</span></p></td><td>data which is passed to func when this hook is invoked</td></tr><tr><td><p><span class="term"><a class="link" href="glib-Hook-Functions.html#GHook">GHook</a> *<em class="structfield"><code>next</code></em>;</span></p></td><td>pointer to the next hook in the list</td></tr><tr><td><p><span class="term"><a class="link" href="glib-Hook-Functions.html#GHook">GHook</a> *<em class="structfield"><code>prev</code></em>;</span></p></td><td>pointer to the previous hook in the list</td></tr><tr><td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>ref_count</code></em>;</span></p></td><td>the reference count of this hook</td></tr><tr><td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gulong">gulong</a> <em class="structfield"><code>hook_id</code></em>;</span></p></td><td>the id of this hook, which is unique within its list</td></tr><tr><td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>flags</code></em>;</span></p></td><td>flags which are set for this hook. See <a class="link" href="glib-Hook-Functions.html#GHookFlagMask"><span class="type">GHookFlagMask</span></a> for predefined flags</td></tr><tr><td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <em class="structfield"><code>func</code></em>;</span></p></td><td>the function to call when this hook is invoked. The possible signatures for this function are <a class="link" href="glib-Hook-Functions.html#GHookFunc"><span class="type">GHookFunc</span></a> and <a class="link" href="glib-Hook-Functions.html#GHookCheckFunc"><span class="type">GHookCheckFunc</span></a></td></tr><tr><td><p><span class="term"><a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> <em class="structfield"><code>destroy</code></em>;</span></p></td><td>the default <code class="function">finalize_hook</code> function of a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a> calls this member of the hook that is being finalized</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3056904"></a><h3><a name="GHookFunc"></a>GHookFunc ()</h3><a class="indexterm" name="id3056916"></a><pre class="programlisting">void (*GHookFunc) (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Defines the type of a hook function that can be invokedby <a class="link" href="glib-Hook-Functions.html#g-hook-list-invoke"><code class="function">g_hook_list_invoke()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td>the data field of the <a class="link" href="glib-Hook-Functions.html#GHook"><span class="type">GHook</span></a> is passed to the hook function here</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3056983"></a><h3><a name="GHookCheckFunc"></a>GHookCheckFunc ()</h3><a class="indexterm" name="id3056995"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> (*GHookCheckFunc) (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>Defines the type of a hook function that can be invokedby <a class="link" href="glib-Hook-Functions.html#g-hook-list-invoke-check"><code class="function">g_hook_list_invoke_check()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td>the data field of the <a class="link" href="glib-Hook-Functions.html#GHook"><span class="type">GHook</span></a> is passed to the hook function here</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the <a class="link" href="glib-Hook-Functions.html#GHook"><span class="type">GHook</span></a> should be destroyed</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3057090"></a><h3><a name="g-hook-list-init"></a>g_hook_list_init ()</h3><a class="indexterm" name="id3057102"></a><pre class="programlisting">void g_hook_list_init (<a class="link" href="glib-Hook-Functions.html#GHookList">GHookList</a> *hook_list, <a class="link" href="glib-Basic-Types.html#guint">guint</a> hook_size);</pre><p>Initializes a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a>.This must be called before the <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a> is used.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>hook_list</code></em> :</span></p></td><td>a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>hook_size</code></em> :</span></p></td><td>the size of each element in the <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a>, typically <code class="literal">sizeof (GHook)</code></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3057209"></a><h3><a name="g-hook-list-invoke"></a>g_hook_list_invoke ()</h3><a class="indexterm" name="id3057222"></a><pre class="programlisting">void g_hook_list_invoke (<a class="link" href="glib-Hook-Functions.html#GHookList">GHookList</a> *hook_list, <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> may_recurse);</pre><p>Calls all of the <a class="link" href="glib-Hook-Functions.html#GHook"><span class="type">GHook</span></a> functions in a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</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>hook_list</code></em> :</span></p></td><td>a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>may_recurse</code></em> :</span></p></td><td><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if functions which are already running (e.g. in another thread) can be called. If set to <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, these are skipped</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3057335"></a><h3><a name="g-hook-list-invoke-check"></a>g_hook_list_invoke_check ()</h3><a class="indexterm" name="id3057348"></a><pre class="programlisting">void g_hook_list_invoke_check (<a class="link" href="glib-Hook-Functions.html#GHookList">GHookList</a> *hook_list, <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> may_recurse);</pre><p>Calls all of the <a class="link" href="glib-Hook-Functions.html#GHook"><span class="type">GHook</span></a> functions in a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a>.Any function which returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is removed from the <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</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>hook_list</code></em> :</span></p></td><td>a <a class="link" href="glib-Hook-Functions.html#GHookList"><span class="type">GHookList</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>may_recurse</code></em> :</span></p></td><td><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if functions which are already running (e.g. in anotherthread) can be called. If set to <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, these are skipped
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -