?? glib-commandline-option-parser.html
字號:
<div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>group</code></em> :</span></td><td> a <a href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a></td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3066470"></a><h3><a name="g-option-group-add-entries"></a>g_option_group_add_entries ()</h3><a class="indexterm" name="id3066481"></a><pre class="programlisting">void g_option_group_add_entries (<a href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group, const <a href="glib-Commandline-option-parser.html#GOptionEntry">GOptionEntry</a> *entries);</pre><p>Adds the options specified in <em class="parameter"><code>entries</code></em> to <em class="parameter"><code>group</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>group</code></em> :</span></td><td> a <a href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>entries</code></em> :</span></td><td> a <code class="literal">NULL</code>-terminated array of <a href="glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntry</span></a>s</td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3066593"></a><h3><a name="GOptionParseFunc"></a>GOptionParseFunc ()</h3><a class="indexterm" name="id3066603"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> (*GOptionParseFunc) (<a href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context, <a href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>The type of function that can be called before and after parsing.</p><em class="parameter"><code>context</code></em> The active <a href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td></td></tr><tr><td><span class="term"><em class="parameter"><code>group</code></em> :</span></td><td>The group to which the function belongs</td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td>User data added to the <a href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> containing the option when it was created with <a href="glib-Commandline-option-parser.html#g-option-group-new"><code class="function">g_option_group_new()</code></a></td></tr><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td>A return location for error details</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><code class="literal">TRUE</code> if the function completed successfully, <code class="literal">FALSE</code> if an error occurred</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3066773"></a><h3><a name="g-option-group-set-parse-hooks"></a>g_option_group_set_parse_hooks ()</h3><a class="indexterm" name="id3066785"></a><pre class="programlisting">void g_option_group_set_parse_hooks (<a href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group, <a href="glib-Commandline-option-parser.html#GOptionParseFunc">GOptionParseFunc</a> pre_parse_func, <a href="glib-Commandline-option-parser.html#GOptionParseFunc">GOptionParseFunc</a> post_parse_func);</pre><p>Associates two functions with <em class="parameter"><code>group</code></em> which will be called from <a href="glib-Commandline-option-parser.html#g-option-context-parse"><code class="function">g_option_context_parse()</code></a> before the first option is parsedand after the last option has been parsed, respectively.</p><p>Note that the user data to be passed to <em class="parameter"><code>pre_parse_func</code></em> and<em class="parameter"><code>post_parse_func</code></em> can be specified when constructing the groupwith <a href="glib-Commandline-option-parser.html#g-option-group-new"><code class="function">g_option_group_new()</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>group</code></em> :</span></td><td> a <a href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>pre_parse_func</code></em> :</span></td><td> a function to call before parsing, or <code class="literal">NULL</code></td></tr><tr><td><span class="term"><em class="parameter"><code>post_parse_func</code></em> :</span></td><td> a function to call after parsing, or <code class="literal">NULL</code></td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3066950"></a><h3><a name="GOptionErrorFunc"></a>GOptionErrorFunc ()</h3><a class="indexterm" name="id3066961"></a><pre class="programlisting">void (*GOptionErrorFunc) (<a href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context, <a href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>The type of function to be used as callback when a parse erroroccurs.</p><em class="parameter"><code>context</code></em> The active <a href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td></td></tr><tr><td><span class="term"><em class="parameter"><code>group</code></em> :</span></td><td>The group to which the function belongs</td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td>User data added to the <a href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> containing the option when it was created with <a href="glib-Commandline-option-parser.html#g-option-group-new"><code class="function">g_option_group_new()</code></a></td></tr><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td>The <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> containing details about the parse error</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3067117"></a><h3><a name="g-option-group-set-error-hook"></a>g_option_group_set_error_hook ()</h3><a class="indexterm" name="id3067128"></a><pre class="programlisting">void g_option_group_set_error_hook (<a href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group, <a href="glib-Commandline-option-parser.html#GOptionErrorFunc">GOptionErrorFunc</a> error_func);</pre><p>Associates a function with <em class="parameter"><code>group</code></em> which will be called from <a href="glib-Commandline-option-parser.html#g-option-context-parse"><code class="function">g_option_context_parse()</code></a> when an error occurs.</p><p>Note that the user data to be passed to <em class="parameter"><code>pre_parse_func</code></em> and<em class="parameter"><code>post_parse_func</code></em> can be specified when constructing the groupwith <a href="glib-Commandline-option-parser.html#g-option-group-new"><code class="function">g_option_group_new()</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>group</code></em> :</span></td><td> a <a href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>error_func</code></em> :</span></td><td> a function to call when an error occurs</td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3067259"></a><h3><a name="GTranslateFunc"></a>GTranslateFunc ()</h3><a class="indexterm" name="id3067270"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* (*GTranslateFunc) (const <a href="glib-Basic-Types.html#gchar">gchar</a> *str, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>The type of functions which are used to translate user-visiblestrings, for <code class="option">--help</code> output.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>str</code></em> :</span></td><td>the untranslated string</td></tr><tr><td><span class="term"><em class="parameter"><code>data</code></em> :</span></td><td>user data specified when installing the function, e.g. in <a href="glib-Commandline-option-parser.html#g-option-group-set-translate-func"><code class="function">g_option_group_set_translate_func()</code></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a translation of the string for the current locale. The returned string is owned by GLib and must not be freed.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3067368"></a><h3><a name="g-option-group-set-translate-func"></a>g_option_group_set_translate_func ()</h3><a class="indexterm" name="id3067380"></a><pre class="programlisting">void g_option_group_set_translate_func (<a href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group, <a href="glib-Commandline-option-parser.html#GTranslateFunc">GTranslateFunc</a> func, <a href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> destroy_notify);</pre><p>Sets the function which is used to translate user-visiblestrings, for <code class="option">--help</code> output. Differentgroups can use different <a href="glib-Commandline-option-parser.html#GTranslateFunc"><span class="type">GTranslateFunc</span></a>s. If <em class="parameter"><code>func</code></em>is <code class="literal">NULL</code>, strings are not translated.</p><p>If you are using <ahref="../libbonobo/libbonobo-bonobo-i18n.html#gettext"><code class="function">gettext()</code></a>, you only need to
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -