36
37
<th width="100%" align="center">GLib Reference Manual</th>
37
38
<td><a accesskey="n" href="glib-Glob-style-pattern-matching.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
39
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3182473" class="shortcut">Top</a>
41
<a href="#id3183551" class="shortcut">Description</a></nobr></td></tr>
40
<tr><td colspan="5" class="shortcuts">
41
<a href="#glib-Commandline-option-parser.synopsis" class="shortcut">Top</a>
43
<a href="#glib-Commandline-option-parser.description" class="shortcut">Description</a>
43
46
<div class="refentry" lang="en">
44
47
<a name="glib-Commandline-option-parser"></a><div class="titlepage"></div>
45
48
<div class="refnamediv"><table width="100%"><tr>
48
<a name="id3182473"></a><span class="refentrytitle">Commandline option parser</span>
50
<p>Commandline option parser — parses commandline options</p>
50
<h2><span class="refentrytitle"><a name="glib-Commandline-option-parser.top_of_page"></a>Commandline option parser</span></h2>
51
<p>Commandline option parser — parses commandline options</p>
52
53
<td valign="top" align="right"></td>
53
54
</tr></table></div>
54
55
<div class="refsynopsisdiv">
56
<a name="glib-Commandline-option-parser.synopsis"></a><h2>Synopsis</h2>
56
57
<pre class="synopsis">
58
59
#include <glib.h>
61
enum <a class="link" href="glib-Commandline-option-parser.html#GOptionError">GOptionError</a>;
62
#define <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ERROR:CAPS">G_OPTION_ERROR</a>
63
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionArgFunc">*GOptionArgFunc</a>) (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *option_name,
64
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *value,
65
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
66
<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
67
<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a>;
68
<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a>* <a class="link" href="glib-Commandline-option-parser.html#g-option-context-new">g_option_context_new</a> (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *parameter_string);
69
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-summary">g_option_context_set_summary</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
70
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *summary);
71
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-summary">g_option_context_get_summary</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);
72
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-description">g_option_context_set_description</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
73
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *description);
74
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-description">g_option_context_get_description</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);
75
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* (<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc">*GTranslateFunc</a>) (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *str,
76
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);
77
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translate-func">g_option_context_set_translate_func</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
78
<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc">GTranslateFunc</a> func,
79
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
80
<a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> destroy_notify);
81
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translation-domain">g_option_context_set_translation_domain</a>
82
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
83
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *domain);
84
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-free">g_option_context_free</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);
85
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse">g_option_context_parse</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
86
<a class="link" href="glib-Basic-Types.html#gint">gint</a> *argc,
87
<a class="link" href="glib-Basic-Types.html#gchar">gchar</a> ***argv,
88
<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
89
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-help-enabled">g_option_context_set_help_enabled</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
90
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> help_enabled);
91
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-help-enabled">g_option_context_get_help_enabled</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);
92
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-ignore-unknown-options">g_option_context_set_ignore_unknown_options</a>
93
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
94
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> ignore_unknown);
95
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-ignore-unknown-options">g_option_context_get_ignore_unknown_options</a>
96
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);
97
<a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-help">g_option_context_get_help</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
98
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> main_help,
99
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group);
100
enum <a class="link" href="glib-Commandline-option-parser.html#GOptionArg">GOptionArg</a>;
101
enum <a class="link" href="glib-Commandline-option-parser.html#GOptionFlags">GOptionFlags</a>;
102
#define <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-REMAINING:CAPS">G_OPTION_REMAINING</a>
103
<a class="link" href="glib-Commandline-option-parser.html#GOptionEntry">GOptionEntry</a>;
104
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-add-main-entries">g_option_context_add_main_entries</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
105
const <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry">GOptionEntry</a> *entries,
106
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *translation_domain);
107
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a>;
108
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-add-group">g_option_context_add_group</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
109
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group);
110
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-main-group">g_option_context_set_main_group</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
111
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group);
112
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a>* <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-main-group">g_option_context_get_main_group</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);
113
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a>* <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new">g_option_group_new</a> (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *name,
114
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *description,
115
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *help_description,
116
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data,
117
<a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> destroy);
118
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-free">g_option_group_free</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group);
119
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-add-entries">g_option_group_add_entries</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
120
const <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry">GOptionEntry</a> *entries);
121
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc">*GOptionParseFunc</a>) (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
122
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
123
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
124
<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
125
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-parse-hooks">g_option_group_set_parse_hooks</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
126
<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc">GOptionParseFunc</a> pre_parse_func,
127
<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc">GOptionParseFunc</a> post_parse_func);
128
void (<a class="link" href="glib-Commandline-option-parser.html#GOptionErrorFunc">*GOptionErrorFunc</a>) (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
129
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
130
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
131
<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
132
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-error-hook">g_option_group_set_error_hook</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
133
<a class="link" href="glib-Commandline-option-parser.html#GOptionErrorFunc">GOptionErrorFunc</a> error_func);
134
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translate-func">g_option_group_set_translate_func</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
135
<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc">GTranslateFunc</a> func,
136
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
137
<a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> destroy_notify);
138
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translation-domain">g_option_group_set_translation_domain</a>
139
(<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
140
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *domain);
61
enum <a class="link" href="glib-Commandline-option-parser.html#GOptionError" title="enum GOptionError">GOptionError</a>;
62
#define <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ERROR--CAPS" title="G_OPTION_ERROR">G_OPTION_ERROR</a>
63
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionArgFunc" title="GOptionArgFunc ()">*GOptionArgFunc</a>) (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *option_name,
64
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *value,
65
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
66
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
67
<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a>;
68
<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> * <a class="link" href="glib-Commandline-option-parser.html#g-option-context-new" title="g_option_context_new ()">g_option_context_new</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *parameter_string);
69
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-summary" title="g_option_context_set_summary ()">g_option_context_set_summary</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
70
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *summary);
71
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-summary" title="g_option_context_get_summary ()">g_option_context_get_summary</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);
72
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-description" title="g_option_context_set_description ()">g_option_context_set_description</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
73
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *description);
74
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-description" title="g_option_context_get_description ()">g_option_context_get_description</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);
75
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * (<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc" title="GTranslateFunc ()">*GTranslateFunc</a>) (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *str,
76
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data);
77
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translate-func" title="g_option_context_set_translate_func ()">g_option_context_set_translate_func</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
78
<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc" title="GTranslateFunc ()">GTranslateFunc</a> func,
79
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
80
<a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()">GDestroyNotify</a> destroy_notify);
81
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translation-domain" title="g_option_context_set_translation_domain ()">g_option_context_set_translation_domain</a>
82
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
83
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain);
84
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-free" title="g_option_context_free ()">g_option_context_free</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);
85
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse" title="g_option_context_parse ()">g_option_context_parse</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
86
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> *argc,
87
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> ***argv,
88
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
89
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-help-enabled" title="g_option_context_set_help_enabled ()">g_option_context_set_help_enabled</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
90
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> help_enabled);
91
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-help-enabled" title="g_option_context_get_help_enabled ()">g_option_context_get_help_enabled</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);
92
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-ignore-unknown-options" title="g_option_context_set_ignore_unknown_options ()">g_option_context_set_ignore_unknown_options</a>
93
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
94
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> ignore_unknown);
95
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-ignore-unknown-options" title="g_option_context_get_ignore_unknown_options ()">g_option_context_get_ignore_unknown_options</a>
96
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);
97
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-help" title="g_option_context_get_help ()">g_option_context_get_help</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
98
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> main_help,
99
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group);
100
enum <a class="link" href="glib-Commandline-option-parser.html#GOptionArg" title="enum GOptionArg">GOptionArg</a>;
101
enum <a class="link" href="glib-Commandline-option-parser.html#GOptionFlags" title="enum GOptionFlags">GOptionFlags</a>;
102
#define <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-REMAINING--CAPS" title="G_OPTION_REMAINING">G_OPTION_REMAINING</a>
103
<a class="link" href="glib-Commandline-option-parser.html#GOptionEntry" title="GOptionEntry">GOptionEntry</a>;
104
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-add-main-entries" title="g_option_context_add_main_entries ()">g_option_context_add_main_entries</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
105
const <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry" title="GOptionEntry">GOptionEntry</a> *entries,
106
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *translation_domain);
107
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a>;
108
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-add-group" title="g_option_context_add_group ()">g_option_context_add_group</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
109
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group);
110
void <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-main-group" title="g_option_context_set_main_group ()">g_option_context_set_main_group</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
111
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group);
112
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> * <a class="link" href="glib-Commandline-option-parser.html#g-option-context-get-main-group" title="g_option_context_get_main_group ()">g_option_context_get_main_group</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);
113
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> * <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new" title="g_option_group_new ()">g_option_group_new</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *name,
114
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *description,
115
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *help_description,
116
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data,
117
<a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()">GDestroyNotify</a> destroy);
118
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-free" title="g_option_group_free ()">g_option_group_free</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group);
119
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-add-entries" title="g_option_group_add_entries ()">g_option_group_add_entries</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
120
const <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry" title="GOptionEntry">GOptionEntry</a> *entries);
121
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc" title="GOptionParseFunc ()">*GOptionParseFunc</a>) (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
122
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
123
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
124
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
125
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-parse-hooks" title="g_option_group_set_parse_hooks ()">g_option_group_set_parse_hooks</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
126
<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc" title="GOptionParseFunc ()">GOptionParseFunc</a> pre_parse_func,
127
<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc" title="GOptionParseFunc ()">GOptionParseFunc</a> post_parse_func);
128
void (<a class="link" href="glib-Commandline-option-parser.html#GOptionErrorFunc" title="GOptionErrorFunc ()">*GOptionErrorFunc</a>) (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
129
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
130
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
131
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);
132
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-error-hook" title="g_option_group_set_error_hook ()">g_option_group_set_error_hook</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
133
<a class="link" href="glib-Commandline-option-parser.html#GOptionErrorFunc" title="GOptionErrorFunc ()">GOptionErrorFunc</a> error_func);
134
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translate-func" title="g_option_group_set_translate_func ()">g_option_group_set_translate_func</a> (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
135
<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc" title="GTranslateFunc ()">GTranslateFunc</a> func,
136
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
137
<a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()">GDestroyNotify</a> destroy_notify);
138
void <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translation-domain" title="g_option_group_set_translation_domain ()">g_option_group_set_translation_domain</a>
139
(<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
140
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain);
144
143
<div class="refsect1" lang="en">
145
<a name="id3183551"></a><h2>Description</h2>
144
<a name="glib-Commandline-option-parser.description"></a><h2>Description</h2>
147
146
The GOption commandline parser is intended to be a simpler replacement for the
148
popt library. It supports short and long commandline options, as shown in the
147
popt library. It supports short and long commandline options, as shown in the
149
148
following example:
163
162
Long options are prefixed by two consecutive dashes.
166
Options can have an extra argument, which can be a number, a string or a
167
filename. For long options, the extra argument can be appended with an
165
Options can have an extra argument, which can be a number, a string or a
166
filename. For long options, the extra argument can be appended with an
168
167
equals sign after the option name.
171
170
Non-option arguments are returned to the application as rest arguments.
174
An argument consisting solely of two dashes turns off further parsing,
175
any remaining arguments (even those starting with a dash) are returned
173
An argument consisting solely of two dashes turns off further parsing,
174
any remaining arguments (even those starting with a dash) are returned
176
175
to the application as rest arguments.
182
Another important feature of GOption is that it can automatically generate
183
nicely formatted help output. Unless it is explicitly turned off with
184
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-help-enabled"><code class="function">g_option_context_set_help_enabled()</code></a>, GOption will recognize the
181
Another important feature of GOption is that it can automatically generate
182
nicely formatted help output. Unless it is explicitly turned off with
183
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-help-enabled" title="g_option_context_set_help_enabled ()"><code class="function">g_option_context_set_help_enabled()</code></a>, GOption will recognize the
185
184
<code class="option">--help</code>, <code class="option">-?</code>, <code class="option">--help-all</code>
186
and <code class="option">--help-</code><em class="replaceable"><code>groupname</code></em> options
187
(where <em class="replaceable"><code>groupname</code></em> is the name of a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>)
185
and <code class="option">--help-</code><em class="replaceable"><code>groupname</code></em> options
186
(where <em class="replaceable"><code>groupname</code></em> is the name of a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>)
188
187
and write a text similar to the one shown in the following example to stdout.
190
189
<div class="informalexample"><pre class="screen">
192
191
testtreemodel [OPTION...] - test tree model performance
195
193
-?, --help Show help options
196
194
--help-all Show all help options
197
195
--help-gtk Show GTK+ Options
199
196
Application Options:
200
197
-r, --repeats=N Average over N repetitions
201
198
-m, --max-size=M Test up to 2^M items
202
199
--display=DISPLAY X display to use
203
200
-v, --verbose Be verbose
204
-b, --beep Beep when done
201
-b, --beep Beep when done
205
202
--rand Randomize the data
208
GOption groups options in <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>s, which makes it easy to
205
GOption groups options in <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>s, which makes it easy to
209
206
incorporate options from multiple sources. The intended use for this is
210
207
to let applications collect option groups from the libraries it uses,
211
add them to their <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>, and parse all options by a single call
212
to <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse"><code class="function">g_option_context_parse()</code></a>. See <a
208
add them to their <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>, and parse all options by a single call
209
to <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse" title="g_option_context_parse ()"><code class="function">g_option_context_parse()</code></a>. See <a
213
210
href="/usr/share/gtk-doc/html/gtk/gtk-General.html#gtk-get-option-group"
214
211
><code class="function">gtk_get_option_group()</code></a> for an example.
303
293
<div class="refsect2" lang="en">
304
<a name="id3183946"></a><h3>
305
<a name="G-OPTION-ERROR:CAPS"></a>G_OPTION_ERROR</h3>
306
<a class="indexterm" name="id3183959"></a><pre class="programlisting">#define G_OPTION_ERROR (g_option_error_quark ())
294
<a name="G-OPTION-ERROR--CAPS"></a><h3>G_OPTION_ERROR</h3>
295
<pre class="programlisting">#define G_OPTION_ERROR (g_option_error_quark ())
309
298
Error domain for option parsing. Errors in this domain will
310
be from the <a class="link" href="glib-Commandline-option-parser.html#GOptionError"><span class="type">GOptionError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for information on
299
be from the <a class="link" href="glib-Commandline-option-parser.html#GOptionError" title="enum GOptionError"><span class="type">GOptionError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> for information on
315
304
<div class="refsect2" lang="en">
316
<a name="id3183992"></a><h3>
317
<a name="GOptionArgFunc"></a>GOptionArgFunc ()</h3>
318
<a class="indexterm" name="id3184005"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> (*GOptionArgFunc) (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *option_name,
319
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *value,
320
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
321
<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
305
<a name="GOptionArgFunc"></a><h3>GOptionArgFunc ()</h3>
306
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> (*GOptionArgFunc) (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *option_name,
307
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *value,
308
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
309
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
323
The type of function to be passed as callback for <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK:CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a>
311
The type of function to be passed as callback for <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK--CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a>
326
314
<div class="variablelist"><table border="0">
327
315
<col align="left" valign="top">
330
<td><p><span class="term"><em class="parameter"><code>option_name</code></em> :</span></p></td>
318
<td><p><span class="term"><em class="parameter"><code>option_name</code></em> :</span></p></td>
331
319
<td>The name of the option being parsed. This will be either a
332
320
single dash followed by a single letter (for a short name) or two dashes
333
321
followed by a long option name.
337
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
325
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
338
326
<td>The value to be parsed.
342
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
343
<td>User data added to the <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> containing the option when it
344
was created with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new"><code class="function">g_option_group_new()</code></a>
348
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
349
<td>A return location for errors. The error code <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ERROR-FAILED:CAPS"><code class="literal">G_OPTION_ERROR_FAILED</code></a>
350
is intended to be used for errors in <a class="link" href="glib-Commandline-option-parser.html#GOptionArgFunc"><span class="type">GOptionArgFunc</span></a> callbacks.
354
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
356
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the option was successfully parsed, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error
357
occurred, in which case <em class="parameter"><code>error</code></em> should be set with <a class="link" href="glib-Error-Reporting.html#g-set-error"><code class="function">g_set_error()</code></a>
330
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
331
<td>User data added to the <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a> containing the option when it
332
was created with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new" title="g_option_group_new ()"><code class="function">g_option_group_new()</code></a>
336
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
337
<td>A return location for errors. The error code <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ERROR-FAILED--CAPS"><code class="literal">G_OPTION_ERROR_FAILED</code></a>
338
is intended to be used for errors in <a class="link" href="glib-Commandline-option-parser.html#GOptionArgFunc" title="GOptionArgFunc ()"><span class="type">GOptionArgFunc</span></a> callbacks.
342
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
343
<td>%TRUE if the option was successfully parsed, <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error
344
occurred, in which case <em class="parameter"><code>error</code></em> should be set with <a class="link" href="glib-Error-Reporting.html#g-set-error" title="g_set_error ()"><code class="function">g_set_error()</code></a>
442
422
Note that the summary is translated (see
443
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translate-func"><code class="function">g_option_context_set_translate_func()</code></a>, <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translation-domain"><code class="function">g_option_context_set_translation_domain()</code></a>).</p>
423
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translate-func" title="g_option_context_set_translate_func ()"><code class="function">g_option_context_set_translate_func()</code></a>, <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translation-domain" title="g_option_context_set_translation_domain ()"><code class="function">g_option_context_set_translation_domain()</code></a>).</p>
447
426
<div class="variablelist"><table border="0">
448
427
<col align="left" valign="top">
451
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
452
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
430
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
431
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
456
<td><p><span class="term"><em class="parameter"><code>summary</code></em> :</span></p></td>
435
<td><p><span class="term"><em class="parameter"><code>summary</code></em> :</span></p></td>
457
436
<td> a string to be shown in <code class="option">--help</code> output
458
before the list of options, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
437
before the list of options, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
463
<p class="since">Since 2.12
442
<p class="since">Since 2.12</p>
467
445
<div class="refsect2" lang="en">
468
<a name="id3184610"></a><h3>
469
<a name="g-option-context-get-summary"></a>g_option_context_get_summary ()</h3>
470
<a class="indexterm" name="id3184626"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_option_context_get_summary (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);</pre>
472
Returns the summary. See <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-summary"><code class="function">g_option_context_set_summary()</code></a>.</p>
446
<a name="g-option-context-get-summary"></a><h3>g_option_context_get_summary ()</h3>
447
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * g_option_context_get_summary (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);</pre>
449
Returns the summary. See <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-summary" title="g_option_context_set_summary ()"><code class="function">g_option_context_set_summary()</code></a>.</p>
476
452
<div class="variablelist"><table border="0">
477
453
<col align="left" valign="top">
480
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
481
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
456
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
457
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
485
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
461
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
492
<p class="since">Since 2.12
468
<p class="since">Since 2.12</p>
496
471
<div class="refsect2" lang="en">
497
<a name="id3184714"></a><h3>
498
<a name="g-option-context-set-description"></a>g_option_context_set_description ()</h3>
499
<a class="indexterm" name="id3184730"></a><pre class="programlisting">void g_option_context_set_description (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
500
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *description);</pre>
472
<a name="g-option-context-set-description"></a><h3>g_option_context_set_description ()</h3>
473
<pre class="programlisting">void g_option_context_set_description (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
474
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *description);</pre>
502
476
Adds a string to be displayed in <code class="option">--help</code> output
503
477
after the list of options. This text often includes a bug reporting
507
481
Note that the summary is translated (see
508
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translate-func"><code class="function">g_option_context_set_translate_func()</code></a>).</p>
482
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-translate-func" title="g_option_context_set_translate_func ()"><code class="function">g_option_context_set_translate_func()</code></a>).</p>
512
485
<div class="variablelist"><table border="0">
513
486
<col align="left" valign="top">
516
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
517
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
489
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
490
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
521
<td><p><span class="term"><em class="parameter"><code>description</code></em> :</span></p></td>
494
<td><p><span class="term"><em class="parameter"><code>description</code></em> :</span></p></td>
522
495
<td> a string to be shown in <code class="option">--help</code> output
523
after the list of options, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
496
after the list of options, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
528
<p class="since">Since 2.12
501
<p class="since">Since 2.12</p>
532
504
<div class="refsect2" lang="en">
533
<a name="id3184854"></a><h3>
534
<a name="g-option-context-get-description"></a>g_option_context_get_description ()</h3>
535
<a class="indexterm" name="id3184869"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_option_context_get_description (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);</pre>
537
Returns the description. See <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-description"><code class="function">g_option_context_set_description()</code></a>.</p>
505
<a name="g-option-context-get-description"></a><h3>g_option_context_get_description ()</h3>
506
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * g_option_context_get_description (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);</pre>
508
Returns the description. See <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-description" title="g_option_context_set_description ()"><code class="function">g_option_context_set_description()</code></a>.</p>
541
511
<div class="variablelist"><table border="0">
542
512
<col align="left" valign="top">
545
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
546
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
515
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
516
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
550
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
520
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
551
521
<td> the description
557
<p class="since">Since 2.12
527
<p class="since">Since 2.12</p>
561
530
<div class="refsect2" lang="en">
562
<a name="id3184958"></a><h3>
563
<a name="GTranslateFunc"></a>GTranslateFunc ()</h3>
564
<a class="indexterm" name="id3184970"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* (*GTranslateFunc) (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *str,
565
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
531
<a name="GTranslateFunc"></a><h3>GTranslateFunc ()</h3>
532
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * (*GTranslateFunc) (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *str,
533
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data);</pre>
567
535
The type of functions which are used to translate user-visible
568
536
strings, for <code class="option">--help</code> output.
596
562
<div class="refsect2" lang="en">
597
<a name="id3185069"></a><h3>
598
<a name="g-option-context-set-translate-func"></a>g_option_context_set_translate_func ()</h3>
599
<a class="indexterm" name="id3185085"></a><pre class="programlisting">void g_option_context_set_translate_func (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
600
<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc">GTranslateFunc</a> func,
601
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
602
<a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> destroy_notify);</pre>
563
<a name="g-option-context-set-translate-func"></a><h3>g_option_context_set_translate_func ()</h3>
564
<pre class="programlisting">void g_option_context_set_translate_func (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
565
<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc" title="GTranslateFunc ()">GTranslateFunc</a> func,
566
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
567
<a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()">GDestroyNotify</a> destroy_notify);</pre>
604
569
Sets the function which is used to translate the contexts
605
570
user-visible strings, for <code class="option">--help</code> output.
606
If <em class="parameter"><code>func</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, strings are not translated.
571
If <em class="parameter"><code>func</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, strings are not translated.
609
574
Note that option groups have their own translation functions,
610
this function only affects the <em class="parameter"><code>parameter_string</code></em> (see <a class="link" href="glib-Commandline-option-parser.html#g-option-context-new"><code class="function">g_option_context_new()</code></a>),
611
the summary (see <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-summary"><code class="function">g_option_context_set_summary()</code></a>) and the description
612
(see <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-description"><code class="function">g_option_context_set_description()</code></a>).
575
this function only affects the <em class="parameter"><code>parameter_string</code></em> (see <a class="link" href="glib-Commandline-option-parser.html#g-option-context-new" title="g_option_context_new ()"><code class="function">g_option_context_new()</code></a>),
576
the summary (see <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-summary" title="g_option_context_set_summary ()"><code class="function">g_option_context_set_summary()</code></a>) and the description
577
(see <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-description" title="g_option_context_set_description ()"><code class="function">g_option_context_set_description()</code></a>).
615
If you are using <code class="function">gettext()</code>, you only need to set the translation
581
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
582
><code class="function">gettext()</code></a>, you only need to set the translation
616
583
domain, see <code class="function">g_context_group_set_translation_domain()</code>.</p>
620
586
<div class="variablelist"><table border="0">
621
587
<col align="left" valign="top">
624
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
625
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
629
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
630
<td> the <a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc"><span class="type">GTranslateFunc</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
634
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
635
<td> user data to pass to <em class="parameter"><code>func</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
639
<td><p><span class="term"><em class="parameter"><code>destroy_notify</code></em> :</span></p></td>
640
<td> a function which gets called to free <em class="parameter"><code>data</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
590
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
591
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
595
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
596
<td> the <a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc" title="GTranslateFunc ()"><span class="type">GTranslateFunc</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
600
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
601
<td> user data to pass to <em class="parameter"><code>func</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
605
<td><p><span class="term"><em class="parameter"><code>destroy_notify</code></em> :</span></p></td>
606
<td> a function which gets called to free <em class="parameter"><code>data</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
645
<p class="since">Since 2.12
611
<p class="since">Since 2.12</p>
649
614
<div class="refsect2" lang="en">
650
<a name="id3185362"></a><h3>
651
<a name="g-option-context-set-translation-domain"></a>g_option_context_set_translation_domain ()</h3>
652
<a class="indexterm" name="id3185378"></a><pre class="programlisting">void g_option_context_set_translation_domain
653
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
654
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *domain);</pre>
615
<a name="g-option-context-set-translation-domain"></a><h3>g_option_context_set_translation_domain ()</h3>
616
<pre class="programlisting">void g_option_context_set_translation_domain
617
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
618
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain);</pre>
656
A convenience function to use <code class="function">gettext()</code> for translating
620
A convenience function to use <a
621
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
622
><code class="function">gettext()</code></a> for translating
657
623
user-visible strings.</p>
661
626
<div class="variablelist"><table border="0">
662
627
<col align="left" valign="top">
665
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
666
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
630
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
631
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
670
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
635
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
671
636
<td> the domain to use
676
<p class="since">Since 2.12
641
<p class="since">Since 2.12</p>
680
644
<div class="refsect2" lang="en">
681
<a name="id3185477"></a><h3>
682
<a name="g-option-context-free"></a>g_option_context_free ()</h3>
683
<a class="indexterm" name="id3185492"></a><pre class="programlisting">void g_option_context_free (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);</pre>
645
<a name="g-option-context-free"></a><h3>g_option_context_free ()</h3>
646
<pre class="programlisting">void g_option_context_free (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);</pre>
685
648
Frees context and all the groups which have been
690
652
<div class="variablelist"><table border="0">
691
653
<col align="left" valign="top">
693
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
694
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
655
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
656
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
698
<p class="since">Since 2.6
660
<p class="since">Since 2.6</p>
702
663
<div class="refsect2" lang="en">
703
<a name="id3185558"></a><h3>
704
<a name="g-option-context-parse"></a>g_option_context_parse ()</h3>
705
<a class="indexterm" name="id3185574"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_option_context_parse (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
706
<a class="link" href="glib-Basic-Types.html#gint">gint</a> *argc,
707
<a class="link" href="glib-Basic-Types.html#gchar">gchar</a> ***argv,
708
<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
664
<a name="g-option-context-parse"></a><h3>g_option_context_parse ()</h3>
665
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> g_option_context_parse (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
666
<a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> *argc,
667
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> ***argv,
668
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
710
670
Parses the command line arguments, recognizing options
711
671
which have been added to <em class="parameter"><code>context</code></em>. A side-effect of
712
calling this function is that <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-set-prgname"><code class="function">g_set_prgname()</code></a> will be
672
calling this function is that <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-set-prgname" title="g_set_prgname ()"><code class="function">g_set_prgname()</code></a> will be
733
693
automatic character set conversion of string and filename
738
697
<div class="variablelist"><table border="0">
739
698
<col align="left" valign="top">
742
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
743
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
701
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
702
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
747
<td><p><span class="term"><em class="parameter"><code>argc</code></em> :</span></p></td>
706
<td><p><span class="term"><em class="parameter"><code>argc</code></em> :</span></p></td>
748
707
<td> a pointer to the number of command line arguments
752
<td><p><span class="term"><em class="parameter"><code>argv</code></em> :</span></p></td>
711
<td><p><span class="term"><em class="parameter"><code>argv</code></em> :</span></p></td>
753
712
<td> a pointer to the array of command line arguments
757
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
716
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
758
717
<td> a return location for errors
762
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
763
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the parsing was successful,
764
<a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error occurred
721
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
722
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the parsing was successful,
723
<a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error occurred
770
<p class="since">Since 2.6
729
<p class="since">Since 2.6</p>
774
732
<div class="refsect2" lang="en">
775
<a name="id3185838"></a><h3>
776
<a name="g-option-context-set-help-enabled"></a>g_option_context_set_help_enabled ()</h3>
777
<a class="indexterm" name="id3185855"></a><pre class="programlisting">void g_option_context_set_help_enabled (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
778
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> help_enabled);</pre>
733
<a name="g-option-context-set-help-enabled"></a><h3>g_option_context_set_help_enabled ()</h3>
734
<pre class="programlisting">void g_option_context_set_help_enabled (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
735
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> help_enabled);</pre>
780
737
Enables or disables automatic generation of <code class="option">--help</code>
781
output. By default, <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse"><code class="function">g_option_context_parse()</code></a> recognizes
738
output. By default, <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse" title="g_option_context_parse ()"><code class="function">g_option_context_parse()</code></a> recognizes
782
739
<code class="option">--help</code>, <code class="option">-?</code>, <code class="option">--help-all</code>
783
740
and <code class="option">--help-</code><em class="replaceable"><code>groupname</code></em> and creates
784
741
suitable output to stdout.</p>
788
744
<div class="variablelist"><table border="0">
789
745
<col align="left" valign="top">
792
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
793
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
748
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
749
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
797
<td><p><span class="term"><em class="parameter"><code>help_enabled</code></em> :</span></p></td>
798
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to enable <code class="option">--help</code>, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> to disable it
753
<td><p><span class="term"><em class="parameter"><code>help_enabled</code></em> :</span></p></td>
754
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> to enable <code class="option">--help</code>, <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> to disable it
803
<p class="since">Since 2.6
759
<p class="since">Since 2.6</p>
807
762
<div class="refsect2" lang="en">
808
<a name="id3185998"></a><h3>
809
<a name="g-option-context-get-help-enabled"></a>g_option_context_get_help_enabled ()</h3>
810
<a class="indexterm" name="id3186015"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_option_context_get_help_enabled (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);</pre>
763
<a name="g-option-context-get-help-enabled"></a><h3>g_option_context_get_help_enabled ()</h3>
764
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> g_option_context_get_help_enabled (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);</pre>
812
766
Returns whether automatic <code class="option">--help</code> generation
813
is turned on for <em class="parameter"><code>context</code></em>. See <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-help-enabled"><code class="function">g_option_context_set_help_enabled()</code></a>.</p>
767
is turned on for <em class="parameter"><code>context</code></em>. See <a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-help-enabled" title="g_option_context_set_help_enabled ()"><code class="function">g_option_context_set_help_enabled()</code></a>.</p>
817
770
<div class="variablelist"><table border="0">
818
771
<col align="left" valign="top">
821
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
822
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
774
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
775
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
826
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
827
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if automatic help generation is turned on.
779
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
780
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> if automatic help generation is turned on.
833
<p class="since">Since 2.6
786
<p class="since">Since 2.6</p>
837
789
<div class="refsect2" lang="en">
838
<a name="id3186122"></a><h3>
839
<a name="g-option-context-set-ignore-unknown-options"></a>g_option_context_set_ignore_unknown_options ()</h3>
840
<a class="indexterm" name="id3186139"></a><pre class="programlisting">void g_option_context_set_ignore_unknown_options
841
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
842
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> ignore_unknown);</pre>
790
<a name="g-option-context-set-ignore-unknown-options"></a><h3>g_option_context_set_ignore_unknown_options ()</h3>
791
<pre class="programlisting">void g_option_context_set_ignore_unknown_options
792
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
793
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> ignore_unknown);</pre>
844
795
Sets whether to ignore unknown options or not. If an argument is
845
796
ignored, it is left in the <em class="parameter"><code>argv</code></em> array after parsing. By default,
846
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse"><code class="function">g_option_context_parse()</code></a> treats unknown options as error.
797
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse" title="g_option_context_parse ()"><code class="function">g_option_context_parse()</code></a> treats unknown options as error.
849
800
This setting does not affect non-option arguments (i.e. arguments
850
801
which don't start with a dash). But note that GOption cannot reliably
851
802
determine whether a non-option belongs to a preceding unknown option.</p>
855
805
<div class="variablelist"><table border="0">
856
806
<col align="left" valign="top">
859
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
860
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
809
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
810
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
864
<td><p><span class="term"><em class="parameter"><code>ignore_unknown</code></em> :</span></p></td>
865
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to ignore unknown options, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> to produce
814
<td><p><span class="term"><em class="parameter"><code>ignore_unknown</code></em> :</span></p></td>
815
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> to ignore unknown options, <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> to produce
866
816
an error when unknown options are met
871
<p class="since">Since 2.6
821
<p class="since">Since 2.6</p>
875
824
<div class="refsect2" lang="en">
876
<a name="id3186274"></a><h3>
877
<a name="g-option-context-get-ignore-unknown-options"></a>g_option_context_get_ignore_unknown_options ()</h3>
878
<a class="indexterm" name="id3186292"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_option_context_get_ignore_unknown_options
879
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);</pre>
825
<a name="g-option-context-get-ignore-unknown-options"></a><h3>g_option_context_get_ignore_unknown_options ()</h3>
826
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> g_option_context_get_ignore_unknown_options
827
(<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);</pre>
881
829
Returns whether unknown options are ignored or not. See
882
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-ignore-unknown-options"><code class="function">g_option_context_set_ignore_unknown_options()</code></a>.</p>
830
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-set-ignore-unknown-options" title="g_option_context_set_ignore_unknown_options ()"><code class="function">g_option_context_set_ignore_unknown_options()</code></a>.</p>
886
833
<div class="variablelist"><table border="0">
887
834
<col align="left" valign="top">
890
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
891
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
837
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
838
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
895
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
896
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if unknown options are ignored.
842
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
843
<td> <a class="link" href="glib-Standard-Macros.html#TRUE--CAPS" title="TRUE"><code class="literal">TRUE</code></a> if unknown options are ignored.
902
<p class="since">Since 2.6
849
<p class="since">Since 2.6</p>
906
852
<div class="refsect2" lang="en">
907
<a name="id3186390"></a><h3>
908
<a name="g-option-context-get-help"></a>g_option_context_get_help ()</h3>
909
<a class="indexterm" name="id3186406"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_option_context_get_help (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
910
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> main_help,
911
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group);</pre>
853
<a name="g-option-context-get-help"></a><h3>g_option_context_get_help ()</h3>
854
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> * g_option_context_get_help (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
855
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> main_help,
856
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group);</pre>
913
858
Returns a formatted, translated help text for the given context.
914
859
To obtain the text produced by <code class="option">--help</code>, call
1054
994
<col align="left" valign="top">
1057
<td><p><span class="term"><a name="G-OPTION-FLAG-HIDDEN:CAPS"></a><code class="literal">G_OPTION_FLAG_HIDDEN</code></span></p></td>
997
<td><p><a name="G-OPTION-FLAG-HIDDEN--CAPS"></a><span class="term"><code class="literal">G_OPTION_FLAG_HIDDEN</code></span></p></td>
1058
998
<td>The option doesn't appear in <code class="option">--help</code>
1063
<td><p><span class="term"><a name="G-OPTION-FLAG-IN-MAIN:CAPS"></a><code class="literal">G_OPTION_FLAG_IN_MAIN</code></span></p></td>
1003
<td><p><a name="G-OPTION-FLAG-IN-MAIN--CAPS"></a><span class="term"><code class="literal">G_OPTION_FLAG_IN_MAIN</code></span></p></td>
1064
1004
<td>The option appears in the main section of the
1065
1005
<code class="option">--help</code> output, even if it is defined in a group.
1069
<td><p><span class="term"><a name="G-OPTION-FLAG-REVERSE:CAPS"></a><code class="literal">G_OPTION_FLAG_REVERSE</code></span></p></td>
1070
<td>For options of the <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-NONE:CAPS"><code class="literal">G_OPTION_ARG_NONE</code></a> kind, this flag
1009
<td><p><a name="G-OPTION-FLAG-REVERSE--CAPS"></a><span class="term"><code class="literal">G_OPTION_FLAG_REVERSE</code></span></p></td>
1010
<td>For options of the <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-NONE--CAPS"><code class="literal">G_OPTION_ARG_NONE</code></a> kind, this flag
1071
1011
indicates that the sense of the option is reversed.
1075
<td><p><span class="term"><a name="G-OPTION-FLAG-NO-ARG:CAPS"></a><code class="literal">G_OPTION_FLAG_NO_ARG</code></span></p></td>
1076
<td>For options of the <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK:CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a> kind,
1015
<td><p><a name="G-OPTION-FLAG-NO-ARG--CAPS"></a><span class="term"><code class="literal">G_OPTION_FLAG_NO_ARG</code></span></p></td>
1016
<td>For options of the <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK--CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a> kind,
1077
1017
this flag indicates that the callback does not take any argument
1078
(like a <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-NONE:CAPS"><code class="literal">G_OPTION_ARG_NONE</code></a> option). Since 2.8
1018
(like a <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-NONE--CAPS"><code class="literal">G_OPTION_ARG_NONE</code></a> option). Since 2.8
1082
<td><p><span class="term"><a name="G-OPTION-FLAG-FILENAME:CAPS"></a><code class="literal">G_OPTION_FLAG_FILENAME</code></span></p></td>
1083
<td>For options of the <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK:CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a>
1022
<td><p><a name="G-OPTION-FLAG-FILENAME--CAPS"></a><span class="term"><code class="literal">G_OPTION_FLAG_FILENAME</code></span></p></td>
1023
<td>For options of the <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK--CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a>
1084
1024
kind, this flag indicates that the argument should be passed to the
1085
1025
callback in the GLib filename encoding rather than UTF-8. Since 2.8
1089
<td><p><span class="term"><a name="G-OPTION-FLAG-OPTIONAL-ARG:CAPS"></a><code class="literal">G_OPTION_FLAG_OPTIONAL_ARG</code></span></p></td>
1090
<td>For options of the <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK:CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a>
1029
<td><p><a name="G-OPTION-FLAG-OPTIONAL-ARG--CAPS"></a><span class="term"><code class="literal">G_OPTION_FLAG_OPTIONAL_ARG</code></span></p></td>
1030
<td>For options of the <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK--CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a>
1091
1031
kind, this flag indicates that the argument supply is optional. If no argument
1092
is given then data of <a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc"><code class="literal">GOptionParseFunc</code></a> will be set to NULL. Since 2.8
1032
is given then data of <a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc" title="GOptionParseFunc ()"><code class="literal">GOptionParseFunc</code></a> will be set to NULL. Since 2.8
1096
<td><p><span class="term"><a name="G-OPTION-FLAG-NOALIAS:CAPS"></a><code class="literal">G_OPTION_FLAG_NOALIAS</code></span></p></td>
1036
<td><p><a name="G-OPTION-FLAG-NOALIAS--CAPS"></a><span class="term"><code class="literal">G_OPTION_FLAG_NOALIAS</code></span></p></td>
1097
1037
<td>This flag turns off the automatic conflict resolution
1098
which prefixes long option names with <code class="literal">groupname-</code> if
1038
which prefixes long option names with <code class="literal">groupname-</code> if
1099
1039
there is a conflict. This option should only be used in situations where
1100
1040
aliasing is necessary to model some legacy commandline interface. It is
1101
not safe to use this option, unless all option groups are under your
1041
not safe to use this option, unless all option groups are under your
1102
1042
direct control. Since 2.8.
1149
1083
A <span class="structname">GOptionEntry</span> defines a single option.
1150
To have an effect, they must be added to a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> with
1151
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-add-main-entries"><code class="function">g_option_context_add_main_entries()</code></a> or <a class="link" href="glib-Commandline-option-parser.html#g-option-group-add-entries"><code class="function">g_option_group_add_entries()</code></a>.
1084
To have an effect, they must be added to a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a> with
1085
<a class="link" href="glib-Commandline-option-parser.html#g-option-context-add-main-entries" title="g_option_context_add_main_entries ()"><code class="function">g_option_context_add_main_entries()</code></a> or <a class="link" href="glib-Commandline-option-parser.html#g-option-group-add-entries" title="g_option_group_add_entries ()"><code class="function">g_option_group_add_entries()</code></a>.
1153
1087
<div class="variablelist"><table border="0">
1154
1088
<col align="left" valign="top">
1157
<td><p><span class="term">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *<em class="structfield"><code>long_name</code></em>;</span></p></td>
1091
<td><p><span class="term">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *<em class="structfield"><code>long_name</code></em>;</span></p></td>
1158
1092
<td>The long name of an option can be used to specify it
1159
1093
in a commandline as --<em class="replaceable"><code>long_name</code></em>. Every
1160
1094
option must have a long name. To resolve conflicts if multiple
1161
1095
option groups contain the same long name, it is also possible to
1162
specify the option as
1096
specify the option as
1163
1097
--<em class="replaceable"><code>groupname</code></em>-<em class="replaceable"><code>long_name</code></em>.
1167
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a> <em class="structfield"><code>short_name</code></em>;</span></p></td>
1101
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> <em class="structfield"><code>short_name</code></em>;</span></p></td>
1168
1102
<td>If an option has a short name, it can be specified
1169
-<em class="replaceable"><code>short_name</code></em> in a commandline. <em class="parameter"><code>short_name</code></em> must be
1103
-<em class="replaceable"><code>short_name</code></em> in a commandline. <em class="parameter"><code>short_name</code></em> must be
1170
1104
a printable ASCII character different from '-', or zero if the option has no
1175
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gint">gint</a> <em class="structfield"><code>flags</code></em>;</span></p></td>
1176
<td>Flags from <a class="link" href="glib-Commandline-option-parser.html#GOptionFlags"><span class="type">GOptionFlags</span></a>.
1180
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#GOptionArg">GOptionArg</a> <em class="structfield"><code>arg</code></em>;</span></p></td>
1181
<td>The type of the option, as a <a class="link" href="glib-Commandline-option-parser.html#GOptionArg"><span class="type">GOptionArg</span></a>.
1185
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> <em class="structfield"><code>arg_data</code></em>;</span></p></td>
1186
<td> If the <em class="parameter"><code>arg</code></em> type is <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK:CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a>, then <em class="parameter"><code>arg_data</code></em> must
1187
point to a <a class="link" href="glib-Commandline-option-parser.html#GOptionArgFunc"><span class="type">GOptionArgFunc</span></a> callback function, which will be called to handle
1188
the extra argument. Otherwise, <em class="parameter"><code>arg_data</code></em> is a pointer to a location to store
1109
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gint" title="gint">gint</a> <em class="structfield"><code>flags</code></em>;</span></p></td>
1110
<td>Flags from <a class="link" href="glib-Commandline-option-parser.html#GOptionFlags" title="enum GOptionFlags"><span class="type">GOptionFlags</span></a>.
1114
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#GOptionArg" title="enum GOptionArg">GOptionArg</a> <em class="structfield"><code>arg</code></em>;</span></p></td>
1115
<td>The type of the option, as a <a class="link" href="glib-Commandline-option-parser.html#GOptionArg" title="enum GOptionArg"><span class="type">GOptionArg</span></a>.
1119
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> <em class="structfield"><code>arg_data</code></em>;</span></p></td>
1120
<td> If the <em class="parameter"><code>arg</code></em> type is <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK--CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a>, then <em class="parameter"><code>arg_data</code></em> must
1121
point to a <a class="link" href="glib-Commandline-option-parser.html#GOptionArgFunc" title="GOptionArgFunc ()"><span class="type">GOptionArgFunc</span></a> callback function, which will be called to handle
1122
the extra argument. Otherwise, <em class="parameter"><code>arg_data</code></em> is a pointer to a location to store
1189
1123
the value, the required type of the location depends on the <em class="parameter"><code>arg</code></em> type:
1190
1124
<div class="variablelist"><table border="0">
1191
1125
<col align="left" valign="top">
1194
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-NONE:CAPS"><code class="literal">G_OPTION_ARG_NONE</code></a></span></p></td>
1195
<td><p><a class="link" href="glib-Basic-Types.html#gboolean"><code class="literal">gboolean</code></a></p></td>
1198
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-STRING:CAPS"><code class="literal">G_OPTION_ARG_STRING</code></a></span></p></td>
1199
<td><p><a class="link" href="glib-Basic-Types.html#gchar"><code class="literal">gchar</code></a>*</p></td>
1202
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-INT:CAPS"><code class="literal">G_OPTION_ARG_INT</code></a></span></p></td>
1203
<td><p><a class="link" href="glib-Basic-Types.html#gint"><code class="literal">gint</code></a></p></td>
1206
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME:CAPS"><code class="literal">G_OPTION_ARG_FILENAME</code></a></span></p></td>
1207
<td><p><a class="link" href="glib-Basic-Types.html#gchar"><code class="literal">gchar</code></a>*</p></td>
1210
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-STRING-ARRAY:CAPS"><code class="literal">G_OPTION_ARG_STRING_ARRAY</code></a></span></p></td>
1211
<td><p><a class="link" href="glib-Basic-Types.html#gchar"><code class="literal">gchar</code></a>**</p></td>
1214
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME-ARRAY:CAPS"><code class="literal">G_OPTION_ARG_FILENAME_ARRAY</code></a></span></p></td>
1215
<td><p><a class="link" href="glib-Basic-Types.html#gchar"><code class="literal">gchar</code></a>**</p></td>
1218
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-DOUBLE:CAPS"><code class="literal">G_OPTION_ARG_DOUBLE</code></a></span></p></td>
1219
<td><p><a class="link" href="glib-Basic-Types.html#gdouble"><code class="literal">gdouble</code></a></p></td>
1128
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-NONE--CAPS"><code class="literal">G_OPTION_ARG_NONE</code></a></span></p></td>
1129
<td><p><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><code class="literal">gboolean</code></a></p></td>
1132
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-STRING--CAPS"><code class="literal">G_OPTION_ARG_STRING</code></a></span></p></td>
1133
<td><p><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><code class="literal">gchar</code></a>*</p></td>
1136
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-INT--CAPS"><code class="literal">G_OPTION_ARG_INT</code></a></span></p></td>
1137
<td><p><a class="link" href="glib-Basic-Types.html#gint" title="gint"><code class="literal">gint</code></a></p></td>
1140
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME--CAPS"><code class="literal">G_OPTION_ARG_FILENAME</code></a></span></p></td>
1141
<td><p><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><code class="literal">gchar</code></a>*</p></td>
1144
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-STRING-ARRAY--CAPS"><code class="literal">G_OPTION_ARG_STRING_ARRAY</code></a></span></p></td>
1145
<td><p><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><code class="literal">gchar</code></a>**</p></td>
1148
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME-ARRAY--CAPS"><code class="literal">G_OPTION_ARG_FILENAME_ARRAY</code></a></span></p></td>
1149
<td><p><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><code class="literal">gchar</code></a>**</p></td>
1152
<td><p><span class="term"><a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-DOUBLE--CAPS"><code class="literal">G_OPTION_ARG_DOUBLE</code></a></span></p></td>
1153
<td><p><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><code class="literal">gdouble</code></a></p></td>
1226
<td><p><span class="term">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *<em class="structfield"><code>description</code></em>;</span></p></td>
1160
<td><p><span class="term">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *<em class="structfield"><code>description</code></em>;</span></p></td>
1227
1161
<td>the description for the option in <code class="option">--help</code>
1228
1162
output. The <em class="parameter"><code>description</code></em> is translated using the <em class="parameter"><code>translate_func</code></em> of the
1229
group, see <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translation-domain"><code class="function">g_option_group_set_translation_domain()</code></a>.
1163
group, see <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translation-domain" title="g_option_group_set_translation_domain ()"><code class="function">g_option_group_set_translation_domain()</code></a>.
1233
<td><p><span class="term">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *<em class="structfield"><code>arg_description</code></em>;</span></p></td>
1167
<td><p><span class="term">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *<em class="structfield"><code>arg_description</code></em>;</span></p></td>
1234
1168
<td>The placeholder to use for the extra argument parsed
1235
1169
by the option in <code class="option">--help</code>
1236
1170
output. The <em class="parameter"><code>arg_description</code></em> is translated using the <em class="parameter"><code>translate_func</code></em> of the
1237
group, see <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translation-domain"><code class="function">g_option_group_set_translation_domain()</code></a>.
1171
group, see <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translation-domain" title="g_option_group_set_translation_domain ()"><code class="function">g_option_group_set_translation_domain()</code></a>.
1245
1178
<div class="refsect2" lang="en">
1246
<a name="id3187841"></a><h3>
1247
<a name="g-option-context-add-main-entries"></a>g_option_context_add_main_entries ()</h3>
1248
<a class="indexterm" name="id3187858"></a><pre class="programlisting">void g_option_context_add_main_entries (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
1249
const <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry">GOptionEntry</a> *entries,
1250
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *translation_domain);</pre>
1179
<a name="g-option-context-add-main-entries"></a><h3>g_option_context_add_main_entries ()</h3>
1180
<pre class="programlisting">void g_option_context_add_main_entries (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
1181
const <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry" title="GOptionEntry">GOptionEntry</a> *entries,
1182
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *translation_domain);</pre>
1252
1184
A convenience function which creates a main group if it doesn't
1253
1185
exist, adds the <em class="parameter"><code>entries</code></em> to it and sets the translation domain.</p>
1257
1188
<div class="variablelist"><table border="0">
1258
1189
<col align="left" valign="top">
1261
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1262
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
1266
<td><p><span class="term"><em class="parameter"><code>entries</code></em> :</span></p></td>
1267
<td> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntry</span></a>s
1271
<td><p><span class="term"><em class="parameter"><code>translation_domain</code></em> :</span></p></td>
1192
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1193
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
1197
<td><p><span class="term"><em class="parameter"><code>entries</code></em> :</span></p></td>
1198
<td> a <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry" title="GOptionEntry"><span class="type">GOptionEntry</span></a>s
1202
<td><p><span class="term"><em class="parameter"><code>translation_domain</code></em> :</span></p></td>
1272
1203
<td> a translation domain to use for translating
1273
1204
the <code class="option">--help</code> output for the options in <em class="parameter"><code>entries</code></em>
1274
with <code class="function">gettext()</code>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1206
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
1207
><code class="function">gettext()</code></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1279
<p class="since">Since 2.6
1212
<p class="since">Since 2.6</p>
1283
1215
<div class="refsect2" lang="en">
1284
<a name="id3188025"></a><h3>
1285
<a name="GOptionGroup"></a>GOptionGroup</h3>
1286
<a class="indexterm" name="id3188038"></a><pre class="programlisting">typedef struct _GOptionGroup GOptionGroup;</pre>
1216
<a name="GOptionGroup"></a><h3>GOptionGroup</h3>
1217
<pre class="programlisting">typedef struct _GOptionGroup GOptionGroup;</pre>
1288
1219
A <span class="structname">GOptionGroup</span> struct defines the options in a single
1289
group. The struct has only private fields and should not be directly accessed.
1220
group. The struct has only private fields and should not be directly accessed.
1292
1223
All options in a group share the same translation function. Libaries which
1293
1224
need to parse commandline options are expected to provide a function for
1294
getting a <span class="structname">GOptionGroup</span> holding their options, which
1295
the application can then add to its <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>.
1225
getting a <span class="structname">GOptionGroup</span> holding their options, which
1226
the application can then add to its <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>.
1299
1230
<div class="refsect2" lang="en">
1300
<a name="id3188078"></a><h3>
1301
<a name="g-option-context-add-group"></a>g_option_context_add_group ()</h3>
1302
<a class="indexterm" name="id3188094"></a><pre class="programlisting">void g_option_context_add_group (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
1303
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group);</pre>
1231
<a name="g-option-context-add-group"></a><h3>g_option_context_add_group ()</h3>
1232
<pre class="programlisting">void g_option_context_add_group (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
1233
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group);</pre>
1305
Adds a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> to the <em class="parameter"><code>context</code></em>, so that parsing with <em class="parameter"><code>context</code></em>
1235
Adds a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a> to the <em class="parameter"><code>context</code></em>, so that parsing with <em class="parameter"><code>context</code></em>
1306
1236
will recognize the options in the group. Note that the group will
1307
be freed together with the context when <a class="link" href="glib-Commandline-option-parser.html#g-option-context-free"><code class="function">g_option_context_free()</code></a> is
1237
be freed together with the context when <a class="link" href="glib-Commandline-option-parser.html#g-option-context-free" title="g_option_context_free ()"><code class="function">g_option_context_free()</code></a> is
1308
1238
called, so you must not free the group yourself after adding it
1309
1239
to a context.</p>
1313
1242
<div class="variablelist"><table border="0">
1314
1243
<col align="left" valign="top">
1317
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1318
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
1246
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1247
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
1322
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1251
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1323
1252
<td> the group to add
1328
<p class="since">Since 2.6
1257
<p class="since">Since 2.6</p>
1332
1260
<div class="refsect2" lang="en">
1333
<a name="id3188215"></a><h3>
1334
<a name="g-option-context-set-main-group"></a>g_option_context_set_main_group ()</h3>
1335
<a class="indexterm" name="id3188231"></a><pre class="programlisting">void g_option_context_set_main_group (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
1336
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group);</pre>
1261
<a name="g-option-context-set-main-group"></a><h3>g_option_context_set_main_group ()</h3>
1262
<pre class="programlisting">void g_option_context_set_main_group (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
1263
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group);</pre>
1338
Sets a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> as main group of the <em class="parameter"><code>context</code></em>.
1339
This has the same effect as calling <a class="link" href="glib-Commandline-option-parser.html#g-option-context-add-group"><code class="function">g_option_context_add_group()</code></a>,
1265
Sets a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a> as main group of the <em class="parameter"><code>context</code></em>.
1266
This has the same effect as calling <a class="link" href="glib-Commandline-option-parser.html#g-option-context-add-group" title="g_option_context_add_group ()"><code class="function">g_option_context_add_group()</code></a>,
1340
1267
the only difference is that the options in the main group are
1341
1268
treated differently when generating <code class="option">--help</code> output.</p>
1345
1271
<div class="variablelist"><table border="0">
1346
1272
<col align="left" valign="top">
1349
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1350
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
1275
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1276
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
1354
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1280
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1355
1281
<td> the group to set as main group
1360
<p class="since">Since 2.6
1286
<p class="since">Since 2.6</p>
1364
1289
<div class="refsect2" lang="en">
1365
<a name="id3188351"></a><h3>
1366
<a name="g-option-context-get-main-group"></a>g_option_context_get_main_group ()</h3>
1367
<a class="indexterm" name="id3188366"></a><pre class="programlisting"><a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a>* g_option_context_get_main_group (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context);</pre>
1290
<a name="g-option-context-get-main-group"></a><h3>g_option_context_get_main_group ()</h3>
1291
<pre class="programlisting"><a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> * g_option_context_get_main_group (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context);</pre>
1369
1293
Returns a pointer to the main group of <em class="parameter"><code>context</code></em>.</p>
1373
1296
<div class="variablelist"><table border="0">
1374
1297
<col align="left" valign="top">
1377
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1378
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
1300
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1301
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
1382
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1383
<td> the main group of <em class="parameter"><code>context</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>context</code></em> doesn't
1305
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1306
<td> the main group of <em class="parameter"><code>context</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>context</code></em> doesn't
1384
1307
have a main group. Note that group belongs to <em class="parameter"><code>context</code></em> and should
1385
1308
not be modified or freed.
1391
<p class="since">Since 2.6
1314
<p class="since">Since 2.6</p>
1395
1317
<div class="refsect2" lang="en">
1396
<a name="id3188477"></a><h3>
1397
<a name="g-option-group-new"></a>g_option_group_new ()</h3>
1398
<a class="indexterm" name="id3188493"></a><pre class="programlisting"><a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a>* g_option_group_new (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *name,
1399
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *description,
1400
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *help_description,
1401
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data,
1402
<a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> destroy);</pre>
1404
Creates a new <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>.</p>
1318
<a name="g-option-group-new"></a><h3>g_option_group_new ()</h3>
1319
<pre class="programlisting"><a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> * g_option_group_new (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *name,
1320
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *description,
1321
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *help_description,
1322
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data,
1323
<a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()">GDestroyNotify</a> destroy);</pre>
1325
Creates a new <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>.</p>
1408
1328
<div class="variablelist"><table border="0">
1409
1329
<col align="left" valign="top">
1412
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
1332
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
1413
1333
<td> the name for the option group, this is used to provide
1414
1334
help for the options in this group with <code class="option">--help-</code><em class="parameter"><code>name</code></em>
1418
<td><p><span class="term"><em class="parameter"><code>description</code></em> :</span></p></td>
1338
<td><p><span class="term"><em class="parameter"><code>description</code></em> :</span></p></td>
1419
1339
<td> a description for this group to be shown in
1420
1340
<code class="option">--help</code>. This string is translated using the translation
1421
1341
domain or translation function of the group
1425
<td><p><span class="term"><em class="parameter"><code>help_description</code></em> :</span></p></td>
1345
<td><p><span class="term"><em class="parameter"><code>help_description</code></em> :</span></p></td>
1426
1346
<td> a description for the <code class="option">--help-</code><em class="parameter"><code>name</code></em> option.
1427
1347
This string is translated using the translation domain or translation function
1432
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
1352
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
1433
1353
<td> user data that will be passed to the pre- and post-parse hooks,
1434
the error hook and to callbacks of <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK:CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a> options, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1438
<td><p><span class="term"><em class="parameter"><code>destroy</code></em> :</span></p></td>
1439
<td> a function that will be called to free <em class="parameter"><code>user_data</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1443
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1354
the error hook and to callbacks of <a class="link" href="glib-Commandline-option-parser.html#G-OPTION-ARG-CALLBACK--CAPS"><code class="literal">G_OPTION_ARG_CALLBACK</code></a> options, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1358
<td><p><span class="term"><em class="parameter"><code>destroy</code></em> :</span></p></td>
1359
<td> a function that will be called to free <em class="parameter"><code>user_data</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1363
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1444
1364
<td> a newly created option group. It should be added
1445
to a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a> or freed with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-free"><code class="function">g_option_group_free()</code></a>.
1365
to a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a> or freed with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-free" title="g_option_group_free ()"><code class="function">g_option_group_free()</code></a>.
1451
<p class="since">Since 2.6
1371
<p class="since">Since 2.6</p>
1455
1374
<div class="refsect2" lang="en">
1456
<a name="id3188741"></a><h3>
1457
<a name="g-option-group-free"></a>g_option_group_free ()</h3>
1458
<a class="indexterm" name="id3188756"></a><pre class="programlisting">void g_option_group_free (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group);</pre>
1460
Frees a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>. Note that you must <span class="emphasis"><em>not</em></span>
1461
free groups which have been added to a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>.</p>
1375
<a name="g-option-group-free"></a><h3>g_option_group_free ()</h3>
1376
<pre class="programlisting">void g_option_group_free (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group);</pre>
1378
Frees a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>. Note that you must <span class="emphasis"><em>not</em></span>
1379
free groups which have been added to a <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>.</p>
1465
1382
<div class="variablelist"><table border="0">
1466
1383
<col align="left" valign="top">
1468
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1469
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>
1385
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1386
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>
1473
<p class="since">Since 2.6
1390
<p class="since">Since 2.6</p>
1477
1393
<div class="refsect2" lang="en">
1478
<a name="id3188841"></a><h3>
1479
<a name="g-option-group-add-entries"></a>g_option_group_add_entries ()</h3>
1480
<a class="indexterm" name="id3188857"></a><pre class="programlisting">void g_option_group_add_entries (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
1481
const <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry">GOptionEntry</a> *entries);</pre>
1394
<a name="g-option-group-add-entries"></a><h3>g_option_group_add_entries ()</h3>
1395
<pre class="programlisting">void g_option_group_add_entries (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
1396
const <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry" title="GOptionEntry">GOptionEntry</a> *entries);</pre>
1483
1398
Adds the options specified in <em class="parameter"><code>entries</code></em> to <em class="parameter"><code>group</code></em>.</p>
1487
1401
<div class="variablelist"><table border="0">
1488
1402
<col align="left" valign="top">
1491
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1492
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>
1405
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1406
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>
1496
<td><p><span class="term"><em class="parameter"><code>entries</code></em> :</span></p></td>
1497
<td> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry"><span class="type">GOptionEntry</span></a>s
1410
<td><p><span class="term"><em class="parameter"><code>entries</code></em> :</span></p></td>
1411
<td> a <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of <a class="link" href="glib-Commandline-option-parser.html#GOptionEntry" title="GOptionEntry"><span class="type">GOptionEntry</span></a>s
1502
<p class="since">Since 2.6
1416
<p class="since">Since 2.6</p>
1506
1419
<div class="refsect2" lang="en">
1507
<a name="id3188975"></a><h3>
1508
<a name="GOptionParseFunc"></a>GOptionParseFunc ()</h3>
1509
<a class="indexterm" name="id3188988"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> (*GOptionParseFunc) (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
1510
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
1511
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
1512
<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
1420
<a name="GOptionParseFunc"></a><h3>GOptionParseFunc ()</h3>
1421
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean">gboolean</a> (*GOptionParseFunc) (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
1422
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
1423
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
1424
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
1514
The type of function that can be called before and after parsing.
1426
The type of function that can be called before and after parsing.
1516
1428
<div class="variablelist"><table border="0">
1517
1429
<col align="left" valign="top">
1520
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1521
<td>The active <a class="link" href="glib-Commandline-option-parser.html#GOptionContext"><span class="type">GOptionContext</span></a>
1432
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
1433
<td>The active <a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext"><span class="type">GOptionContext</span></a>
1525
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1437
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1526
1438
<td>The group to which the function belongs
1530
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
1531
<td>User data added to the <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a> containing the option when it
1532
was created with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new"><code class="function">g_option_group_new()</code></a>
1442
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
1443
<td>User data added to the <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a> containing the option when it
1444
was created with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new" title="g_option_group_new ()"><code class="function">g_option_group_new()</code></a>
1536
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1448
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1537
1449
<td>A return location for error details
1541
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1543
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the function completed successfully, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error
1544
occurred, in which case <em class="parameter"><code>error</code></em> should be set with <a class="link" href="glib-Error-Reporting.html#g-set-error"><code class="function">g_set_error()</code></a>
1453
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1454
<td>%TRUE if the function completed successfully, <a class="link" href="glib-Standard-Macros.html#FALSE--CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error
1455
occurred, in which case <em class="parameter"><code>error</code></em> should be set with <a class="link" href="glib-Error-Reporting.html#g-set-error" title="g_set_error ()"><code class="function">g_set_error()</code></a>
1553
1462
<div class="refsect2" lang="en">
1554
<a name="id3189177"></a><h3>
1555
<a name="g-option-group-set-parse-hooks"></a>g_option_group_set_parse_hooks ()</h3>
1556
<a class="indexterm" name="id3189193"></a><pre class="programlisting">void g_option_group_set_parse_hooks (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
1557
<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc">GOptionParseFunc</a> pre_parse_func,
1558
<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc">GOptionParseFunc</a> post_parse_func);</pre>
1463
<a name="g-option-group-set-parse-hooks"></a><h3>g_option_group_set_parse_hooks ()</h3>
1464
<pre class="programlisting">void g_option_group_set_parse_hooks (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
1465
<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc" title="GOptionParseFunc ()">GOptionParseFunc</a> pre_parse_func,
1466
<a class="link" href="glib-Commandline-option-parser.html#GOptionParseFunc" title="GOptionParseFunc ()">GOptionParseFunc</a> post_parse_func);</pre>
1560
1468
Associates two functions with <em class="parameter"><code>group</code></em> which will be called
1561
from <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse"><code class="function">g_option_context_parse()</code></a> before the first option is parsed
1469
from <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse" title="g_option_context_parse ()"><code class="function">g_option_context_parse()</code></a> before the first option is parsed
1562
1470
and after the last option has been parsed, respectively.
1565
1473
Note that the user data to be passed to <em class="parameter"><code>pre_parse_func</code></em> and
1566
1474
<em class="parameter"><code>post_parse_func</code></em> can be specified when constructing the group
1567
with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new"><code class="function">g_option_group_new()</code></a>.</p>
1475
with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new" title="g_option_group_new ()"><code class="function">g_option_group_new()</code></a>.</p>
1571
1478
<div class="variablelist"><table border="0">
1572
1479
<col align="left" valign="top">
1575
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1576
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>
1580
<td><p><span class="term"><em class="parameter"><code>pre_parse_func</code></em> :</span></p></td>
1581
<td> a function to call before parsing, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1585
<td><p><span class="term"><em class="parameter"><code>post_parse_func</code></em> :</span></p></td>
1586
<td> a function to call after parsing, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1482
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1483
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>
1487
<td><p><span class="term"><em class="parameter"><code>pre_parse_func</code></em> :</span></p></td>
1488
<td> a function to call before parsing, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1492
<td><p><span class="term"><em class="parameter"><code>post_parse_func</code></em> :</span></p></td>
1493
<td> a function to call after parsing, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1591
<p class="since">Since 2.6
1498
<p class="since">Since 2.6</p>
1595
1501
<div class="refsect2" lang="en">
1596
<a name="id3189371"></a><h3>
1597
<a name="GOptionErrorFunc"></a>GOptionErrorFunc ()</h3>
1598
<a class="indexterm" name="id3189383"></a><pre class="programlisting">void (*GOptionErrorFunc) (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext">GOptionContext</a> *context,
1599
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
1600
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
1601
<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
1502
<a name="GOptionErrorFunc"></a><h3>GOptionErrorFunc ()</h3>
1503
<pre class="programlisting">void (*GOptionErrorFunc) (<a class="link" href="glib-Commandline-option-parser.html#GOptionContext" title="GOptionContext">GOptionContext</a> *context,
1504
<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
1505
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
1506
<a class="link" href="glib-Error-Reporting.html#GError" title="GError">GError</a> **error);</pre>
1603
1508
The type of function to be used as callback when a parse error occurs.
1635
1538
<div class="refsect2" lang="en">
1636
<a name="id3189534"></a><h3>
1637
<a name="g-option-group-set-error-hook"></a>g_option_group_set_error_hook ()</h3>
1638
<a class="indexterm" name="id3189549"></a><pre class="programlisting">void g_option_group_set_error_hook (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
1639
<a class="link" href="glib-Commandline-option-parser.html#GOptionErrorFunc">GOptionErrorFunc</a> error_func);</pre>
1539
<a name="g-option-group-set-error-hook"></a><h3>g_option_group_set_error_hook ()</h3>
1540
<pre class="programlisting">void g_option_group_set_error_hook (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
1541
<a class="link" href="glib-Commandline-option-parser.html#GOptionErrorFunc" title="GOptionErrorFunc ()">GOptionErrorFunc</a> error_func);</pre>
1641
1543
Associates a function with <em class="parameter"><code>group</code></em> which will be called
1642
from <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse"><code class="function">g_option_context_parse()</code></a> when an error occurs.
1544
from <a class="link" href="glib-Commandline-option-parser.html#g-option-context-parse" title="g_option_context_parse ()"><code class="function">g_option_context_parse()</code></a> when an error occurs.
1645
Note that the user data to be passed to <em class="parameter"><code>pre_parse_func</code></em> and
1646
<em class="parameter"><code>post_parse_func</code></em> can be specified when constructing the group
1647
with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new"><code class="function">g_option_group_new()</code></a>.</p>
1547
Note that the user data to be passed to <em class="parameter"><code>error_func</code></em> can be
1548
specified when constructing the group with <a class="link" href="glib-Commandline-option-parser.html#g-option-group-new" title="g_option_group_new ()"><code class="function">g_option_group_new()</code></a>.</p>
1651
1551
<div class="variablelist"><table border="0">
1652
1552
<col align="left" valign="top">
1655
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1656
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>
1555
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1556
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>
1660
<td><p><span class="term"><em class="parameter"><code>error_func</code></em> :</span></p></td>
1560
<td><p><span class="term"><em class="parameter"><code>error_func</code></em> :</span></p></td>
1661
1561
<td> a function to call when an error occurs
1666
<p class="since">Since 2.6
1566
<p class="since">Since 2.6</p>
1670
1569
<div class="refsect2" lang="en">
1671
<a name="id3189682"></a><h3>
1672
<a name="g-option-group-set-translate-func"></a>g_option_group_set_translate_func ()</h3>
1673
<a class="indexterm" name="id3189699"></a><pre class="programlisting">void g_option_group_set_translate_func (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
1674
<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc">GTranslateFunc</a> func,
1675
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data,
1676
<a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> destroy_notify);</pre>
1570
<a name="g-option-group-set-translate-func"></a><h3>g_option_group_set_translate_func ()</h3>
1571
<pre class="programlisting">void g_option_group_set_translate_func (<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
1572
<a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc" title="GTranslateFunc ()">GTranslateFunc</a> func,
1573
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> data,
1574
<a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()">GDestroyNotify</a> destroy_notify);</pre>
1678
1576
Sets the function which is used to translate user-visible
1679
1577
strings, for <code class="option">--help</code> output. Different
1680
groups can use different <a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc"><span class="type">GTranslateFunc</span></a>s. If <em class="parameter"><code>func</code></em>
1681
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, strings are not translated.
1578
groups can use different <a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc" title="GTranslateFunc ()"><span class="type">GTranslateFunc</span></a>s. If <em class="parameter"><code>func</code></em>
1579
is <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>, strings are not translated.
1684
If you are using <code class="function">gettext()</code>, you only need to set the translation
1685
domain, see <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translation-domain"><code class="function">g_option_group_set_translation_domain()</code></a>.</p>
1583
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
1584
><code class="function">gettext()</code></a>, you only need to set the translation
1585
domain, see <a class="link" href="glib-Commandline-option-parser.html#g-option-group-set-translation-domain" title="g_option_group_set_translation_domain ()"><code class="function">g_option_group_set_translation_domain()</code></a>.</p>
1689
1588
<div class="variablelist"><table border="0">
1690
1589
<col align="left" valign="top">
1693
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1694
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>
1698
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
1699
<td> the <a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc"><span class="type">GTranslateFunc</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1703
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
1704
<td> user data to pass to <em class="parameter"><code>func</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1708
<td><p><span class="term"><em class="parameter"><code>destroy_notify</code></em> :</span></p></td>
1709
<td> a function which gets called to free <em class="parameter"><code>data</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
1592
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1593
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>
1597
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
1598
<td> the <a class="link" href="glib-Commandline-option-parser.html#GTranslateFunc" title="GTranslateFunc ()"><span class="type">GTranslateFunc</span></a>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1602
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
1603
<td> user data to pass to <em class="parameter"><code>func</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1607
<td><p><span class="term"><em class="parameter"><code>destroy_notify</code></em> :</span></p></td>
1608
<td> a function which gets called to free <em class="parameter"><code>data</code></em>, or <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
1714
<p class="since">Since 2.6
1613
<p class="since">Since 2.6</p>
1718
1616
<div class="refsect2" lang="en">
1719
<a name="id3189939"></a><h3>
1720
<a name="g-option-group-set-translation-domain"></a>g_option_group_set_translation_domain ()</h3>
1721
<a class="indexterm" name="id3189955"></a><pre class="programlisting">void g_option_group_set_translation_domain
1722
(<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup">GOptionGroup</a> *group,
1723
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *domain);</pre>
1617
<a name="g-option-group-set-translation-domain"></a><h3>g_option_group_set_translation_domain ()</h3>
1618
<pre class="programlisting">void g_option_group_set_translation_domain
1619
(<a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup">GOptionGroup</a> *group,
1620
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain);</pre>
1725
A convenience function to use <code class="function">gettext()</code> for translating
1622
A convenience function to use <a
1623
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
1624
><code class="function">gettext()</code></a> for translating
1726
1625
user-visible strings.</p>
1730
1628
<div class="variablelist"><table border="0">
1731
1629
<col align="left" valign="top">
1734
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1735
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup"><span class="type">GOptionGroup</span></a>
1632
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
1633
<td> a <a class="link" href="glib-Commandline-option-parser.html#GOptionGroup" title="GOptionGroup"><span class="type">GOptionGroup</span></a>
1739
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
1637
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
1740
1638
<td> the domain to use
1745
<p class="since">Since 2.6
1749
<div class="refsect1" lang="en">
1750
<a name="id3190055"></a><div class="refsect2" lang="en"><a name="id3190056"></a></div>
1643
<p class="since">Since 2.6</p>
1647
<div class="footer">
1752
<div class="refsect2" lang="en"><a name="id3190057"></a></div>
1649
Generated by GTK-Doc V1.11</div>