49
59
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option</a> (int opt, const std::string &optarg, int optopt)=0</td></tr>
51
61
<tr><td class="mdescLeft"> </td><td class="mdescRight">Callback used by <a class="el" href="classUtil_1_1Getopt.html#e0f18bdea00878d0e8a9e83370a0812e">getopt()</a> to pass on each option and its argument (if any). <a href="#27e365f1f9710ce80f4b534686d7e887"></a><br></td></tr>
52
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#f182b096eb3da4ce48c1bbb8b84817b1">nonoption</a> (const std::string &argv)</td></tr>
62
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#2e9ebfcdeadf83d201002059ec58d908">nonoption</a> (const std::string &argv)</td></tr>
54
<tr><td class="mdescLeft"> </td><td class="mdescRight">Callback used by <a class="el" href="classUtil_1_1Getopt.html#e0f18bdea00878d0e8a9e83370a0812e">getopt()</a> to pass on each non-option parameter found on the command line. <a href="#f182b096eb3da4ce48c1bbb8b84817b1"></a><br></td></tr>
55
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d9bfd88842108ef3506c3567bc63dec0"></a><!-- doxytag: member="Util::Getopt::progname" ref="d9bfd88842108ef3506c3567bc63dec0" args="() const " -->
56
const std::string & </td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#d9bfd88842108ef3506c3567bc63dec0">progname</a> () const </td></tr>
64
<tr><td class="mdescLeft"> </td><td class="mdescRight">Callback used by <a class="el" href="classUtil_1_1Getopt.html#e0f18bdea00878d0e8a9e83370a0812e">getopt()</a> to pass on each non-option parameter found on the command line. <a href="#2e9ebfcdeadf83d201002059ec58d908"></a><br></td></tr>
65
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1ce64511949ed94321a76e5d118cb1e9"></a><!-- doxytag: member="Util::Getopt::progname" ref="1ce64511949ed94321a76e5d118cb1e9" args="() const" -->
66
const std::string & </td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#1ce64511949ed94321a76e5d118cb1e9">progname</a> () const</td></tr>
58
68
<tr><td class="mdescLeft"> </td><td class="mdescRight">Program name (argv[0]). <br></td></tr>
59
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="504c4af3e01af5466459c03a90bafb83"></a><!-- doxytag: member="Util::Getopt::errcnt" ref="504c4af3e01af5466459c03a90bafb83" args="() const " -->
60
int </td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#504c4af3e01af5466459c03a90bafb83">errcnt</a> () const </td></tr>
69
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a00335cec8e46dcdbfc3aec25db6ad8b"></a><!-- doxytag: member="Util::Getopt::errcnt" ref="a00335cec8e46dcdbfc3aec25db6ad8b" args="() const" -->
70
int </td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#a00335cec8e46dcdbfc3aec25db6ad8b">errcnt</a> () const</td></tr>
62
72
<tr><td class="mdescLeft"> </td><td class="mdescRight">Total number of errors returned by calls to <a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option()</a>. <br></td></tr>
64
74
<hr><a name="_details"></a><h2>Detailed Description</h2>
65
75
Parse the command line options of a program.
67
A wrapper around the POSIX getopt(3) function. Parses the command line options and passes each option to virtual <a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option()</a>. A derived class implements this method to handle options as needed. Similarly, remaining non-option parameters are passed to the virtual <a class="el" href="classUtil_1_1Getopt.html#f182b096eb3da4ce48c1bbb8b84817b1">nonoption()</a> method.
77
A wrapper around the POSIX getopt(3) function. Parses the command line options and passes each option to virtual <a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option()</a>. A derived class implements this method to handle options as needed. Similarly, remaining non-option parameters are passed to the virtual <a class="el" href="classUtil_1_1Getopt.html#2e9ebfcdeadf83d201002059ec58d908">nonoption()</a> method.
69
79
<hr><h2>Member Function Documentation</h2>
70
<a class="anchor" name="e0f18bdea00878d0e8a9e83370a0812e"></a><!-- doxytag: member="Util::Getopt::getopt" ref="e0f18bdea00878d0e8a9e83370a0812e" args="(int argc, char *const argv[], const std::string &optstring)" --><p>
71
<table class="mdTable" cellpadding="2" cellspacing="0">
74
<table cellpadding="0" cellspacing="0" border="0">
76
<td class="md" nowrap valign="top">int Util::Getopt::getopt </td>
77
<td class="md" valign="top">( </td>
78
<td class="md" nowrap valign="top">int </td>
79
<td class="mdname" nowrap> <em>argc</em>, </td>
82
<td class="md" nowrap align="right"></td>
84
<td class="md" nowrap>char *const </td>
85
<td class="mdname" nowrap> <em>argv</em>[], </td>
88
<td class="md" nowrap align="right"></td>
90
<td class="md" nowrap>const std::string & </td>
91
<td class="mdname" nowrap> <em>optstring</em></td>
95
<td class="md">) </td>
96
<td class="md" colspan="2"></td>
80
<a class="anchor" name="e0f18bdea00878d0e8a9e83370a0812e"></a><!-- doxytag: member="Util::Getopt::getopt" ref="e0f18bdea00878d0e8a9e83370a0812e" args="(int argc, char *const argv[], const std::string &optstring)" -->
82
<div class="memproto">
83
<table class="memname">
85
<td class="memname">int Util::Getopt::getopt </td>
87
<td class="paramtype">int </td>
88
<td class="paramname"> <em>argc</em>, </td>
91
<td class="paramkey"></td>
93
<td class="paramtype">char *const </td>
94
<td class="paramname"> <em>argv</em>[], </td>
97
<td class="paramkey"></td>
99
<td class="paramtype">const std::string & </td>
100
<td class="paramname"> <em>optstring</em></td><td> </td>
105
<td></td><td></td><td width="100%"></td>
102
<table cellspacing="5" cellpadding="0" border="0">
110
112
Parse command line arguments.
112
Parses the command line arguments. Calls <a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option()</a> with the character value of the option and its argument (if any) for each recognized option and with ':' or '?' for unrecognized options. See the manual pages for getopt(3) for details. In addition, <a class="el" href="classUtil_1_1Getopt.html#f182b096eb3da4ce48c1bbb8b84817b1">nonoption()</a> is invoked for each remaining non-option parameter on the command line.<p>
114
Parses the command line arguments. Calls <a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option()</a> with the character value of the option and its argument (if any) for each recognized option and with ':' or '?' for unrecognized options. See the manual pages for getopt(3) for details. In addition, <a class="el" href="classUtil_1_1Getopt.html#2e9ebfcdeadf83d201002059ec58d908">nonoption()</a> is invoked for each remaining non-option parameter on the command line.<p>
113
115
<dl compact><dt><b>Parameters:</b></dt><dd>
114
116
<table border="0" cellspacing="2" cellpadding="0">
115
117
<tr><td valign="top"></td><td valign="top"><em>argc</em> </td><td>Argument count as passed to main() on program invocation. </td></tr>
117
119
<tr><td valign="top"></td><td valign="top"><em>optstring</em> </td><td>String containing the legitimate option characters.</td></tr>
120
<dl compact><dt><b>Returns:</b></dt><dd>Number of errors (the sum of the return values from <a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option()</a> and <a class="el" href="classUtil_1_1Getopt.html#f182b096eb3da4ce48c1bbb8b84817b1">nonoption()</a>). </dd></dl>
124
<a class="anchor" name="f182b096eb3da4ce48c1bbb8b84817b1"></a><!-- doxytag: member="Util::Getopt::nonoption" ref="f182b096eb3da4ce48c1bbb8b84817b1" args="(const std::string &argv)" --><p>
125
<table class="mdTable" cellpadding="2" cellspacing="0">
128
<table cellpadding="0" cellspacing="0" border="0">
130
<td class="md" nowrap valign="top">int Util::Getopt::nonoption </td>
131
<td class="md" valign="top">( </td>
132
<td class="md" nowrap valign="top">const std::string & </td>
133
<td class="mdname1" valign="top" nowrap> <em>argv</em> </td>
134
<td class="md" valign="top"> ) </td>
135
<td class="md" nowrap><code> [virtual]</code></td>
141
<table cellspacing="5" cellpadding="0" border="0">
149
Callback used by <a class="el" href="classUtil_1_1Getopt.html#e0f18bdea00878d0e8a9e83370a0812e">getopt()</a> to pass on each non-option parameter found on the command line.
151
Implement this method in a derived class to handle the non-option parameters as needed. The default implementation ignores all non-option parameters.<p>
152
<dl compact><dt><b>Parameters:</b></dt><dd>
153
<table border="0" cellspacing="2" cellpadding="0">
154
<tr><td valign="top"></td><td valign="top"><em>argv</em> </td><td>The non-option parameter from the command line.</td></tr>
157
<dl compact><dt><b>Returns:</b></dt><dd>0 if successful, 1 in case of an error. </dd></dl>
160
Reimplemented in <a class="el" href="classParams.html#00a1171555548b5903e52a12354309b4">Params</a>, and <a class="el" href="classParams.html#f788b09ae4abb849e760e3a46e92bcf2">Params</a>. </td>
163
<a class="anchor" name="27e365f1f9710ce80f4b534686d7e887"></a><!-- doxytag: member="Util::Getopt::option" ref="27e365f1f9710ce80f4b534686d7e887" args="(int opt, const std::string &optarg, int optopt)=0" --><p>
164
<table class="mdTable" cellpadding="2" cellspacing="0">
167
<table cellpadding="0" cellspacing="0" border="0">
169
<td class="md" nowrap valign="top">virtual int Util::Getopt::option </td>
170
<td class="md" valign="top">( </td>
171
<td class="md" nowrap valign="top">int </td>
172
<td class="mdname" nowrap> <em>opt</em>, </td>
175
<td class="md" nowrap align="right"></td>
177
<td class="md" nowrap>const std::string & </td>
178
<td class="mdname" nowrap> <em>optarg</em>, </td>
181
<td class="md" nowrap align="right"></td>
183
<td class="md" nowrap>int </td>
184
<td class="mdname" nowrap> <em>optopt</em></td>
188
<td class="md">) </td>
189
<td class="md" colspan="2"><code> [pure virtual]</code></td>
195
<table cellspacing="5" cellpadding="0" border="0">
122
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Number of errors (the sum of the return values from <a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option()</a> and <a class="el" href="classUtil_1_1Getopt.html#2e9ebfcdeadf83d201002059ec58d908">nonoption()</a>). </dd></dl>
126
<a class="anchor" name="27e365f1f9710ce80f4b534686d7e887"></a><!-- doxytag: member="Util::Getopt::option" ref="27e365f1f9710ce80f4b534686d7e887" args="(int opt, const std::string &optarg, int optopt)=0" -->
127
<div class="memitem">
128
<div class="memproto">
129
<table class="memname">
131
<td class="memname">virtual int Util::Getopt::option </td>
133
<td class="paramtype">int </td>
134
<td class="paramname"> <em>opt</em>, </td>
137
<td class="paramkey"></td>
139
<td class="paramtype">const std::string & </td>
140
<td class="paramname"> <em>optarg</em>, </td>
143
<td class="paramkey"></td>
145
<td class="paramtype">int </td>
146
<td class="paramname"> <em>optopt</em></td><td> </td>
151
<td></td><td></td><td width="100%"><code> [pure virtual]</code></td>
203
158
Callback used by <a class="el" href="classUtil_1_1Getopt.html#e0f18bdea00878d0e8a9e83370a0812e">getopt()</a> to pass on each option and its argument (if any).
210
165
<tr><td valign="top"></td><td valign="top"><em>optopt</em> </td><td>The actual option character in case of an unrecognized option or a missing option argument (opt is '?' or ':').</td></tr>
213
<dl compact><dt><b>Returns:</b></dt><dd>0 if successful, 1 in case of an error. </dd></dl>
216
Implemented in <a class="el" href="classParams.html#8d28eab356e60994d9bcf6c9c6ff1cdb">Params</a>, and <a class="el" href="classParams.html#6db679664dff3fb8d1c807aa01c7aa45">Params</a>. </td>
219
<hr>The documentation for this class was generated from the following files:<ul>
220
<li><a class="el" href="utils_8hpp.html">utils.hpp</a><li>utils.cpp</ul>
221
<hr size="1"><address style="align: right;"><small>Generated on Fri Jun 2 23:55:45 2006 for Exiv2 by
168
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if successful, 1 in case of an error. </dd></dl>
171
Implemented in <a class="el" href="classParams.html#8d28eab356e60994d9bcf6c9c6ff1cdb">Params</a>, and <a class="el" href="classParams.html#6db679664dff3fb8d1c807aa01c7aa45">Params</a>.
174
<a class="anchor" name="2e9ebfcdeadf83d201002059ec58d908"></a><!-- doxytag: member="Util::Getopt::nonoption" ref="2e9ebfcdeadf83d201002059ec58d908" args="(const std::string &argv)" -->
175
<div class="memitem">
176
<div class="memproto">
177
<table class="memname">
179
<td class="memname">virtual int Util::Getopt::nonoption </td>
181
<td class="paramtype">const std::string & </td>
182
<td class="paramname"> <em>argv</em> </td>
183
<td> ) </td>
184
<td width="100%"><code> [virtual]</code></td>
191
Callback used by <a class="el" href="classUtil_1_1Getopt.html#e0f18bdea00878d0e8a9e83370a0812e">getopt()</a> to pass on each non-option parameter found on the command line.
193
Implement this method in a derived class to handle the non-option parameters as needed. The default implementation ignores all non-option parameters.<p>
194
<dl compact><dt><b>Parameters:</b></dt><dd>
195
<table border="0" cellspacing="2" cellpadding="0">
196
<tr><td valign="top"></td><td valign="top"><em>argv</em> </td><td>The non-option parameter from the command line.</td></tr>
199
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if successful, 1 in case of an error. </dd></dl>
202
Reimplemented in <a class="el" href="classParams.html#00a1171555548b5903e52a12354309b4">Params</a>, and <a class="el" href="classParams.html#f788b09ae4abb849e760e3a46e92bcf2">Params</a>.
205
<hr>The documentation for this class was generated from the following file:<ul>
206
<li><a class="el" href="utils_8hpp.html">utils.hpp</a></ul>
207
<hr size="1"><address style="align: right;"><small>Generated on Mon Nov 27 20:16:39 2006 for Exiv2 by
222
208
<a href="http://www.doxygen.org/index.html">
223
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
209
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>