~ubuntu-branches/ubuntu/precise/exiv2/precise

« back to all changes in this revision

Viewing changes to doc/html/classUtil_1_1Getopt.html

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Mercatante
  • Date: 2006-12-07 18:40:10 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20061207184010-0ouu8v0dr8nznob9
Tags: 0.12-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
5
<link href="tabs.css" rel="stylesheet" type="text/css">
6
6
</head><body>
7
 
<!-- Generated by Doxygen 1.4.6 -->
 
7
<!-- Generated by Doxygen 1.5.1 -->
8
8
<div class="tabs">
9
9
  <ul>
10
10
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12
12
    <li id="current"><a href="classes.html"><span>Classes</span></a></li>
13
13
    <li><a href="files.html"><span>Files</span></a></li>
14
14
    <li><a href="examples.html"><span>Examples</span></a></li>
 
15
    <li>
 
16
      <form action="search.php" method="get">
 
17
        <table cellspacing="0" cellpadding="0" border="0">
 
18
          <tr>
 
19
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
 
20
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
 
21
          </tr>
 
22
        </table>
 
23
      </form>
 
24
    </li>
15
25
  </ul></div>
16
26
<div class="tabs">
17
27
  <ul>
29
39
<p>
30
40
Inheritance diagram for Util::Getopt:<p><center><img src="classUtil_1_1Getopt__inherit__graph.png" border="0" usemap="#Util_1_1Getopt__inherit__map" alt="Inheritance graph"></center>
31
41
<map name="Util_1_1Getopt__inherit__map">
32
 
<area href="classParams.html" shape="rect" coords="16,81,83,105" alt="">
 
42
<area href="classParams.html" shape="rect" coords="19,81,91,105" alt="">
33
43
</map>
34
44
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for Util::Getopt:<p><center><img src="classUtil_1_1Getopt__coll__graph.png" border="0" usemap="#Util_1_1Getopt__coll__map" alt="Collaboration graph"></center>
35
45
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classUtil_1_1Getopt-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
49
59
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#27e365f1f9710ce80f4b534686d7e887">option</a> (int opt, const std::string &amp;optarg, int optopt)=0</td></tr>
50
60
 
51
61
<tr><td class="mdescLeft">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#f182b096eb3da4ce48c1bbb8b84817b1">nonoption</a> (const std::string &amp;argv)</td></tr>
 
62
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#2e9ebfcdeadf83d201002059ec58d908">nonoption</a> (const std::string &amp;argv)</td></tr>
53
63
 
54
 
<tr><td class="mdescLeft">&nbsp;</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 &amp;&nbsp;</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">&nbsp;</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 &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#1ce64511949ed94321a76e5d118cb1e9">progname</a> () const</td></tr>
57
67
 
58
68
<tr><td class="mdescLeft">&nbsp;</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&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUtil_1_1Getopt.html#a00335cec8e46dcdbfc3aec25db6ad8b">errcnt</a> () const</td></tr>
61
71
 
62
72
<tr><td class="mdescLeft">&nbsp;</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>
63
73
</table>
64
74
<hr><a name="_details"></a><h2>Detailed Description</h2>
65
75
Parse the command line options of a program. 
66
76
<p>
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. 
68
78
<p>
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 &amp;optstring)" --><p>
71
 
<table class="mdTable" cellpadding="2" cellspacing="0">
72
 
  <tr>
73
 
    <td class="mdRow">
74
 
      <table cellpadding="0" cellspacing="0" border="0">
75
 
        <tr>
76
 
          <td class="md" nowrap valign="top">int Util::Getopt::getopt           </td>
77
 
          <td class="md" valign="top">(&nbsp;</td>
78
 
          <td class="md" nowrap valign="top">int&nbsp;</td>
79
 
          <td class="mdname" nowrap> <em>argc</em>, </td>
80
 
        </tr>
81
 
        <tr>
82
 
          <td class="md" nowrap align="right"></td>
83
 
          <td class="md"></td>
84
 
          <td class="md" nowrap>char *const &nbsp;</td>
85
 
          <td class="mdname" nowrap> <em>argv</em>[], </td>
86
 
        </tr>
87
 
        <tr>
88
 
          <td class="md" nowrap align="right"></td>
89
 
          <td class="md"></td>
90
 
          <td class="md" nowrap>const std::string &amp;&nbsp;</td>
91
 
          <td class="mdname" nowrap> <em>optstring</em></td>
92
 
        </tr>
93
 
        <tr>
94
 
          <td class="md"></td>
95
 
          <td class="md">)&nbsp;</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 &amp;optstring)" -->
 
81
<div class="memitem">
 
82
<div class="memproto">
 
83
      <table class="memname">
 
84
        <tr>
 
85
          <td class="memname">int Util::Getopt::getopt           </td>
 
