📄 hooks.sgml
字号:
</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-insert-sorted">g_hook_insert_sorted ()</title><programlisting>void g_hook_insert_sorted (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="GHook">GHook</link> *hook, <link linkend="GHookCompareFunc">GHookCompareFunc</link> func);</programlisting><para>Inserts a <link linkend="GHook">GHook</link> into a <link linkend="GHookList">GHookList</link>, sorted by the given function.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to insert.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the comparison function used to sort the <link linkend="GHook">GHook</link> elements.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GHookCompareFunc">GHookCompareFunc ()</title><programlisting><link linkend="gint">gint</link> (*GHookCompareFunc) (<link linkend="GHook">GHook</link> *new_hook, <link linkend="GHook">GHook</link> *sibling);</programlisting><para>Defines the type of function used to compare <link linkend="GHook">GHook</link> elements in<link linkend="g-hook-insert-sorted">g_hook_insert_sorted</link>().</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>new_hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> being inserted.</entry></row><row><entry align="right"><parameter>sibling</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to compare with <parameter>new_hook</parameter>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a value <= 0 if <parameter>new_hook</parameter> should be before <parameter>sibling</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-compare-ids">g_hook_compare_ids ()</title><programlisting><link linkend="gint">gint</link> g_hook_compare_ids (<link linkend="GHook">GHook</link> *new_hook, <link linkend="GHook">GHook</link> *sibling);</programlisting><para>Compares the ids of two <link linkend="GHook">GHook</link> elements, returning a negative valueif the second id is greater than the first.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>new_hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><parameter>sibling</parameter> :</entry><entry>a <link linkend="GHook">GHook</link> to compare with <parameter>new_hook</parameter>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a value <= 0 if the id of <parameter>sibling</parameter> is >= the id of <parameter>new_hook</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-get">g_hook_get ()</title><programlisting><link linkend="GHook">GHook</link>* g_hook_get (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gulong">gulong</link> hook_id);</programlisting><para>Returns the <link linkend="GHook">GHook</link> with the given id, or <literal>NULL</literal> if it is not found.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook_id</parameter> :</entry><entry>a hook id.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the <link linkend="GHook">GHook</link> with the given id, or <literal>NULL</literal> if it is not found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-find">g_hook_find ()</title><programlisting><link linkend="GHook">GHook</link>* g_hook_find (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> need_valids, <link linkend="GHookFindFunc">GHookFindFunc</link> func, <link linkend="gpointer">gpointer</link> data);</programlisting><para>Finds a <link linkend="GHook">GHook</link> in a <link linkend="GHookList">GHookList</link> using the given function to test for a match.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>need_valids</parameter> :</entry><entry><literal>TRUE</literal> if <link linkend="GHook">GHook</link> elements which have been destroyed should beskipped.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the function to call for each <link linkend="GHook">GHook</link>, which should return <literal>TRUE</literal> whenthe <link linkend="GHook">GHook</link> has been found.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry><entry>the data to pass to <parameter>func</parameter>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the found <link linkend="GHook">GHook</link> or <literal>NULL</literal> if no matching <link linkend="GHook">GHook</link> is found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GHookFindFunc">GHookFindFunc ()</title><programlisting><link linkend="gboolean">gboolean</link> (*GHookFindFunc) (<link linkend="GHook">GHook</link> *hook, <link linkend="gpointer">gpointer</link> data);</programlisting><para>Defines the type of the function passed to <link linkend="g-hook-find">g_hook_find</link>().</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry><entry>user data passed to <link linkend="g-hook-find-func">g_hook_find_func</link>().</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the required <link linkend="GHook">GHook</link> has been found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-find-data">g_hook_find_data ()</title><programlisting><link linkend="GHook">GHook</link>* g_hook_find_data (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> need_valids, <link linkend="gpointer">gpointer</link> data);</programlisting><para>Finds a <link linkend="GHook">GHook</link> in a <link linkend="GHookList">GHookList</link> with the given data.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>need_valids</parameter> :</entry><entry><literal>TRUE</literal> if <link linkend="GHook">GHook</link> elements which have been destroyed should beskipped.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry><entry>the data to find.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the <link linkend="GHook">GHook</link> with the given <parameter>data</parameter> or <literal>NULL</literal> if no matching<link linkend="GHook">GHook</link> is found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-find-func">g_hook_find_func ()</title><programlisting><link linkend="GHook">GHook</link>* g_hook_find_func (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> need_valids, <link linkend="gpointer">gpointer</link> func);</programlisting><para>Finds a <link linkend="GHook">GHook</link> in a <link linkend="GHookList">GHookList</link> with the given function.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>need_valids</parameter> :</entry><entry><literal>TRUE</literal> if <link linkend="GHook">GHook</link> elements which have been destroyed should beskipped.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the function to find.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the <link linkend="GHook">GHook</link> with the given <parameter>func</parameter> or <literal>NULL</literal> if no matching<link linkend="GHook">GHook</link> is found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-find-func-data">g_hook_find_func_data ()</title><programlisting><link linkend="GHook">GHook</link>* g_hook_find_func_data (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> need_valids, <link linkend="gpointer">gpointer</link> func, <link linkend="gpointer">gpointer</link> data);</programlisting><para>Finds a <link linkend="GHook">GHook</link> in a <link linkend="GHookList">GHookList</link> with the given function and data.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>need_valids</parameter> :</entry><entry><literal>TRUE</literal> if <link linkend="GHook">GHook</link> elements which have been destroyed should beskipped.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the function to find.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry><entry>the data to find.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the <link linkend="GHook">GHook</link> with the given <parameter>func</parameter> and <parameter>data</parameter> or <literal>NULL</literal> if no matching<link linkend="GHook">GHook</link> is found.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-first-valid">g_hook_first_valid ()</title><programlisting><link linkend="GHook">GHook</link>* g_hook_first_valid (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gboolean">gboolean</link> may_be_in_call);</programlisting><para>Returns the first <link linkend="GHook">GHook</link> in a <link linkend="GHookList">GHookList</link> which has not been destroyed.The reference count for the <link linkend="GHook">GHook</link> is incremented, so you must call<link linkend="g-hook-unref">g_hook_unref</link>() to restore it when no longer needed. (Or call<link linkend="g-hook-next-valid">g_hook_next_valid</link>() if you are stepping through the <link linkend="GHookList">GHookList</link>.)</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>may_be_in_call</parameter> :</entry><entry><literal>TRUE</literal> if hooks which are currently running (e.g. in anotherthread) are considered valid. If set to <literal>FALSE</literal>, these are skipped.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the first valid <link linkend="GHook">GHook</link>, or <literal>NULL</literal> if none are valid.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-next-valid">g_hook_next_valid ()</title><programlisting><link linkend="GHook">GHook</link>* g_hook_next_valid (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="GHook">GHook</link> *hook, <link linkend="gboolean">gboolean</link> may_be_in_call);</programlisting><para>Returns the next <link linkend="GHook">GHook</link> in a <link linkend="GHookList">GHookList</link> which has not been destroyed.The reference count for the <link linkend="GHook">GHook</link> is incremented, so you must call<link linkend="g-hook-unref">g_hook_unref</link>() to restore it when no longer needed. (Or continue to call<link linkend="g-hook-next-valid">g_hook_next_valid</link>() until <literal>NULL</literal> is returned.)</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -