rhubarb-lip-sync/lib/tclap-1.2.1/docs/html/CmdLine_8h_source.html

502 lines
62 KiB
HTML
Raw Normal View History

2015-12-29 10:44:55 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>tclap: CmdLine.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.0 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<h1>CmdLine.h</h1><a href="CmdLine_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-</span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="comment">/******************************************************************************</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * file: CmdLine.h</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Copyright (c) 2003, Michael E. Smoot .</span>
<a name="l00008"></a>00008 <span class="comment"> * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.</span>
<a name="l00009"></a>00009 <span class="comment"> * All rights reverved.</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * See the file COPYING in the top directory of this distribution for</span>
<a name="l00012"></a>00012 <span class="comment"> * more information.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS</span>
<a name="l00015"></a>00015 <span class="comment"> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
<a name="l00016"></a>00016 <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</span>
<a name="l00017"></a>00017 <span class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
<a name="l00018"></a>00018 <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span>
<a name="l00019"></a>00019 <span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span>
<a name="l00020"></a>00020 <span class="comment"> * DEALINGS IN THE SOFTWARE.</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> *****************************************************************************/</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="preprocessor">#ifndef TCLAP_CMDLINE_H</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define TCLAP_CMDLINE_H</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;<a class="code" href="SwitchArg_8h.html">tclap/SwitchArg.h</a>&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;<a class="code" href="MultiSwitchArg_8h.html">tclap/MultiSwitchArg.h</a>&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;<a class="code" href="UnlabeledValueArg_8h.html">tclap/UnlabeledValueArg.h</a>&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;<a class="code" href="UnlabeledMultiArg_8h.html">tclap/UnlabeledMultiArg.h</a>&gt;</span>
<a name="l00031"></a>00031
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;<a class="code" href="XorHandler_8h.html">tclap/XorHandler.h</a>&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="HelpVisitor_8h.html">tclap/HelpVisitor.h</a>&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;<a class="code" href="VersionVisitor_8h.html">tclap/VersionVisitor.h</a>&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;<a class="code" href="IgnoreRestVisitor_8h.html">tclap/IgnoreRestVisitor.h</a>&gt;</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;<a class="code" href="CmdLineOutput_8h.html">tclap/CmdLineOutput.h</a>&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;<a class="code" href="StdOutput_8h.html">tclap/StdOutput.h</a>&gt;</span>
<a name="l00039"></a>00039
<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;<a class="code" href="Constraint_8h.html">tclap/Constraint.h</a>&gt;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &lt;<a class="code" href="ValuesConstraint_8h.html">tclap/ValuesConstraint.h</a>&gt;</span>
<a name="l00042"></a>00042
<a name="l00043"></a>00043 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &lt;list&gt;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;iomanip&gt;</span>
<a name="l00048"></a>00048 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include &lt;stdlib.h&gt;</span> <span class="comment">// Needed for exit(), which isn&apos;t defined in some envs.</span>
<a name="l00050"></a>00050
<a name="l00051"></a>00051 <span class="keyword">namespace </span>TCLAP {
<a name="l00052"></a>00052
<a name="l00053"></a><a class="code" href="namespaceTCLAP.html#a5a9391091b2232ce2647aecd42ef82be">00053</a> <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt; <span class="keywordtype">void</span> <a class="code" href="namespaceTCLAP.html#a5a9391091b2232ce2647aecd42ef82be">DelPtr</a>(T ptr)
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 <span class="keyword">delete</span> ptr;
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057
<a name="l00058"></a><a class="code" href="namespaceTCLAP.html#add5aef761d6b2640f418a050b68a500e">00058</a> <span class="keyword">template</span>&lt;<span class="keyword">typename</span> C&gt; <span class="keywordtype">void</span> <a class="code" href="namespaceTCLAP.html#add5aef761d6b2640f418a050b68a500e">ClearContainer</a>(C &amp;c)
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060 <span class="keyword">typedef</span> <span class="keyword">typename</span> C::value_type value_type;
<a name="l00061"></a>00061 std::for_each(c.begin(), c.end(), DelPtr&lt;value_type&gt;);
<a name="l00062"></a>00062 c.clear();
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064
<a name="l00065"></a>00065
<a name="l00070"></a><a class="code" href="classTCLAP_1_1CmdLine.html">00070</a> <span class="keyword">class </span><a class="code" href="classTCLAP_1_1CmdLine.html" title="The base class that manages the command line definition and passes along the parsing...">CmdLine</a> : <span class="keyword">public</span> <a class="code" href="classTCLAP_1_1CmdLineInterface.html" title="The base class that manages the command line definition and passes along the parsing...">CmdLineInterface</a>
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072 <span class="keyword">protected</span>:
<a name="l00073"></a>00073
<a name="l00078"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf">00078</a> std::list&lt;Arg*&gt; <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>;
<a name="l00079"></a>00079
<a name="l00083"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a8b856dadc54fa30d0dddba4588ef9344">00083</a> std::string <a class="code" href="classTCLAP_1_1CmdLine.html#a8b856dadc54fa30d0dddba4588ef9344" title="The name of the program.">_progName</a>;
<a name="l00084"></a>00084
<a name="l00088"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a3ccd2ae40f6eb97aebca3de9a02f10cf">00088</a> std::string <a class="code" href="classTCLAP_1_1CmdLine.html#a3ccd2ae40f6eb97aebca3de9a02f10cf" title="A message used to describe the program.">_message</a>;
<a name="l00089"></a>00089
<a name="l00093"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a2b2b52fffed2dcb7df3cdfc582ec8fd1">00093</a> std::string <a class="code" href="classTCLAP_1_1CmdLine.html#a2b2b52fffed2dcb7df3cdfc582ec8fd1" title="The version to be displayed with the --version switch.">_version</a>;
<a name="l00094"></a>00094
<a name="l00100"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a2285207b528d5fad18c82a2ee8155f37">00100</a> <span class="keywordtype">int</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a2285207b528d5fad18c82a2ee8155f37" title="The number of arguments that are required to be present on the command line.">_numRequired</a>;
<a name="l00101"></a>00101
<a name="l00106"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a602e65692dc07ea872134f354026a54f">00106</a> <span class="keywordtype">char</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a602e65692dc07ea872134f354026a54f" title="The character that is used to separate the argument flag/name from the value.">_delimiter</a>;
<a name="l00107"></a>00107
<a name="l00111"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a33846aa10c62ecd61640c93c16ac315d">00111</a> <a class="code" href="classTCLAP_1_1XorHandler.html" title="This class handles lists of Arg&amp;#39;s that are to be XOR&amp;#39;d on the command line...">XorHandler</a> <a class="code" href="classTCLAP_1_1CmdLine.html#a33846aa10c62ecd61640c93c16ac315d" title="The handler that manages xoring lists of args.">_xorHandler</a>;
<a name="l00112"></a>00112
<a name="l00118"></a><a class="code" href="classTCLAP_1_1CmdLine.html#af8d37fbf9d0b60b6acbd737af380f3e5">00118</a> std::list&lt;Arg*&gt; <a class="code" href="classTCLAP_1_1CmdLine.html#af8d37fbf9d0b60b6acbd737af380f3e5" title="A list of Args to be explicitly deleted when the destructor is called.">_argDeleteOnExitList</a>;
<a name="l00119"></a>00119
<a name="l00125"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a79b8a947f8100de977574b45b91117ac">00125</a> std::list&lt;Visitor*&gt; <a class="code" href="classTCLAP_1_1CmdLine.html#a79b8a947f8100de977574b45b91117ac" title="A list of Visitors to be explicitly deleted when the destructor is called.">_visitorDeleteOnExitList</a>;
<a name="l00126"></a>00126
<a name="l00130"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e">00130</a> <a class="code" href="classTCLAP_1_1CmdLineOutput.html" title="The interface that any output object must implement.">CmdLineOutput</a>* <a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a>;
<a name="l00131"></a>00131
<a name="l00135"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a3609d0c13886053b367d1df80efbe67b">00135</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a3609d0c13886053b367d1df80efbe67b" title="Should CmdLine handle parsing exceptions internally?">_handleExceptions</a>;
<a name="l00136"></a>00136
<a name="l00140"></a>00140 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a698f47333350312eb949aa1ae4f89ad1" title="Throws an exception listing the missing args.">missingArgsException</a>();
<a name="l00141"></a>00141
<a name="l00148"></a>00148 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a170a4e711c2a6d58a05e9ad3bc03c08a" title="Checks whether a name/flag string matches entirely matches the Arg::blankChar.">_emptyCombined</a>(<span class="keyword">const</span> std::string&amp; s);
<a name="l00149"></a>00149
<a name="l00153"></a>00153 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">deleteOnExit</a>(<a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>* ptr);
<a name="l00154"></a>00154
<a name="l00158"></a>00158 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">deleteOnExit</a>(<a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* ptr);
<a name="l00159"></a>00159
<a name="l00160"></a>00160 <span class="keyword">private</span>:
<a name="l00161"></a>00161
<a name="l00165"></a>00165 <a class="code" href="classTCLAP_1_1CmdLine.html" title="The base class that manages the command line definition and passes along the parsing...">CmdLine</a>(<span class="keyword">const</span> <a class="code" href="classTCLAP_1_1CmdLine.html" title="The base class that manages the command line definition and passes along the parsing...">CmdLine</a>&amp; rhs);
<a name="l00166"></a>00166 <a class="code" href="classTCLAP_1_1CmdLine.html" title="The base class that manages the command line definition and passes along the parsing...">CmdLine</a>&amp; operator=(<span class="keyword">const</span> <a class="code" href="classTCLAP_1_1CmdLine.html" title="The base class that manages the command line definition and passes along the parsing...">CmdLine</a>&amp; rhs);
<a name="l00167"></a>00167
<a name="l00172"></a>00172 <span class="keywordtype">void</span> _constructor();
<a name="l00173"></a>00173
<a name="l00174"></a>00174
<a name="l00179"></a>00179 <span class="keywordtype">bool</span> _userSetOutput;
<a name="l00180"></a>00180
<a name="l00184"></a>00184 <span class="keywordtype">bool</span> _helpAndVersion;
<a name="l00185"></a>00185
<a name="l00186"></a>00186 <span class="keyword">public</span>:
<a name="l00187"></a>00187
<a name="l00200"></a>00200 <a class="code" href="classTCLAP_1_1CmdLine.html" title="The base class that manages the command line definition and passes along the parsing...">CmdLine</a>(<span class="keyword">const</span> std::string&amp; message,
<a name="l00201"></a>00201 <span class="keyword">const</span> <span class="keywordtype">char</span> delimiter = <span class="charliteral">&apos; &apos;</span>,
<a name="l00202"></a>00202 <span class="keyword">const</span> std::string&amp; version = <span class="stringliteral">&quot;none&quot;</span>,
<a name="l00203"></a>00203 <span class="keywordtype">bool</span> helpAndVersion = <span class="keyword">true</span>);
<a name="l00204"></a>00204
<a name="l00208"></a>00208 <span class="keyword">virtual</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a8a7bddba32c3d96e2a01e4c8e160e6fa" title="Deletes any resources allocated by a CmdLine object.">~CmdLine</a>();
<a name="l00209"></a>00209
<a name="l00214"></a>00214 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">add</a>( <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>&amp; a );
<a name="l00215"></a>00215
<a name="l00220"></a>00220 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">add</a>( <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>* a );
<a name="l00221"></a>00221
<a name="l00228"></a>00228 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#afbaa2071d0c3276b383089acabdc0dd2" title="Add two Args that will be xor&amp;#39;d.">xorAdd</a>( <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>&amp; a, <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>&amp; b );
<a name="l00229"></a>00229
<a name="l00235"></a>00235 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#afbaa2071d0c3276b383089acabdc0dd2" title="Add two Args that will be xor&amp;#39;d.">xorAdd</a>( std::vector&lt;Arg*&gt;&amp; xors );
<a name="l00236"></a>00236
<a name="l00242"></a>00242 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#acb07daf5a1370c176a7b4a6e4119fe6e" title="Parses the command line.">parse</a>(<span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span> * <span class="keyword">const</span> * argv);
<a name="l00243"></a>00243
<a name="l00249"></a>00249 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#acb07daf5a1370c176a7b4a6e4119fe6e" title="Parses the command line.">parse</a>(std::vector&lt;std::string&gt;&amp; args);
<a name="l00250"></a>00250
<a name="l00254"></a>00254 <a class="code" href="classTCLAP_1_1CmdLineOutput.html" title="The interface that any output object must implement.">CmdLineOutput</a>* <a class="code" href="classTCLAP_1_1CmdLine.html#ad8aea2617edf53bbc20c8964ee5476e6" title="Returns the CmdLineOutput object.">getOutput</a>();
<a name="l00255"></a>00255
<a name="l00259"></a>00259 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a4506e305cd10437c7ce5a5ba34cfed0f">setOutput</a>(<a class="code" href="classTCLAP_1_1CmdLineOutput.html" title="The interface that any output object must implement.">CmdLineOutput</a>* co);
<a name="l00260"></a>00260
<a name="l00264"></a>00264 std::string&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a85b5653d1a5b48fe6accead64615cf33" title="Returns the version string.">getVersion</a>();
<a name="l00265"></a>00265
<a name="l00269"></a>00269 std::string&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a47a6d496980ee11ffc42e27144a61797" title="Returns the program name string.">getProgramName</a>();
<a name="l00270"></a>00270
<a name="l00274"></a>00274 std::list&lt;Arg*&gt;&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a3c281da929a281fb883ea47632b7ad38" title="Returns the argList.">getArgList</a>();
<a name="l00275"></a>00275
<a name="l00279"></a>00279 <a class="code" href="classTCLAP_1_1XorHandler.html" title="This class handles lists of Arg&amp;#39;s that are to be XOR&amp;#39;d on the command line...">XorHandler</a>&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a805433b7718d1bc5bc9317bbd061449b" title="Returns the XorHandler.">getXorHandler</a>();
<a name="l00280"></a>00280
<a name="l00284"></a>00284 <span class="keywordtype">char</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a3e9f0ac2c1e97d1f8527da713ddd5a8f" title="Returns the delimiter string.">getDelimiter</a>();
<a name="l00285"></a>00285
<a name="l00289"></a>00289 std::string&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a8f61a8c201e31ada985fa998180fd40f" title="Returns the message string.">getMessage</a>();
<a name="l00290"></a>00290
<a name="l00294"></a>00294 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a5b23895feae4f4110b77dae372226475" title="Indicates whether or not the help and version switches were created automatically...">hasHelpAndVersion</a>();
<a name="l00295"></a>00295
<a name="l00301"></a>00301 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#aa02055d8f4864bfa9b505e2d26bbbd87" title="Disables or enables CmdLine&amp;#39;s internal parsing exception handling.">setExceptionHandling</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span> state);
<a name="l00302"></a>00302
<a name="l00309"></a>00309 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1CmdLine.html#af2cd748a91e22df97c878d7eff8c4ca3" title="Returns the current state of the internal exception handling.">getExceptionHandling</a>() <span class="keyword">const</span>;
<a name="l00310"></a>00310
<a name="l00314"></a>00314 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a1721ec47c9d9f5ea2eca2f385fcfd2da" title="Allows the CmdLine object to be reused.">reset</a>();
<a name="l00315"></a>00315
<a name="l00316"></a>00316 };
<a name="l00317"></a>00317
<a name="l00318"></a>00318
<a name="l00320"></a>00320 <span class="comment">//Begin CmdLine.cpp</span>
<a name="l00322"></a>00322 <span class="comment"></span>
<a name="l00323"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a2e62a3493f8700afb49a7deb872a5b96">00323</a> <span class="keyword">inline</span> CmdLine::CmdLine(<span class="keyword">const</span> std::string&amp; m,
<a name="l00324"></a>00324 <span class="keywordtype">char</span> delim,
<a name="l00325"></a>00325 <span class="keyword">const</span> std::string&amp; v,
<a name="l00326"></a>00326 <span class="keywordtype">bool</span> help )
<a name="l00327"></a>00327 :
<a name="l00328"></a>00328 _argList(std::list&lt;<a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>*&gt;()),
<a name="l00329"></a>00329 _progName(<span class="stringliteral">&quot;not_set_yet&quot;</span>),
<a name="l00330"></a>00330 _message(m),
<a name="l00331"></a>00331 _version(v),
<a name="l00332"></a>00332 _numRequired(0),
<a name="l00333"></a>00333 _delimiter(delim),
<a name="l00334"></a>00334 _xorHandler(<a class="code" href="classTCLAP_1_1XorHandler.html" title="This class handles lists of Arg&amp;#39;s that are to be XOR&amp;#39;d on the command line...">XorHandler</a>()),
<a name="l00335"></a>00335 _argDeleteOnExitList(std::list&lt;<a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>*&gt;()),
<a name="l00336"></a>00336 _visitorDeleteOnExitList(std::list&lt;<a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>*&gt;()),
<a name="l00337"></a>00337 _output(0),
<a name="l00338"></a>00338 _handleExceptions(true),
<a name="l00339"></a>00339 _userSetOutput(false),
<a name="l00340"></a>00340 _helpAndVersion(help)
<a name="l00341"></a>00341 {
<a name="l00342"></a>00342 _constructor();
<a name="l00343"></a>00343 }
<a name="l00344"></a>00344
<a name="l00345"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a8a7bddba32c3d96e2a01e4c8e160e6fa">00345</a> <span class="keyword">inline</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a8a7bddba32c3d96e2a01e4c8e160e6fa" title="Deletes any resources allocated by a CmdLine object.">CmdLine::~CmdLine</a>()
<a name="l00346"></a>00346 {
<a name="l00347"></a>00347 <a class="code" href="namespaceTCLAP.html#add5aef761d6b2640f418a050b68a500e">ClearContainer</a>(<a class="code" href="classTCLAP_1_1CmdLine.html#af8d37fbf9d0b60b6acbd737af380f3e5" title="A list of Args to be explicitly deleted when the destructor is called.">_argDeleteOnExitList</a>);
<a name="l00348"></a>00348 <a class="code" href="namespaceTCLAP.html#add5aef761d6b2640f418a050b68a500e">ClearContainer</a>(<a class="code" href="classTCLAP_1_1CmdLine.html#a79b8a947f8100de977574b45b91117ac" title="A list of Visitors to be explicitly deleted when the destructor is called.">_visitorDeleteOnExitList</a>);
<a name="l00349"></a>00349
<a name="l00350"></a>00350 <span class="keywordflow">if</span> ( !_userSetOutput ) {
<a name="l00351"></a>00351 <span class="keyword">delete</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a>;
<a name="l00352"></a>00352 <a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a> = 0;
<a name="l00353"></a>00353 }
<a name="l00354"></a>00354 }
<a name="l00355"></a>00355
<a name="l00356"></a>00356 <span class="keyword">inline</span> <span class="keywordtype">void</span> CmdLine::_constructor()
<a name="l00357"></a>00357 {
<a name="l00358"></a>00358 <a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a> = <span class="keyword">new</span> <a class="code" href="classTCLAP_1_1StdOutput.html" title="A class that isolates any output from the CmdLine object so that it may be easily...">StdOutput</a>;
<a name="l00359"></a>00359
<a name="l00360"></a>00360 <a class="code" href="classTCLAP_1_1Arg.html#ad059b63424001b9aedb4c019e2854c3c" title="Sets the delimiter for all arguments.">Arg::setDelimiter</a>( <a class="code" href="classTCLAP_1_1CmdLine.html#a602e65692dc07ea872134f354026a54f" title="The character that is used to separate the argument flag/name from the value.">_delimiter</a> );
<a name="l00361"></a>00361
<a name="l00362"></a>00362 <a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v;
<a name="l00363"></a>00363
<a name="l00364"></a>00364 <span class="keywordflow">if</span> ( _helpAndVersion )
<a name="l00365"></a>00365 {
<a name="l00366"></a>00366 v = <span class="keyword">new</span> <a class="code" href="classTCLAP_1_1HelpVisitor.html" title="A Visitor object that calls the usage method of the given CmdLineOutput object for...">HelpVisitor</a>( <span class="keyword">this</span>, &amp;<a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a> );
<a name="l00367"></a>00367 <a class="code" href="classTCLAP_1_1SwitchArg.html" title="A simple switch argument.">SwitchArg</a>* help = <span class="keyword">new</span> <a class="code" href="classTCLAP_1_1SwitchArg.html" title="A simple switch argument.">SwitchArg</a>(<span class="stringliteral">&quot;h&quot;</span>,<span class="stringliteral">&quot;help&quot;</span>,
<a name="l00368"></a>00368 <span class="stringliteral">&quot;Displays usage information and exits.&quot;</span>,
<a name="l00369"></a>00369 <span class="keyword">false</span>, v);
<a name="l00370"></a>00370 <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">add</a>( help );
<a name="l00371"></a>00371 <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">deleteOnExit</a>(help);
<a name="l00372"></a>00372 <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">deleteOnExit</a>(v);
<a name="l00373"></a>00373
<a name="l00374"></a>00374 v = <span class="keyword">new</span> <a class="code" href="classTCLAP_1_1VersionVisitor.html" title="A Vistor that will call the version method of the given CmdLineOutput for the specified...">VersionVisitor</a>( <span class="keyword">this</span>, &amp;<a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a> );
<a name="l00375"></a>00375 <a class="code" href="classTCLAP_1_1SwitchArg.html" title="A simple switch argument.">SwitchArg</a>* vers = <span class="keyword">new</span> <a class="code" href="classTCLAP_1_1SwitchArg.html" title="A simple switch argument.">SwitchArg</a>(<span class="stringliteral">&quot;&quot;</span>,<span class="stringliteral">&quot;version&quot;</span>,
<a name="l00376"></a>00376 <span class="stringliteral">&quot;Displays version information and exits.&quot;</span>,
<a name="l00377"></a>00377 <span class="keyword">false</span>, v);
<a name="l00378"></a>00378 <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">add</a>( vers );
<a name="l00379"></a>00379 <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">deleteOnExit</a>(vers);
<a name="l00380"></a>00380 <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">deleteOnExit</a>(v);
<a name="l00381"></a>00381 }
<a name="l00382"></a>00382
<a name="l00383"></a>00383 v = <span class="keyword">new</span> IgnoreRestVisitor();
<a name="l00384"></a>00384 SwitchArg* ignore = <span class="keyword">new</span> SwitchArg(<a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>(),
<a name="l00385"></a>00385 <a class="code" href="classTCLAP_1_1Arg.html#a6ce0cbe4effd44679ca11f25e3c318e7" title="The name used to identify the ignore rest argument.">Arg::ignoreNameString</a>(),
<a name="l00386"></a>00386 <span class="stringliteral">&quot;Ignores the rest of the labeled arguments following this flag.&quot;</span>,
<a name="l00387"></a>00387 <span class="keyword">false</span>, v);
<a name="l00388"></a>00388 <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">add</a>( ignore );
<a name="l00389"></a>00389 <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">deleteOnExit</a>(ignore);
<a name="l00390"></a>00390 <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">deleteOnExit</a>(v);
<a name="l00391"></a>00391 }
<a name="l00392"></a>00392
<a name="l00393"></a><a class="code" href="classTCLAP_1_1CmdLine.html#ac7f2d7ee32a5157f625ad9833ab148cf">00393</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#afbaa2071d0c3276b383089acabdc0dd2" title="Add two Args that will be xor&amp;#39;d.">CmdLine::xorAdd</a>( std::vector&lt;Arg*&gt;&amp; ors )
<a name="l00394"></a>00394 {
<a name="l00395"></a>00395 <a class="code" href="classTCLAP_1_1CmdLine.html#a33846aa10c62ecd61640c93c16ac315d" title="The handler that manages xoring lists of args.">_xorHandler</a>.<a class="code" href="classTCLAP_1_1XorHandler.html#a76f156bf36a8aede334801aa242f31b9" title="Add a list of Arg*&amp;#39;s that will be orred together.">add</a>( ors );
<a name="l00396"></a>00396
<a name="l00397"></a>00397 <span class="keywordflow">for</span> (<a class="code" href="namespaceTCLAP.html#a04213af1ffc3178ce5f771d21d5164a2" title="Typedef of an Arg vector iterator.">ArgVectorIterator</a> it = ors.begin(); it != ors.end(); it++)
<a name="l00398"></a>00398 {
<a name="l00399"></a>00399 (*it)-&gt;forceRequired();
<a name="l00400"></a>00400 (*it)-&gt;setRequireLabel( <span class="stringliteral">&quot;OR required&quot;</span> );
<a name="l00401"></a>00401 <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">add</a>( *it );
<a name="l00402"></a>00402 }
<a name="l00403"></a>00403 }
<a name="l00404"></a>00404
<a name="l00405"></a><a class="code" href="classTCLAP_1_1CmdLine.html#afbaa2071d0c3276b383089acabdc0dd2">00405</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#afbaa2071d0c3276b383089acabdc0dd2" title="Add two Args that will be xor&amp;#39;d.">CmdLine::xorAdd</a>( <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>&amp; a, <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>&amp; b )
<a name="l00406"></a>00406 {
<a name="l00407"></a>00407 std::vector&lt;Arg*&gt; ors;
<a name="l00408"></a>00408 ors.push_back( &amp;a );
<a name="l00409"></a>00409 ors.push_back( &amp;b );
<a name="l00410"></a>00410 <a class="code" href="classTCLAP_1_1CmdLine.html#afbaa2071d0c3276b383089acabdc0dd2" title="Add two Args that will be xor&amp;#39;d.">xorAdd</a>( ors );
<a name="l00411"></a>00411 }
<a name="l00412"></a>00412
<a name="l00413"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf">00413</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">CmdLine::add</a>( <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>&amp; a )
<a name="l00414"></a>00414 {
<a name="l00415"></a>00415 <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">add</a>( &amp;a );
<a name="l00416"></a>00416 }
<a name="l00417"></a>00417
<a name="l00418"></a><a class="code" href="classTCLAP_1_1CmdLine.html#ab8a08e8f4d3ca7709c85416f76e805a3">00418</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a94c511d4735ad9b8c97edaa3827f8bbf" title="Adds an argument to the list of arguments to be parsed.">CmdLine::add</a>( <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>* a )
<a name="l00419"></a>00419 {
<a name="l00420"></a>00420 <span class="keywordflow">for</span>( <a class="code" href="namespaceTCLAP.html#aa7d6a803e0690c3c8b1db57c145648c5" title="Typedef of an Arg list iterator.">ArgListIterator</a> it = <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>.begin(); it != <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>.end(); it++ )
<a name="l00421"></a>00421 <span class="keywordflow">if</span> ( *a == *(*it) )
<a name="l00422"></a>00422 <span class="keywordflow">throw</span>( <a class="code" href="classTCLAP_1_1SpecificationException.html" title="Thrown from Arg and CmdLine when an Arg is improperly specified, e.g.">SpecificationException</a>(
<a name="l00423"></a>00423 <span class="stringliteral">&quot;Argument with same flag/name already exists!&quot;</span>,
<a name="l00424"></a>00424 a-&gt;<a class="code" href="classTCLAP_1_1Arg.html#aad93aff46e1fc67e3853765f565bfa96" title="Returns a long ID for the usage.">longID</a>() ) );
<a name="l00425"></a>00425
<a name="l00426"></a>00426 a-&gt;<a class="code" href="classTCLAP_1_1Arg.html#a9ff1564beeea2ef855f7fa483c37d0e2" title="Adds this to the specified list of Args.">addToList</a>( <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a> );
<a name="l00427"></a>00427
<a name="l00428"></a>00428 <span class="keywordflow">if</span> ( a-&gt;<a class="code" href="classTCLAP_1_1Arg.html#a00a3cfdb2b6e9a111ad39cbd4978b96c" title="Indicates whether the argument is required.">isRequired</a>() )
<a name="l00429"></a>00429 <a class="code" href="classTCLAP_1_1CmdLine.html#a2285207b528d5fad18c82a2ee8155f37" title="The number of arguments that are required to be present on the command line.">_numRequired</a>++;
<a name="l00430"></a>00430 }
<a name="l00431"></a>00431
<a name="l00432"></a>00432
<a name="l00433"></a><a class="code" href="classTCLAP_1_1CmdLine.html#acb07daf5a1370c176a7b4a6e4119fe6e">00433</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#acb07daf5a1370c176a7b4a6e4119fe6e" title="Parses the command line.">CmdLine::parse</a>(<span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span> * <span class="keyword">const</span> * argv)
<a name="l00434"></a>00434 {
<a name="l00435"></a>00435 <span class="comment">// this step is necessary so that we have easy access to</span>
<a name="l00436"></a>00436 <span class="comment">// mutable strings.</span>
<a name="l00437"></a>00437 std::vector&lt;std::string&gt; args;
<a name="l00438"></a>00438 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; argc; i++)
<a name="l00439"></a>00439 args.push_back(argv[i]);
<a name="l00440"></a>00440
<a name="l00441"></a>00441 <a class="code" href="classTCLAP_1_1CmdLine.html#acb07daf5a1370c176a7b4a6e4119fe6e" title="Parses the command line.">parse</a>(args);
<a name="l00442"></a>00442 }
<a name="l00443"></a>00443
<a name="l00444"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a712c3edf86aa0a8a28fb0b6d504d945a">00444</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#acb07daf5a1370c176a7b4a6e4119fe6e" title="Parses the command line.">CmdLine::parse</a>(std::vector&lt;std::string&gt;&amp; args)
<a name="l00445"></a>00445 {
<a name="l00446"></a>00446 <span class="keywordtype">bool</span> shouldExit = <span class="keyword">false</span>;
<a name="l00447"></a>00447 <span class="keywordtype">int</span> estat = 0;
<a name="l00448"></a>00448
<a name="l00449"></a>00449 <span class="keywordflow">try</span> {
<a name="l00450"></a>00450 <a class="code" href="classTCLAP_1_1CmdLine.html#a8b856dadc54fa30d0dddba4588ef9344" title="The name of the program.">_progName</a> = args.front();
<a name="l00451"></a>00451 args.erase(args.begin());
<a name="l00452"></a>00452
<a name="l00453"></a>00453 <span class="keywordtype">int</span> requiredCount = 0;
<a name="l00454"></a>00454
<a name="l00455"></a>00455 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; <span class="keyword">static_cast&lt;</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">&gt;</span>(i) &lt; args.size(); i++)
<a name="l00456"></a>00456 {
<a name="l00457"></a>00457 <span class="keywordtype">bool</span> matched = <span class="keyword">false</span>;
<a name="l00458"></a>00458 <span class="keywordflow">for</span> (<a class="code" href="namespaceTCLAP.html#aa7d6a803e0690c3c8b1db57c145648c5" title="Typedef of an Arg list iterator.">ArgListIterator</a> it = <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>.begin();
<a name="l00459"></a>00459 it != <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>.end(); it++) {
<a name="l00460"></a>00460 <span class="keywordflow">if</span> ( (*it)-&gt;processArg( &amp;i, args ) )
<a name="l00461"></a>00461 {
<a name="l00462"></a>00462 requiredCount += <a class="code" href="classTCLAP_1_1CmdLine.html#a33846aa10c62ecd61640c93c16ac315d" title="The handler that manages xoring lists of args.">_xorHandler</a>.<a class="code" href="classTCLAP_1_1XorHandler.html#a3df7722e4c4c5d331de69fc902336b00" title="Checks whether the specified Arg is in one of the xor lists and if it does match...">check</a>( *it );
<a name="l00463"></a>00463 matched = <span class="keyword">true</span>;
<a name="l00464"></a>00464 <span class="keywordflow">break</span>;
<a name="l00465"></a>00465 }
<a name="l00466"></a>00466 }
<a name="l00467"></a>00467
<a name="l00468"></a>00468 <span class="comment">// checks to see if the argument is an empty combined</span>
<a name="l00469"></a>00469 <span class="comment">// switch and if so, then we&apos;ve actually matched it</span>
<a name="l00470"></a>00470 <span class="keywordflow">if</span> ( !matched &amp;&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a170a4e711c2a6d58a05e9ad3bc03c08a" title="Checks whether a name/flag string matches entirely matches the Arg::blankChar.">_emptyCombined</a>( args[i] ) )
<a name="l00471"></a>00471 matched = <span class="keyword">true</span>;
<a name="l00472"></a>00472
<a name="l00473"></a>00473 <span class="keywordflow">if</span> ( !matched &amp;&amp; !<a class="code" href="classTCLAP_1_1Arg.html#a4d412155b8f9b4956e64e91c48e55a3b" title="Whether to ignore the rest.">Arg::ignoreRest</a>() )
<a name="l00474"></a>00474 <span class="keywordflow">throw</span>(<a class="code" href="classTCLAP_1_1CmdLineParseException.html" title="Thrown from CmdLine when the arguments on the command line are not properly specified...">CmdLineParseException</a>(<span class="stringliteral">&quot;Couldn&apos;t find match &quot;</span>
<a name="l00475"></a>00475 <span class="stringliteral">&quot;for argument&quot;</span>,
<a name="l00476"></a>00476 args[i]));
<a name="l00477"></a>00477 }
<a name="l00478"></a>00478
<a name="l00479"></a>00479 <span class="keywordflow">if</span> ( requiredCount &lt; <a class="code" href="classTCLAP_1_1CmdLine.html#a2285207b528d5fad18c82a2ee8155f37" title="The number of arguments that are required to be present on the command line.">_numRequired</a> )
<a name="l00480"></a>00480 <a class="code" href="classTCLAP_1_1CmdLine.html#a698f47333350312eb949aa1ae4f89ad1" title="Throws an exception listing the missing args.">missingArgsException</a>();
<a name="l00481"></a>00481
<a name="l00482"></a>00482 <span class="keywordflow">if</span> ( requiredCount &gt; <a class="code" href="classTCLAP_1_1CmdLine.html#a2285207b528d5fad18c82a2ee8155f37" title="The number of arguments that are required to be present on the command line.">_numRequired</a> )
<a name="l00483"></a>00483 <span class="keywordflow">throw</span>(<a class="code" href="classTCLAP_1_1CmdLineParseException.html" title="Thrown from CmdLine when the arguments on the command line are not properly specified...">CmdLineParseException</a>(<span class="stringliteral">&quot;Too many arguments!&quot;</span>));
<a name="l00484"></a>00484
<a name="l00485"></a>00485 } <span class="keywordflow">catch</span> ( <a class="code" href="classTCLAP_1_1ArgException.html" title="A simple class that defines and argument exception.">ArgException</a>&amp; e ) {
<a name="l00486"></a>00486 <span class="comment">// If we&apos;re not handling the exceptions, rethrow.</span>
<a name="l00487"></a>00487 <span class="keywordflow">if</span> ( !<a class="code" href="classTCLAP_1_1CmdLine.html#a3609d0c13886053b367d1df80efbe67b" title="Should CmdLine handle parsing exceptions internally?">_handleExceptions</a>) {
<a name="l00488"></a>00488 <span class="keywordflow">throw</span>;
<a name="l00489"></a>00489 }
<a name="l00490"></a>00490
<a name="l00491"></a>00491 <span class="keywordflow">try</span> {
<a name="l00492"></a>00492 <a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a>-&gt;<a class="code" href="classTCLAP_1_1CmdLineOutput.html#ad23a57ac3d8d957a4328fc78aec94e16" title="Generates some sort of output for a failure.">failure</a>(*<span class="keyword">this</span>,e);
<a name="l00493"></a>00493 } <span class="keywordflow">catch</span> ( <a class="code" href="classTCLAP_1_1ExitException.html">ExitException</a> &amp;ee ) {
<a name="l00494"></a>00494 estat = ee.<a class="code" href="classTCLAP_1_1ExitException.html#acf7fd20c9cfb67b5718031ed0debda1c">getExitStatus</a>();
<a name="l00495"></a>00495 shouldExit = <span class="keyword">true</span>;
<a name="l00496"></a>00496 }
<a name="l00497"></a>00497 } <span class="keywordflow">catch</span> (<a class="code" href="classTCLAP_1_1ExitException.html">ExitException</a> &amp;ee) {
<a name="l00498"></a>00498 <span class="comment">// If we&apos;re not handling the exceptions, rethrow.</span>
<a name="l00499"></a>00499 <span class="keywordflow">if</span> ( !<a class="code" href="classTCLAP_1_1CmdLine.html#a3609d0c13886053b367d1df80efbe67b" title="Should CmdLine handle parsing exceptions internally?">_handleExceptions</a>) {
<a name="l00500"></a>00500 <span class="keywordflow">throw</span>;
<a name="l00501"></a>00501 }
<a name="l00502"></a>00502
<a name="l00503"></a>00503 estat = ee.<a class="code" href="classTCLAP_1_1ExitException.html#acf7fd20c9cfb67b5718031ed0debda1c">getExitStatus</a>();
<a name="l00504"></a>00504 shouldExit = <span class="keyword">true</span>;
<a name="l00505"></a>00505 }
<a name="l00506"></a>00506
<a name="l00507"></a>00507 <span class="keywordflow">if</span> (shouldExit)
<a name="l00508"></a>00508 exit(estat);
<a name="l00509"></a>00509 }
<a name="l00510"></a>00510
<a name="l00511"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a170a4e711c2a6d58a05e9ad3bc03c08a">00511</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a170a4e711c2a6d58a05e9ad3bc03c08a" title="Checks whether a name/flag string matches entirely matches the Arg::blankChar.">CmdLine::_emptyCombined</a>(<span class="keyword">const</span> std::string&amp; s)
<a name="l00512"></a>00512 {
<a name="l00513"></a>00513 <span class="keywordflow">if</span> ( s.length() &gt; 0 &amp;&amp; s[0] != <a class="code" href="classTCLAP_1_1Arg.html#a7f9f6af439993e9151bd5a6cd2a63dad">Arg::flagStartChar</a>() )
<a name="l00514"></a>00514 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00515"></a>00515
<a name="l00516"></a>00516 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 1; <span class="keyword">static_cast&lt;</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">&gt;</span>(i) &lt; s.length(); i++ )
<a name="l00517"></a>00517 <span class="keywordflow">if</span> ( s[i] != <a class="code" href="classTCLAP_1_1Arg.html#a0abd38f46dbf7d267078134a4817fbb2" title="The char used as a place holder when SwitchArgs are combined.">Arg::blankChar</a>() )
<a name="l00518"></a>00518 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00519"></a>00519
<a name="l00520"></a>00520 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00521"></a>00521 }
<a name="l00522"></a>00522
<a name="l00523"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a698f47333350312eb949aa1ae4f89ad1">00523</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a698f47333350312eb949aa1ae4f89ad1" title="Throws an exception listing the missing args.">CmdLine::missingArgsException</a>()
<a name="l00524"></a>00524 {
<a name="l00525"></a>00525 <span class="keywordtype">int</span> count = 0;
<a name="l00526"></a>00526
<a name="l00527"></a>00527 std::string missingArgList;
<a name="l00528"></a>00528 <span class="keywordflow">for</span> (<a class="code" href="namespaceTCLAP.html#aa7d6a803e0690c3c8b1db57c145648c5" title="Typedef of an Arg list iterator.">ArgListIterator</a> it = <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>.begin(); it != <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>.end(); it++)
<a name="l00529"></a>00529 {
<a name="l00530"></a>00530 <span class="keywordflow">if</span> ( (*it)-&gt;isRequired() &amp;&amp; !(*it)-&gt;isSet() )
<a name="l00531"></a>00531 {
<a name="l00532"></a>00532 missingArgList += (*it)-&gt;getName();
<a name="l00533"></a>00533 missingArgList += <span class="stringliteral">&quot;, &quot;</span>;
<a name="l00534"></a>00534 count++;
<a name="l00535"></a>00535 }
<a name="l00536"></a>00536 }
<a name="l00537"></a>00537 missingArgList = missingArgList.substr(0,missingArgList.length()-2);
<a name="l00538"></a>00538
<a name="l00539"></a>00539 std::string msg;
<a name="l00540"></a>00540 <span class="keywordflow">if</span> ( count &gt; 1 )
<a name="l00541"></a>00541 msg = <span class="stringliteral">&quot;Required arguments missing: &quot;</span>;
<a name="l00542"></a>00542 <span class="keywordflow">else</span>
<a name="l00543"></a>00543 msg = <span class="stringliteral">&quot;Required argument missing: &quot;</span>;
<a name="l00544"></a>00544
<a name="l00545"></a>00545 msg += missingArgList;
<a name="l00546"></a>00546
<a name="l00547"></a>00547 <span class="keywordflow">throw</span>(<a class="code" href="classTCLAP_1_1CmdLineParseException.html" title="Thrown from CmdLine when the arguments on the command line are not properly specified...">CmdLineParseException</a>(msg));
<a name="l00548"></a>00548 }
<a name="l00549"></a>00549
<a name="l00550"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655">00550</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">CmdLine::deleteOnExit</a>(<a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>* ptr)
<a name="l00551"></a>00551 {
<a name="l00552"></a>00552 <a class="code" href="classTCLAP_1_1CmdLine.html#af8d37fbf9d0b60b6acbd737af380f3e5" title="A list of Args to be explicitly deleted when the destructor is called.">_argDeleteOnExitList</a>.push_back(ptr);
<a name="l00553"></a>00553 }
<a name="l00554"></a>00554
<a name="l00555"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a262b8d929eb5b0dfbfc17637c1325c36">00555</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a42d669ed2037ac24fc78883aa8600655" title="Perform a delete ptr; operation on ptr when this object is deleted.">CmdLine::deleteOnExit</a>(<a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* ptr)
<a name="l00556"></a>00556 {
<a name="l00557"></a>00557 <a class="code" href="classTCLAP_1_1CmdLine.html#a79b8a947f8100de977574b45b91117ac" title="A list of Visitors to be explicitly deleted when the destructor is called.">_visitorDeleteOnExitList</a>.push_back(ptr);
<a name="l00558"></a>00558 }
<a name="l00559"></a>00559
<a name="l00560"></a><a class="code" href="classTCLAP_1_1CmdLine.html#ad8aea2617edf53bbc20c8964ee5476e6">00560</a> <span class="keyword">inline</span> <a class="code" href="classTCLAP_1_1CmdLineOutput.html" title="The interface that any output object must implement.">CmdLineOutput</a>* <a class="code" href="classTCLAP_1_1CmdLine.html#ad8aea2617edf53bbc20c8964ee5476e6" title="Returns the CmdLineOutput object.">CmdLine::getOutput</a>()
<a name="l00561"></a>00561 {
<a name="l00562"></a>00562 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a>;
<a name="l00563"></a>00563 }
<a name="l00564"></a>00564
<a name="l00565"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a4506e305cd10437c7ce5a5ba34cfed0f">00565</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a4506e305cd10437c7ce5a5ba34cfed0f">CmdLine::setOutput</a>(<a class="code" href="classTCLAP_1_1CmdLineOutput.html" title="The interface that any output object must implement.">CmdLineOutput</a>* co)
<a name="l00566"></a>00566 {
<a name="l00567"></a>00567 <span class="keywordflow">if</span> ( !_userSetOutput )
<a name="l00568"></a>00568 <span class="keyword">delete</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a>;
<a name="l00569"></a>00569 _userSetOutput = <span class="keyword">true</span>;
<a name="l00570"></a>00570 <a class="code" href="classTCLAP_1_1CmdLine.html#a5152bf4ef26217583a3bc708aa0ea83e" title="Object that handles all output for the CmdLine.">_output</a> = co;
<a name="l00571"></a>00571 }
<a name="l00572"></a>00572
<a name="l00573"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a85b5653d1a5b48fe6accead64615cf33">00573</a> <span class="keyword">inline</span> std::string&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a85b5653d1a5b48fe6accead64615cf33" title="Returns the version string.">CmdLine::getVersion</a>()
<a name="l00574"></a>00574 {
<a name="l00575"></a>00575 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a2b2b52fffed2dcb7df3cdfc582ec8fd1" title="The version to be displayed with the --version switch.">_version</a>;
<a name="l00576"></a>00576 }
<a name="l00577"></a>00577
<a name="l00578"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a47a6d496980ee11ffc42e27144a61797">00578</a> <span class="keyword">inline</span> std::string&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a47a6d496980ee11ffc42e27144a61797" title="Returns the program name string.">CmdLine::getProgramName</a>()
<a name="l00579"></a>00579 {
<a name="l00580"></a>00580 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a8b856dadc54fa30d0dddba4588ef9344" title="The name of the program.">_progName</a>;
<a name="l00581"></a>00581 }
<a name="l00582"></a>00582
<a name="l00583"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a3c281da929a281fb883ea47632b7ad38">00583</a> <span class="keyword">inline</span> std::list&lt;Arg*&gt;&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a3c281da929a281fb883ea47632b7ad38" title="Returns the argList.">CmdLine::getArgList</a>()
<a name="l00584"></a>00584 {
<a name="l00585"></a>00585 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>;
<a name="l00586"></a>00586 }
<a name="l00587"></a>00587
<a name="l00588"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a805433b7718d1bc5bc9317bbd061449b">00588</a> <span class="keyword">inline</span> <a class="code" href="classTCLAP_1_1XorHandler.html" title="This class handles lists of Arg&amp;#39;s that are to be XOR&amp;#39;d on the command line...">XorHandler</a>&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a805433b7718d1bc5bc9317bbd061449b" title="Returns the XorHandler.">CmdLine::getXorHandler</a>()
<a name="l00589"></a>00589 {
<a name="l00590"></a>00590 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a33846aa10c62ecd61640c93c16ac315d" title="The handler that manages xoring lists of args.">_xorHandler</a>;
<a name="l00591"></a>00591 }
<a name="l00592"></a>00592
<a name="l00593"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a3e9f0ac2c1e97d1f8527da713ddd5a8f">00593</a> <span class="keyword">inline</span> <span class="keywordtype">char</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a3e9f0ac2c1e97d1f8527da713ddd5a8f" title="Returns the delimiter string.">CmdLine::getDelimiter</a>()
<a name="l00594"></a>00594 {
<a name="l00595"></a>00595 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a602e65692dc07ea872134f354026a54f" title="The character that is used to separate the argument flag/name from the value.">_delimiter</a>;
<a name="l00596"></a>00596 }
<a name="l00597"></a>00597
<a name="l00598"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a8f61a8c201e31ada985fa998180fd40f">00598</a> <span class="keyword">inline</span> std::string&amp; <a class="code" href="classTCLAP_1_1CmdLine.html#a8f61a8c201e31ada985fa998180fd40f" title="Returns the message string.">CmdLine::getMessage</a>()
<a name="l00599"></a>00599 {
<a name="l00600"></a>00600 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a3ccd2ae40f6eb97aebca3de9a02f10cf" title="A message used to describe the program.">_message</a>;
<a name="l00601"></a>00601 }
<a name="l00602"></a>00602
<a name="l00603"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a5b23895feae4f4110b77dae372226475">00603</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a5b23895feae4f4110b77dae372226475" title="Indicates whether or not the help and version switches were created automatically...">CmdLine::hasHelpAndVersion</a>()
<a name="l00604"></a>00604 {
<a name="l00605"></a>00605 <span class="keywordflow">return</span> _helpAndVersion;
<a name="l00606"></a>00606 }
<a name="l00607"></a>00607
<a name="l00608"></a><a class="code" href="classTCLAP_1_1CmdLine.html#aa02055d8f4864bfa9b505e2d26bbbd87">00608</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#aa02055d8f4864bfa9b505e2d26bbbd87" title="Disables or enables CmdLine&amp;#39;s internal parsing exception handling.">CmdLine::setExceptionHandling</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span> state)
<a name="l00609"></a>00609 {
<a name="l00610"></a>00610 <a class="code" href="classTCLAP_1_1CmdLine.html#a3609d0c13886053b367d1df80efbe67b" title="Should CmdLine handle parsing exceptions internally?">_handleExceptions</a> = state;
<a name="l00611"></a>00611 }
<a name="l00612"></a>00612
<a name="l00613"></a><a class="code" href="classTCLAP_1_1CmdLine.html#af2cd748a91e22df97c878d7eff8c4ca3">00613</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1CmdLine.html#af2cd748a91e22df97c878d7eff8c4ca3" title="Returns the current state of the internal exception handling.">CmdLine::getExceptionHandling</a>()<span class="keyword"> const</span>
<a name="l00614"></a>00614 <span class="keyword"></span>{
<a name="l00615"></a>00615 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a3609d0c13886053b367d1df80efbe67b" title="Should CmdLine handle parsing exceptions internally?">_handleExceptions</a>;
<a name="l00616"></a>00616 }
<a name="l00617"></a>00617
<a name="l00618"></a><a class="code" href="classTCLAP_1_1CmdLine.html#a1721ec47c9d9f5ea2eca2f385fcfd2da">00618</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1CmdLine.html#a1721ec47c9d9f5ea2eca2f385fcfd2da" title="Allows the CmdLine object to be reused.">CmdLine::reset</a>()
<a name="l00619"></a>00619 {
<a name="l00620"></a>00620 <span class="keywordflow">for</span>( <a class="code" href="namespaceTCLAP.html#aa7d6a803e0690c3c8b1db57c145648c5" title="Typedef of an Arg list iterator.">ArgListIterator</a> it = <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>.begin(); it != <a class="code" href="classTCLAP_1_1CmdLine.html#a4d70f73542d8184e077688bff3801baf" title="The list of arguments that will be tested against the command line.">_argList</a>.end(); it++ )
<a name="l00621"></a>00621 (*it)-&gt;reset();
<a name="l00622"></a>00622
<a name="l00623"></a>00623 <a class="code" href="classTCLAP_1_1CmdLine.html#a8b856dadc54fa30d0dddba4588ef9344" title="The name of the program.">_progName</a>.clear();
<a name="l00624"></a>00624 }
<a name="l00625"></a>00625
<a name="l00627"></a>00627 <span class="comment">//End CmdLine.cpp</span>
<a name="l00629"></a>00629 <span class="comment"></span>
<a name="l00630"></a>00630
<a name="l00631"></a>00631
<a name="l00632"></a>00632 } <span class="comment">//namespace TCLAP</span>
<a name="l00633"></a>00633 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Sat Apr 16 15:34:24 2011 for tclap by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.0 </small></address>
</body>
</html>