86
          <td>(</td>
 
87
          <td class="paramtype">int&nbsp;</td>
 
88
          <td class="paramname"> <em>argc</em>, </td>
 
89
        </tr>
 
90
        <tr>
 
91
          <td class="paramkey"></td>
 
92
          <td></td>
 
93
          <td class="paramtype">char *const &nbsp;</td>
 
94
          <td class="paramname"> <em>argv</em>[], </td>
 
95
        </tr>
 
96
        <tr>
 
97
          <td class="paramkey"></td>
 
98
          <td></td>
 
99
          <td class="paramtype">const std::string &amp;&nbsp;</td>
 
100
          <td class="paramname"> <em>optstring</em></td><td>&nbsp;</td>
 
101
        </tr>
 
102
        <tr>
 
103
          <td></td>
 
104
          <td>)</td>
 
105
          <td></td><td></td><td width="100%"></td>
97
106
        </tr>
98
107
      </table>
99
 
    </td>
100
 
  </tr>
101
 
</table>
102
 
<table cellspacing="5" cellpadding="0" border="0">
103
 
  <tr>
104
 
    <td>
105
 
      &nbsp;
106
 
    </td>
107
 
    <td>
 
108
</div>
 
109
<div class="memdoc">
108
110
 
109
111
<p>
110
112
Parse command line arguments. 
111
113
<p>
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>&nbsp;</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>&nbsp;</td><td>String containing the legitimate option characters.</td></tr>
118
120
  </table>
119
121
</dl>
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>
121
 
    </td>
122
 
  </tr>
123
 
</table>
124
 
<a class="anchor" name="f182b096eb3da4ce48c1bbb8b84817b1"></a><!-- doxytag: member="Util::Getopt::nonoption" ref="f182b096eb3da4ce48c1bbb8b84817b1" args="(const std::string &amp;argv)" --><p>
125
 
<table class="mdTable" cellpadding="2" cellspacing="0">
126
 
  <tr>
127
 
    <td class="mdRow">
128
 
      <table cellpadding="0" cellspacing="0" border="0">
129
 
        <tr>
130
 
          <td class="md" nowrap valign="top">int Util::Getopt::nonoption           </td>
131
 
          <td class="md" valign="top">(&nbsp;</td>
132
 
          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
133
 
          <td class="mdname1" valign="top" nowrap> <em>argv</em>          </td>
134
 
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
135
 
          <td class="md" nowrap><code> [virtual]</code></td>
136
 
        </tr>
137
 
      </table>
138
 
    </td>
139
 
  </tr>
140
 
</table>
141
 
<table cellspacing="5" cellpadding="0" border="0">
142
 
  <tr>
143
 
    <td>
144
 
      &nbsp;
145
 
    </td>
146
 
    <td>
147
 
 
148
 
<p>
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. 
150
 
<p>
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>&nbsp;</td><td>The non-option parameter from the command line.</td></tr>
155
 
  </table>
156
 
</dl>
157
 
<dl compact><dt><b>Returns:</b></dt><dd>0 if successful, 1 in case of an error. </dd></dl>
158
 
 
159
 
<p>
160
 
Reimplemented in <a class="el" href="classParams.html#00a1171555548b5903e52a12354309b4">Params</a>, and <a class="el" href="classParams.html#f788b09ae4abb849e760e3a46e92bcf2">Params</a>.    </td>
161
 
  </tr>
162
 
</table>
163
 
<a class="anchor" name="27e365f1f9710ce80f4b534686d7e887"></a><!-- doxytag: member="Util::Getopt::option" ref="27e365f1f9710ce80f4b534686d7e887" args="(int opt, const std::string &amp;optarg, int optopt)=0" --><p>
164
 
<table class="mdTable" cellpadding="2" cellspacing="0">
165
 
  <tr>
166
 
    <td class="mdRow">
167
 
      <table cellpadding="0" cellspacing="0" border="0">
168
 
        <tr>
169
 
          <td class="md" nowrap valign="top">virtual int Util::Getopt::option           </td>
170
 
          <td class="md" valign="top">(&nbsp;</td>
171
 
          <td class="md" nowrap valign="top">int&nbsp;</td>
172
 
          <td class="mdname" nowrap> <em>opt</em>, </td>
173
 
        </tr>
174
 
        <tr>
175
 
          <td class="md" nowrap align="right"></td>
176
 
          <td class="md"></td>
177
 
          <td class="md" nowrap>const std::string &amp;&nbsp;</td>
178
 
          <td class="mdname" nowrap> <em>optarg</em>, </td>
179
 
        </tr>
180
 
        <tr>
181
 
          <td class="md" nowrap align="right"></td>
182
 
          <td class="md"></td>
183
 
          <td class="md" nowrap>int&nbsp;</td>
184
 
          <td class="mdname" nowrap> <em>optopt</em></td>
185
 
        </tr>
186
 
        <tr>
187
 
          <td class="md"></td>
188
 
          <td class="md">)&nbsp;</td>
189
 
          <td class="md" colspan="2"><code> [pure virtual]</code></td>
190
 
        </tr>
191
 
      </table>
192
 
    </td>
193
 
  </tr>
194
 
</table>
195
 
<table cellspacing="5" cellpadding="0" border="0">
196
 
  <tr>
197
 
    <td>
198
 
      &nbsp;
199
 
    </td>
200
 
    <td>
 
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>
 
123
 
 
124
</div>
 
125
</div><p>
 
126
<a class="anchor" name="27e365f1f9710ce80f4b534686d7e887"></a><!-- doxytag: member="Util::Getopt::option" ref="27e365f1f9710ce80f4b534686d7e887" args="(int opt, const std::string &amp;optarg, int optopt)=0" -->
 
127
<div class="memitem">
 
128
<div class="memproto">
 
129
      <table class="memname">
 
130
        <tr>
 
131
          <td class="memname">virtual int Util::Getopt::option           </td>
 
132
          <td>(</td>
 
133
          <td class="paramtype">int&nbsp;</td>
 
134
          <td class="paramname"> <em>opt</em>, </td>
 
135
        </tr>
 
136
        <tr>
 
137
          <td class="paramkey"></td>
 
138
          <td></td>
 
139
          <td class="paramtype">const std::string &amp;&nbsp;</td>
 
140
          <td class="paramname"> <em>optarg</em>, </td>
 
141
        </tr>
 
142
        <tr>
 
143
          <td class="paramkey"></td>
 
144
          <td></td>
 
145
          <td class="paramtype">int&nbsp;</td>
 
146
          <td class="paramname"> <em>optopt</em></td><td>&nbsp;</td>
 
147
        </tr>
 
148
        <tr>
 
149
          <td></td>
 
150
          <td>)</td>
 
151
          <td></td><td></td><td width="100%"><code> [pure virtual]</code></td>
 
152
        </tr>
 
153
      </table>
 
154
</div>
 
155
<div class="memdoc">
201
156
 
202
157
<p>
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>&nbsp;</td><td>The actual option character in case of an unrecognized option or a missing option argument (opt is '?' or ':').</td></tr>
211
166
  </table>
212
167
</dl>
213
 
<dl compact><dt><b>Returns:</b></dt><dd>0 if successful, 1 in case of an error. </dd></dl>
214
 
 
215
 
<p>
216
 
Implemented in <a class="el" href="classParams.html#8d28eab356e60994d9bcf6c9c6ff1cdb">Params</a>, and <a class="el" href="classParams.html#6db679664dff3fb8d1c807aa01c7aa45">Params</a>.    </td>
217
 
  </tr>
218
 
</table>
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&nbsp;
 
168
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if successful, 1 in case of an error. </dd></dl>
 
169
 
 
170
<p>
 
171
Implemented in <a class="el" href="classParams.html#8d28eab356e60994d9bcf6c9c6ff1cdb">Params</a>, and <a class="el" href="classParams.html#6db679664dff3fb8d1c807aa01c7aa45">Params</a>.
 
172
</div>
 
173
</div><p>
 
174
<a class="anchor" name="2e9ebfcdeadf83d201002059ec58d908"></a><!-- doxytag: member="Util::Getopt::nonoption" ref="2e9ebfcdeadf83d201002059ec58d908" args="(const std::string &amp;argv)" -->
 
175
<div class="memitem">
 
176
<div class="memproto">
 
177
      <table class="memname">
 
178
        <tr>
 
179
          <td class="memname">virtual int Util::Getopt::nonoption           </td>
 
180
          <td>(</td>
 
181
          <td class="paramtype">const std::string &amp;&nbsp;</td>
 
182
          <td class="paramname"> <em>argv</em>          </td>
 
183
          <td>&nbsp;)&nbsp;</td>
 
184
          <td width="100%"><code> [virtual]</code></td>
 
185
        </tr>
 
186
      </table>
 
187
</div>
 
188
<div class="memdoc">
 
189
 
 
190
<p>
 
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. 
 
192
<p>
 
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>&nbsp;</td><td>The non-option parameter from the command line.</td></tr>
 
197
  </table>
 
198
</dl>
 
199
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if successful, 1 in case of an error. </dd></dl>
 
200
 
 
201
<p>
 
202
Reimplemented in <a class="el" href="classParams.html#00a1171555548b5903e52a12354309b4">Params</a>, and <a class="el" href="classParams.html#f788b09ae4abb849e760e3a46e92bcf2">Params</a>.
 
203
</div>
 
204
</div><p>
 
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&nbsp;
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>
224
210
</body>
225
211
</html>