<!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: Arg.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 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 List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>Arg.h</h1><a href="Arg_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: Arg.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 <a name="l00025"></a>00025 <span class="preprocessor">#ifndef TCLAP_ARGUMENT_H</span> <a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define TCLAP_ARGUMENT_H</span> <a name="l00027"></a>00027 <span class="preprocessor"></span> <a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span> <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span> <a name="l00030"></a>00030 <span class="preprocessor">#else</span> <a name="l00031"></a><a class="code" href="Arg_8h.html#a91e904e6e4f21f803c49113b934e6966">00031</a> <span class="preprocessor"></span><span class="preprocessor">#define HAVE_SSTREAM</span> <a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <string></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <vector></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <list></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <iostream></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <iomanip></span> <a name="l00039"></a>00039 <span class="preprocessor">#include <cstdio></span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="preprocessor">#if defined(HAVE_SSTREAM)</span> <a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#include <sstream></span> <a name="l00043"></a><a class="code" href="Arg_8h.html#ab31d9646d48ca9d02918cc36b138e67b">00043</a> <span class="keyword">typedef</span> <a class="code" href="Arg_8h.html#ab31d9646d48ca9d02918cc36b138e67b">std::istringstream</a> <a class="code" href="Arg_8h.html#ab31d9646d48ca9d02918cc36b138e67b">istringstream</a>; <a name="l00044"></a>00044 <span class="preprocessor">#elif defined(HAVE_STRSTREAM)</span> <a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#include <strstream></span> <a name="l00046"></a>00046 <span class="keyword">typedef</span> std::istrstream <a class="code" href="Arg_8h.html#ab31d9646d48ca9d02918cc36b138e67b">istringstream</a>; <a name="l00047"></a>00047 <span class="preprocessor">#else</span> <a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#error "Need a stringstream (sstream or strstream) to compile!"</span> <a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00050"></a>00050 <span class="preprocessor"></span> <a name="l00051"></a>00051 <span class="preprocessor">#include <<a class="code" href="ArgException_8h.html">tclap/ArgException.h</a>></span> <a name="l00052"></a>00052 <span class="preprocessor">#include <<a class="code" href="Visitor_8h.html">tclap/Visitor.h</a>></span> <a name="l00053"></a>00053 <span class="preprocessor">#include <<a class="code" href="CmdLineInterface_8h.html">tclap/CmdLineInterface.h</a>></span> <a name="l00054"></a>00054 <span class="preprocessor">#include <<a class="code" href="ArgTraits_8h.html">tclap/ArgTraits.h</a>></span> <a name="l00055"></a>00055 <span class="preprocessor">#include <<a class="code" href="StandardTraits_8h.html">tclap/StandardTraits.h</a>></span> <a name="l00056"></a>00056 <a name="l00057"></a><a class="code" href="namespaceTCLAP.html">00057</a> <span class="keyword">namespace </span>TCLAP { <a name="l00058"></a>00058 <a name="l00064"></a><a class="code" href="classTCLAP_1_1Arg.html">00064</a> <span class="keyword">class </span><a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a> <a name="l00065"></a>00065 { <a name="l00066"></a>00066 <span class="keyword">private</span>: <a name="l00070"></a>00070 <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>(<span class="keyword">const</span> <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>& rhs); <a name="l00071"></a>00071 <a name="l00075"></a>00075 <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>& operator=(<span class="keyword">const</span> <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>& rhs); <a name="l00076"></a>00076 <a name="l00080"></a>00080 <span class="keyword">static</span> <span class="keywordtype">bool</span>& ignoreRestRef() { <span class="keyword">static</span> <span class="keywordtype">bool</span> ign = <span class="keyword">false</span>; <span class="keywordflow">return</span> ign; } <a name="l00081"></a>00081 <a name="l00086"></a>00086 <span class="keyword">static</span> <span class="keywordtype">char</span>& delimiterRef() { <span class="keyword">static</span> <span class="keywordtype">char</span> delim = <span class="charliteral">' '</span>; <span class="keywordflow">return</span> delim; } <a name="l00087"></a>00087 <a name="l00088"></a>00088 <span class="keyword">protected</span>: <a name="l00089"></a>00089 <a name="l00098"></a><a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5">00098</a> std::string <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a>; <a name="l00099"></a>00099 <a name="l00107"></a><a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa">00107</a> std::string <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a>; <a name="l00108"></a>00108 <a name="l00112"></a><a class="code" href="classTCLAP_1_1Arg.html#a9882fe256eaab01ac53db54ac657d272">00112</a> std::string <a class="code" href="classTCLAP_1_1Arg.html#a9882fe256eaab01ac53db54ac657d272" title="Description of the argument.">_description</a>; <a name="l00113"></a>00113 <a name="l00117"></a><a class="code" href="classTCLAP_1_1Arg.html#ad16408bd1ca4d8b1d14d6c5129545a84">00117</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#ad16408bd1ca4d8b1d14d6c5129545a84" title="Indicating whether the argument is required.">_required</a>; <a name="l00118"></a>00118 <a name="l00123"></a><a class="code" href="classTCLAP_1_1Arg.html#a2ed097a868e34a0c4f6062ead744ac54">00123</a> std::string <a class="code" href="classTCLAP_1_1Arg.html#a2ed097a868e34a0c4f6062ead744ac54" title="Label to be used in usage description.">_requireLabel</a>; <a name="l00124"></a>00124 <a name="l00130"></a><a class="code" href="classTCLAP_1_1Arg.html#a776682b7e19f4dc231bbad3d10034dfa">00130</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a776682b7e19f4dc231bbad3d10034dfa" title="Indicates whether a value is required for the argument.">_valueRequired</a>; <a name="l00131"></a>00131 <a name="l00137"></a><a class="code" href="classTCLAP_1_1Arg.html#a829e32129857d2683e5791a5df1208ec">00137</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a829e32129857d2683e5791a5df1208ec" title="Indicates whether the argument has been set.">_alreadySet</a>; <a name="l00138"></a>00138 <a name="l00145"></a><a class="code" href="classTCLAP_1_1Arg.html#aa9ff037e92c9fa5bd85e532f61899300">00145</a> <a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* <a class="code" href="classTCLAP_1_1Arg.html#aa9ff037e92c9fa5bd85e532f61899300" title="A pointer to a vistitor object.">_visitor</a>; <a name="l00146"></a>00146 <a name="l00150"></a><a class="code" href="classTCLAP_1_1Arg.html#a9832bb7564f4ab472bd51b7b1bbc683f">00150</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a9832bb7564f4ab472bd51b7b1bbc683f" title="Whether this argument can be ignored, if desired.">_ignoreable</a>; <a name="l00151"></a>00151 <a name="l00156"></a><a class="code" href="classTCLAP_1_1Arg.html#ab413bd1d8a7ecf3c89672ee23ef791ba">00156</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#ab413bd1d8a7ecf3c89672ee23ef791ba" title="Indicates that the arg was set as part of an XOR and not on the command line.">_xorSet</a>; <a name="l00157"></a>00157 <a name="l00158"></a><a class="code" href="classTCLAP_1_1Arg.html#a13130a9a5d22c57a6d42a8883c9b1e0f">00158</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a13130a9a5d22c57a6d42a8883c9b1e0f">_acceptsMultipleValues</a>; <a name="l00159"></a>00159 <a name="l00163"></a>00163 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#aa963d0d4c8cb297e1f4cf74143bf6d1b" title="Performs the special handling described by the Vistitor.">_checkWithVisitor</a>() <span class="keyword">const</span>; <a name="l00164"></a>00164 <a name="l00178"></a>00178 <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>( <span class="keyword">const</span> std::string& flag, <a name="l00179"></a>00179 <span class="keyword">const</span> std::string& name, <a name="l00180"></a>00180 <span class="keyword">const</span> std::string& desc, <a name="l00181"></a>00181 <span class="keywordtype">bool</span> req, <a name="l00182"></a>00182 <span class="keywordtype">bool</span> valreq, <a name="l00183"></a>00183 <a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v = NULL ); <a name="l00184"></a>00184 <a name="l00185"></a>00185 <span class="keyword">public</span>: <a name="l00189"></a>00189 <span class="keyword">virtual</span> <a class="code" href="classTCLAP_1_1Arg.html#a15734a7cf52c8c4ab6df70f0997bbee3" title="Destructor.">~Arg</a>(); <a name="l00190"></a>00190 <a name="l00195"></a>00195 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#a9ff1564beeea2ef855f7fa483c37d0e2" title="Adds this to the specified list of Args.">addToList</a>( std::list<Arg*>& argList ) <span class="keyword">const</span>; <a name="l00196"></a>00196 <a name="l00200"></a><a class="code" href="classTCLAP_1_1Arg.html#a24165d31c1ec70777fb201356b6cdf6a">00200</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#a24165d31c1ec70777fb201356b6cdf6a" title="Begin ignoring arguments since the &quot;--&quot; argument was specified.">beginIgnoring</a>() { ignoreRestRef() = <span class="keyword">true</span>; } <a name="l00201"></a>00201 <a name="l00205"></a><a class="code" href="classTCLAP_1_1Arg.html#a4d412155b8f9b4956e64e91c48e55a3b">00205</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a4d412155b8f9b4956e64e91c48e55a3b" title="Whether to ignore the rest.">ignoreRest</a>() { <span class="keywordflow">return</span> ignoreRestRef(); } <a name="l00206"></a>00206 <a name="l00211"></a><a class="code" href="classTCLAP_1_1Arg.html#aadef6ca7e40f5b3d3fd03186976aea7e">00211</a> <span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="classTCLAP_1_1Arg.html#aadef6ca7e40f5b3d3fd03186976aea7e" title="The delimiter that separates an argument flag/name from the value.">delimiter</a>() { <span class="keywordflow">return</span> delimiterRef(); } <a name="l00212"></a>00212 <a name="l00217"></a><a class="code" href="classTCLAP_1_1Arg.html#a0abd38f46dbf7d267078134a4817fbb2">00217</a> <span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="classTCLAP_1_1Arg.html#a0abd38f46dbf7d267078134a4817fbb2" title="The char used as a place holder when SwitchArgs are combined.">blankChar</a>() { <span class="keywordflow">return</span> (<span class="keywordtype">char</span>)7; } <a name="l00218"></a>00218 <a name="l00223"></a>00223 <span class="preprocessor">#ifndef TCLAP_FLAGSTARTCHAR</span> <a name="l00224"></a><a class="code" href="Arg_8h.html#a892de6ada8e6a8ed25e303ca564a8447">00224</a> <span class="preprocessor"></span><span class="preprocessor">#define TCLAP_FLAGSTARTCHAR '-'</span> <a name="l00225"></a>00225 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00226"></a><a class="code" href="classTCLAP_1_1Arg.html#a7f9f6af439993e9151bd5a6cd2a63dad">00226</a> <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="classTCLAP_1_1Arg.html#a7f9f6af439993e9151bd5a6cd2a63dad">flagStartChar</a>() { <span class="keywordflow">return</span> <a class="code" href="Arg_8h.html#a892de6ada8e6a8ed25e303ca564a8447" title="The char that indicates the beginning of a flag.">TCLAP_FLAGSTARTCHAR</a>; } <a name="l00227"></a>00227 <a name="l00233"></a>00233 <span class="preprocessor">#ifndef TCLAP_FLAGSTARTSTRING</span> <a name="l00234"></a><a class="code" href="Arg_8h.html#a542fe8477a66451cf2d983fd4c4f1846">00234</a> <span class="preprocessor"></span><span class="preprocessor">#define TCLAP_FLAGSTARTSTRING "-"</span> <a name="l00235"></a>00235 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00236"></a><a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">00236</a> <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">flagStartString</a>() { <span class="keywordflow">return</span> <a class="code" href="Arg_8h.html#a542fe8477a66451cf2d983fd4c4f1846" title="The sting that indicates the beginning of a flag.">TCLAP_FLAGSTARTSTRING</a>; } <a name="l00237"></a>00237 <a name="l00242"></a>00242 <span class="preprocessor">#ifndef TCLAP_NAMESTARTSTRING</span> <a name="l00243"></a><a class="code" href="Arg_8h.html#ab497be2528843816edec2ec9897dfca2">00243</a> <span class="preprocessor"></span><span class="preprocessor">#define TCLAP_NAMESTARTSTRING "--"</span> <a name="l00244"></a>00244 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00245"></a><a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">00245</a> <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">nameStartString</a>() { <span class="keywordflow">return</span> <a class="code" href="Arg_8h.html#ab497be2528843816edec2ec9897dfca2" title="The sting that indicates the beginning of a name.">TCLAP_NAMESTARTSTRING</a>; } <a name="l00246"></a>00246 <a name="l00250"></a><a class="code" href="classTCLAP_1_1Arg.html#a6ce0cbe4effd44679ca11f25e3c318e7">00250</a> <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#a6ce0cbe4effd44679ca11f25e3c318e7" title="The name used to identify the ignore rest argument.">ignoreNameString</a>() { <span class="keywordflow">return</span> <span class="stringliteral">"ignore_rest"</span>; } <a name="l00251"></a>00251 <a name="l00256"></a><a class="code" href="classTCLAP_1_1Arg.html#ad059b63424001b9aedb4c019e2854c3c">00256</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#ad059b63424001b9aedb4c019e2854c3c" title="Sets the delimiter for all arguments.">setDelimiter</a>( <span class="keywordtype">char</span> c ) { delimiterRef() = c; } <a name="l00257"></a>00257 <a name="l00265"></a>00265 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a61ffe2f660a76111d256f7b22a686146" title="Pure virtual method meant to handle the parsing and value assignment of the string...">processArg</a>(<span class="keywordtype">int</span> *i, std::vector<std::string>& args) = 0; <a name="l00266"></a>00266 <a name="l00272"></a>00272 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a657a8d2842b7de9ced5a5a55db01d367" title="Operator ==.">operator==</a>(<span class="keyword">const</span> <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>& a) <span class="keyword">const</span>; <a name="l00273"></a>00273 <a name="l00277"></a>00277 <span class="keyword">const</span> std::string& <a class="code" href="classTCLAP_1_1Arg.html#a22f616e81a423e794f13a9ae1549ac77" title="Returns the argument flag.">getFlag</a>() <span class="keyword">const</span>; <a name="l00278"></a>00278 <a name="l00282"></a>00282 <span class="keyword">const</span> std::string& <a class="code" href="classTCLAP_1_1Arg.html#a641ced141a56c74fee11d3e3a808f731" title="Returns the argument name.">getName</a>() <span class="keyword">const</span>; <a name="l00283"></a>00283 <a name="l00287"></a>00287 std::string <a class="code" href="classTCLAP_1_1Arg.html#a1943999fadcb4f28cecd6ba55ed0b085" title="Returns the argument description.">getDescription</a>() <span class="keyword">const</span>; <a name="l00288"></a>00288 <a name="l00292"></a>00292 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a00a3cfdb2b6e9a111ad39cbd4978b96c" title="Indicates whether the argument is required.">isRequired</a>() <span class="keyword">const</span>; <a name="l00293"></a>00293 <a name="l00298"></a>00298 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#a58e3de560f364d0bb6bdf36ab533a6fd" title="Sets _required to true.">forceRequired</a>(); <a name="l00299"></a>00299 <a name="l00304"></a>00304 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#aec525c8092e56f7f5aa455e71bc72374" title="Sets the _alreadySet value to true.">xorSet</a>(); <a name="l00305"></a>00305 <a name="l00309"></a>00309 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a1373d50d4b93c16db43c7600cf6d0355" title="Indicates whether a value must be specified for argument.">isValueRequired</a>() <span class="keyword">const</span>; <a name="l00310"></a>00310 <a name="l00315"></a>00315 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a6af7a1e92b5d92fc2d90c1a95aab4384" title="Indicates whether the argument has already been set.">isSet</a>() <span class="keyword">const</span>; <a name="l00316"></a>00316 <a name="l00320"></a>00320 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a33816b5ccc58a15f3a998480e5d988e2" title="Indicates whether the argument can be ignored, if desired.">isIgnoreable</a>() <span class="keyword">const</span>; <a name="l00321"></a>00321 <a name="l00330"></a>00330 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#aac37b1b734b477e5d16f2037dba9c125" title="A method that tests whether a string matches this argument.">argMatches</a>( <span class="keyword">const</span> std::string& s ) <span class="keyword">const</span>; <a name="l00331"></a>00331 <a name="l00336"></a>00336 <span class="keyword">virtual</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2" title="Returns a simple string representation of the argument.">toString</a>() <span class="keyword">const</span>; <a name="l00337"></a>00337 <a name="l00342"></a>00342 <span class="keyword">virtual</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#aef8efaf3811162b2b2b2a84c6db280fa" title="Returns a short ID for the usage.">shortID</a>( <span class="keyword">const</span> std::string& valueId = <span class="stringliteral">"val"</span> ) <span class="keyword">const</span>; <a name="l00343"></a>00343 <a name="l00348"></a>00348 <span class="keyword">virtual</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#aad93aff46e1fc67e3853765f565bfa96" title="Returns a long ID for the usage.">longID</a>( <span class="keyword">const</span> std::string& valueId = <span class="stringliteral">"val"</span> ) <span class="keyword">const</span>; <a name="l00349"></a>00349 <a name="l00357"></a>00357 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#a54595328e81f5fb77859563690faab25" title="Trims a value off of the flag.">trimFlag</a>( std::string& flag, std::string& value ) <span class="keyword">const</span>; <a name="l00358"></a>00358 <a name="l00365"></a>00365 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a2eb0ffefe163218bdc8b4b7a33a974a7" title="Checks whether a given string has blank chars, indicating that it is a combined SwitchArg...">_hasBlanks</a>( <span class="keyword">const</span> std::string& s ) <span class="keyword">const</span>; <a name="l00366"></a>00366 <a name="l00372"></a>00372 <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#aae5c959f31af1a484a8af06f84a6e8b0" title="Sets the requireLabel.">setRequireLabel</a>( <span class="keyword">const</span> std::string& s ); <a name="l00373"></a>00373 <a name="l00378"></a>00378 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a9aef735d37ef95ca1b7dc7a07850b984" title="Used for MultiArgs and XorHandler to determine whether args can still be set.">allowMore</a>(); <a name="l00379"></a>00379 <a name="l00384"></a>00384 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#ad356870538a255d639e26b30330202ae" title="Use by output classes to determine whether an Arg accepts multiple values.">acceptsMultipleValues</a>(); <a name="l00385"></a>00385 <a name="l00390"></a>00390 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#ab5b5dc9a9b0381561f0684523f943a2c" title="Clears the Arg object and allows it to be reused by new command lines.">reset</a>(); <a name="l00391"></a>00391 }; <a name="l00392"></a>00392 <a name="l00396"></a><a class="code" href="namespaceTCLAP.html#aa7d6a803e0690c3c8b1db57c145648c5">00396</a> <span class="keyword">typedef</span> std::list<Arg*>::iterator <a class="code" href="namespaceTCLAP.html#aa7d6a803e0690c3c8b1db57c145648c5" title="Typedef of an Arg list iterator.">ArgListIterator</a>; <a name="l00397"></a>00397 <a name="l00401"></a><a class="code" href="namespaceTCLAP.html#a04213af1ffc3178ce5f771d21d5164a2">00401</a> <span class="keyword">typedef</span> std::vector<Arg*>::iterator <a class="code" href="namespaceTCLAP.html#a04213af1ffc3178ce5f771d21d5164a2" title="Typedef of an Arg vector iterator.">ArgVectorIterator</a>; <a name="l00402"></a>00402 <a name="l00406"></a><a class="code" href="namespaceTCLAP.html#a30300bc675a64eacafa1298268de1101">00406</a> <span class="keyword">typedef</span> std::list<Visitor*>::iterator <a class="code" href="namespaceTCLAP.html#a30300bc675a64eacafa1298268de1101" title="Typedef of a Visitor list iterator.">VisitorListIterator</a>; <a name="l00407"></a>00407 <a name="l00408"></a>00408 <span class="comment">/*</span> <a name="l00409"></a>00409 <span class="comment"> * Extract a value of type T from it's string representation contained</span> <a name="l00410"></a>00410 <span class="comment"> * in strVal. The ValueLike parameter used to select the correct</span> <a name="l00411"></a>00411 <span class="comment"> * specialization of ExtractValue depending on the value traits of T.</span> <a name="l00412"></a>00412 <span class="comment"> * ValueLike traits use operator>> to assign the value from strVal.</span> <a name="l00413"></a>00413 <span class="comment"> */</span> <a name="l00414"></a>00414 <span class="keyword">template</span><<span class="keyword">typename</span> T> <span class="keywordtype">void</span> <a name="l00415"></a><a class="code" href="namespaceTCLAP.html#a80473f9a24db31df0206504c2cdf0a8d">00415</a> <a class="code" href="namespaceTCLAP.html#a80473f9a24db31df0206504c2cdf0a8d">ExtractValue</a>(T &destVal, <span class="keyword">const</span> std::string& strVal, <a class="code" href="structTCLAP_1_1ValueLike.html" title="A value like argument value type is a value that can be set using operator&gt;&gt;...">ValueLike</a> vl) <a name="l00416"></a>00416 { <a name="l00417"></a>00417 <span class="keyword">static_cast<</span><span class="keywordtype">void</span><span class="keyword">></span>(vl); <span class="comment">// Avoid warning about unused vl</span> <a name="l00418"></a>00418 <a class="code" href="Arg_8h.html#ab31d9646d48ca9d02918cc36b138e67b">std::istringstream</a> is(strVal); <a name="l00419"></a>00419 <a name="l00420"></a>00420 <span class="keywordtype">int</span> valuesRead = 0; <a name="l00421"></a>00421 <span class="keywordflow">while</span> ( is.good() ) { <a name="l00422"></a>00422 <span class="keywordflow">if</span> ( is.peek() != EOF ) <a name="l00423"></a>00423 #ifdef TCLAP_SETBASE_ZERO <a name="l00424"></a>00424 is >> std::setbase(0) >> destVal; <a name="l00425"></a>00425 <span class="preprocessor">#else</span> <a name="l00426"></a>00426 <span class="preprocessor"></span> is >> destVal; <a name="l00427"></a>00427 <span class="preprocessor">#endif</span> <a name="l00428"></a>00428 <span class="preprocessor"></span> <span class="keywordflow">else</span> <a name="l00429"></a>00429 <span class="keywordflow">break</span>; <a name="l00430"></a>00430 <a name="l00431"></a>00431 valuesRead++; <a name="l00432"></a>00432 } <a name="l00433"></a>00433 <a name="l00434"></a>00434 <span class="keywordflow">if</span> ( is.fail() ) <a name="l00435"></a>00435 <span class="keywordflow">throw</span>( <a class="code" href="classTCLAP_1_1ArgParseException.html" title="Thrown from within the child Arg classes when it fails to properly parse the argument...">ArgParseException</a>(<span class="stringliteral">"Couldn't read argument value "</span> <a name="l00436"></a>00436 <span class="stringliteral">"from string '"</span> + strVal + <span class="stringliteral">"'"</span>)); <a name="l00437"></a>00437 <a name="l00438"></a>00438 <a name="l00439"></a>00439 <span class="keywordflow">if</span> ( valuesRead > 1 ) <a name="l00440"></a>00440 <span class="keywordflow">throw</span>( <a class="code" href="classTCLAP_1_1ArgParseException.html" title="Thrown from within the child Arg classes when it fails to properly parse the argument...">ArgParseException</a>(<span class="stringliteral">"More than one valid value parsed from "</span> <a name="l00441"></a>00441 <span class="stringliteral">"string '"</span> + strVal + <span class="stringliteral">"'"</span>)); <a name="l00442"></a>00442 <a name="l00443"></a>00443 } <a name="l00444"></a>00444 <a name="l00445"></a>00445 <span class="comment">/*</span> <a name="l00446"></a>00446 <span class="comment"> * Extract a value of type T from it's string representation contained</span> <a name="l00447"></a>00447 <span class="comment"> * in strVal. The ValueLike parameter used to select the correct</span> <a name="l00448"></a>00448 <span class="comment"> * specialization of ExtractValue depending on the value traits of T.</span> <a name="l00449"></a>00449 <span class="comment"> * StringLike uses assignment (operator=) to assign from strVal.</span> <a name="l00450"></a>00450 <span class="comment"> */</span> <a name="l00451"></a>00451 <span class="keyword">template</span><<span class="keyword">typename</span> T> <span class="keywordtype">void</span> <a name="l00452"></a><a class="code" href="namespaceTCLAP.html#adf4c56655c8414e1dd70d56ceda8ce3f">00452</a> <a class="code" href="namespaceTCLAP.html#a80473f9a24db31df0206504c2cdf0a8d">ExtractValue</a>(T &destVal, <span class="keyword">const</span> std::string& strVal, <a class="code" href="structTCLAP_1_1StringLike.html" title="A string like argument value type is a value that can be set using operator=(string)...">StringLike</a> sl) <a name="l00453"></a>00453 { <a name="l00454"></a>00454 <span class="keyword">static_cast<</span><span class="keywordtype">void</span><span class="keyword">></span>(sl); <span class="comment">// Avoid warning about unused sl</span> <a name="l00455"></a>00455 <a class="code" href="namespaceTCLAP.html#a06cca5c0de2e5803a67c63cde60a2dfb">SetString</a>(destVal, strVal); <a name="l00456"></a>00456 } <a name="l00457"></a>00457 <a name="l00459"></a>00459 <span class="comment">//BEGIN Arg.cpp</span> <a name="l00461"></a>00461 <span class="comment"></span> <a name="l00462"></a><a class="code" href="classTCLAP_1_1Arg.html#ab25a06db5edf82a5b965b641b3c63372">00462</a> <span class="keyword">inline</span> Arg::Arg(<span class="keyword">const</span> std::string& flag, <a name="l00463"></a>00463 <span class="keyword">const</span> std::string& name, <a name="l00464"></a>00464 <span class="keyword">const</span> std::string& desc, <a name="l00465"></a>00465 <span class="keywordtype">bool</span> req, <a name="l00466"></a>00466 <span class="keywordtype">bool</span> valreq, <a name="l00467"></a>00467 <a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v) : <a name="l00468"></a>00468 _flag(flag), <a name="l00469"></a>00469 _name(name), <a name="l00470"></a>00470 _description(desc), <a name="l00471"></a>00471 _required(req), <a name="l00472"></a>00472 _requireLabel(<span class="stringliteral">"required"</span>), <a name="l00473"></a>00473 _valueRequired(valreq), <a name="l00474"></a>00474 _alreadySet(false), <a name="l00475"></a>00475 _visitor( v ), <a name="l00476"></a>00476 _ignoreable(true), <a name="l00477"></a>00477 _xorSet(false), <a name="l00478"></a>00478 _acceptsMultipleValues(false) <a name="l00479"></a>00479 { <a name="l00480"></a>00480 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a>.length() > 1 ) <a name="l00481"></a>00481 <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="l00482"></a>00482 <span class="stringliteral">"Argument flag can only be one character long"</span>, <a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2" title="Returns a simple string representation of the argument.">toString</a>() ) ); <a name="l00483"></a>00483 <a name="l00484"></a>00484 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a> != <a class="code" href="classTCLAP_1_1Arg.html#a6ce0cbe4effd44679ca11f25e3c318e7" title="The name used to identify the ignore rest argument.">ignoreNameString</a>() && <a name="l00485"></a>00485 ( <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> == <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>() || <a name="l00486"></a>00486 <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> == <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() || <a name="l00487"></a>00487 <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> == <span class="stringliteral">" "</span> ) ) <a name="l00488"></a>00488 <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>(<span class="stringliteral">"Argument flag cannot be either '"</span> + <a name="l00489"></a>00489 <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>() + <span class="stringliteral">"' or '"</span> + <a name="l00490"></a>00490 <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() + <span class="stringliteral">"' or a space."</span>, <a name="l00491"></a>00491 <a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2" title="Returns a simple string representation of the argument.">toString</a>() ) ); <a name="l00492"></a>00492 <a name="l00493"></a>00493 <span class="keywordflow">if</span> ( ( <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a>.substr( 0, <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>().length() ) == <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>() ) || <a name="l00494"></a>00494 ( <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a>.substr( 0, <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>().length() ) == <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() ) || <a name="l00495"></a>00495 ( <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a>.find( <span class="stringliteral">" "</span>, 0 ) != std::string::npos ) ) <a name="l00496"></a>00496 <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>(<span class="stringliteral">"Argument name begin with either '"</span> + <a name="l00497"></a>00497 <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>() + <span class="stringliteral">"' or '"</span> + <a name="l00498"></a>00498 <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() + <span class="stringliteral">"' or space."</span>, <a name="l00499"></a>00499 <a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2" title="Returns a simple string representation of the argument.">toString</a>() ) ); <a name="l00500"></a>00500 <a name="l00501"></a>00501 } <a name="l00502"></a>00502 <a name="l00503"></a><a class="code" href="classTCLAP_1_1Arg.html#a15734a7cf52c8c4ab6df70f0997bbee3">00503</a> <span class="keyword">inline</span> <a class="code" href="classTCLAP_1_1Arg.html#a15734a7cf52c8c4ab6df70f0997bbee3" title="Destructor.">Arg::~Arg</a>() { } <a name="l00504"></a>00504 <a name="l00505"></a><a class="code" href="classTCLAP_1_1Arg.html#aef8efaf3811162b2b2b2a84c6db280fa">00505</a> <span class="keyword">inline</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#aef8efaf3811162b2b2b2a84c6db280fa" title="Returns a short ID for the usage.">Arg::shortID</a>( <span class="keyword">const</span> std::string& valueId )<span class="keyword"> const</span> <a name="l00506"></a>00506 <span class="keyword"></span>{ <a name="l00507"></a>00507 std::string <span class="keywordtype">id</span> = <span class="stringliteral">""</span>; <a name="l00508"></a>00508 <a name="l00509"></a>00509 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> != <span class="stringliteral">""</span> ) <a name="l00510"></a>00510 <span class="keywordtype">id</span> = <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>() + <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a>; <a name="l00511"></a>00511 <span class="keywordflow">else</span> <a name="l00512"></a>00512 <span class="keywordtype">id</span> = <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() + <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a>; <a name="l00513"></a>00513 <a name="l00514"></a>00514 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#a776682b7e19f4dc231bbad3d10034dfa" title="Indicates whether a value is required for the argument.">_valueRequired</a> ) <a name="l00515"></a>00515 <span class="keywordtype">id</span> += std::string( 1, <a class="code" href="classTCLAP_1_1Arg.html#aadef6ca7e40f5b3d3fd03186976aea7e" title="The delimiter that separates an argument flag/name from the value.">Arg::delimiter</a>() ) + <span class="stringliteral">"<"</span> + valueId + <span class="stringliteral">">"</span>; <a name="l00516"></a>00516 <a name="l00517"></a>00517 <span class="keywordflow">if</span> ( !<a class="code" href="classTCLAP_1_1Arg.html#ad16408bd1ca4d8b1d14d6c5129545a84" title="Indicating whether the argument is required.">_required</a> ) <a name="l00518"></a>00518 <span class="keywordtype">id</span> = <span class="stringliteral">"["</span> + <span class="keywordtype">id</span> + <span class="stringliteral">"]"</span>; <a name="l00519"></a>00519 <a name="l00520"></a>00520 <span class="keywordflow">return</span> id; <a name="l00521"></a>00521 } <a name="l00522"></a>00522 <a name="l00523"></a><a class="code" href="classTCLAP_1_1Arg.html#aad93aff46e1fc67e3853765f565bfa96">00523</a> <span class="keyword">inline</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#aad93aff46e1fc67e3853765f565bfa96" title="Returns a long ID for the usage.">Arg::longID</a>( <span class="keyword">const</span> std::string& valueId )<span class="keyword"> const</span> <a name="l00524"></a>00524 <span class="keyword"></span>{ <a name="l00525"></a>00525 std::string <span class="keywordtype">id</span> = <span class="stringliteral">""</span>; <a name="l00526"></a>00526 <a name="l00527"></a>00527 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> != <span class="stringliteral">""</span> ) <a name="l00528"></a>00528 { <a name="l00529"></a>00529 <span class="keywordtype">id</span> += <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>() + <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a>; <a name="l00530"></a>00530 <a name="l00531"></a>00531 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#a776682b7e19f4dc231bbad3d10034dfa" title="Indicates whether a value is required for the argument.">_valueRequired</a> ) <a name="l00532"></a>00532 <span class="keywordtype">id</span> += std::string( 1, <a class="code" href="classTCLAP_1_1Arg.html#aadef6ca7e40f5b3d3fd03186976aea7e" title="The delimiter that separates an argument flag/name from the value.">Arg::delimiter</a>() ) + <span class="stringliteral">"<"</span> + valueId + <span class="stringliteral">">"</span>; <a name="l00533"></a>00533 <a name="l00534"></a>00534 <span class="keywordtype">id</span> += <span class="stringliteral">", "</span>; <a name="l00535"></a>00535 } <a name="l00536"></a>00536 <a name="l00537"></a>00537 <span class="keywordtype">id</span> += <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() + <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a>; <a name="l00538"></a>00538 <a name="l00539"></a>00539 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#a776682b7e19f4dc231bbad3d10034dfa" title="Indicates whether a value is required for the argument.">_valueRequired</a> ) <a name="l00540"></a>00540 <span class="keywordtype">id</span> += std::string( 1, <a class="code" href="classTCLAP_1_1Arg.html#aadef6ca7e40f5b3d3fd03186976aea7e" title="The delimiter that separates an argument flag/name from the value.">Arg::delimiter</a>() ) + <span class="stringliteral">"<"</span> + valueId + <span class="stringliteral">">"</span>; <a name="l00541"></a>00541 <a name="l00542"></a>00542 <span class="keywordflow">return</span> id; <a name="l00543"></a>00543 <a name="l00544"></a>00544 } <a name="l00545"></a>00545 <a name="l00546"></a><a class="code" href="classTCLAP_1_1Arg.html#a657a8d2842b7de9ced5a5a55db01d367">00546</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a657a8d2842b7de9ced5a5a55db01d367" title="Operator ==.">Arg::operator==</a>(<span class="keyword">const</span> <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>& a)<span class="keyword"> const</span> <a name="l00547"></a>00547 <span class="keyword"></span>{ <a name="l00548"></a>00548 <span class="keywordflow">if</span> ( ( <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> != <span class="stringliteral">""</span> && <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> == a.<a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> ) || <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a> == a.<a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a>) <a name="l00549"></a>00549 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00550"></a>00550 <span class="keywordflow">else</span> <a name="l00551"></a>00551 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00552"></a>00552 } <a name="l00553"></a>00553 <a name="l00554"></a><a class="code" href="classTCLAP_1_1Arg.html#a1943999fadcb4f28cecd6ba55ed0b085">00554</a> <span class="keyword">inline</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#a1943999fadcb4f28cecd6ba55ed0b085" title="Returns the argument description.">Arg::getDescription</a>()<span class="keyword"> const</span> <a name="l00555"></a>00555 <span class="keyword"></span>{ <a name="l00556"></a>00556 std::string desc = <span class="stringliteral">""</span>; <a name="l00557"></a>00557 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#ad16408bd1ca4d8b1d14d6c5129545a84" title="Indicating whether the argument is required.">_required</a> ) <a name="l00558"></a>00558 desc = <span class="stringliteral">"("</span> + <a class="code" href="classTCLAP_1_1Arg.html#a2ed097a868e34a0c4f6062ead744ac54" title="Label to be used in usage description.">_requireLabel</a> + <span class="stringliteral">") "</span>; <a name="l00559"></a>00559 <a name="l00560"></a>00560 <span class="comment">// if ( _valueRequired )</span> <a name="l00561"></a>00561 <span class="comment">// desc += "(value required) ";</span> <a name="l00562"></a>00562 <a name="l00563"></a>00563 desc += <a class="code" href="classTCLAP_1_1Arg.html#a9882fe256eaab01ac53db54ac657d272" title="Description of the argument.">_description</a>; <a name="l00564"></a>00564 <span class="keywordflow">return</span> desc; <a name="l00565"></a>00565 } <a name="l00566"></a>00566 <a name="l00567"></a><a class="code" href="classTCLAP_1_1Arg.html#a22f616e81a423e794f13a9ae1549ac77">00567</a> <span class="keyword">inline</span> <span class="keyword">const</span> std::string& <a class="code" href="classTCLAP_1_1Arg.html#a22f616e81a423e794f13a9ae1549ac77" title="Returns the argument flag.">Arg::getFlag</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a>; } <a name="l00568"></a>00568 <a name="l00569"></a><a class="code" href="classTCLAP_1_1Arg.html#a641ced141a56c74fee11d3e3a808f731">00569</a> <span class="keyword">inline</span> <span class="keyword">const</span> std::string& <a class="code" href="classTCLAP_1_1Arg.html#a641ced141a56c74fee11d3e3a808f731" title="Returns the argument name.">Arg::getName</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a>; } <a name="l00570"></a>00570 <a name="l00571"></a><a class="code" href="classTCLAP_1_1Arg.html#a00a3cfdb2b6e9a111ad39cbd4978b96c">00571</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a00a3cfdb2b6e9a111ad39cbd4978b96c" title="Indicates whether the argument is required.">Arg::isRequired</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1Arg.html#ad16408bd1ca4d8b1d14d6c5129545a84" title="Indicating whether the argument is required.">_required</a>; } <a name="l00572"></a>00572 <a name="l00573"></a><a class="code" href="classTCLAP_1_1Arg.html#a1373d50d4b93c16db43c7600cf6d0355">00573</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a1373d50d4b93c16db43c7600cf6d0355" title="Indicates whether a value must be specified for argument.">Arg::isValueRequired</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1Arg.html#a776682b7e19f4dc231bbad3d10034dfa" title="Indicates whether a value is required for the argument.">_valueRequired</a>; } <a name="l00574"></a>00574 <a name="l00575"></a><a class="code" href="classTCLAP_1_1Arg.html#a6af7a1e92b5d92fc2d90c1a95aab4384">00575</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a6af7a1e92b5d92fc2d90c1a95aab4384" title="Indicates whether the argument has already been set.">Arg::isSet</a>()<span class="keyword"> const</span> <a name="l00576"></a>00576 <span class="keyword"></span>{ <a name="l00577"></a>00577 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#a829e32129857d2683e5791a5df1208ec" title="Indicates whether the argument has been set.">_alreadySet</a> && !<a class="code" href="classTCLAP_1_1Arg.html#ab413bd1d8a7ecf3c89672ee23ef791ba" title="Indicates that the arg was set as part of an XOR and not on the command line.">_xorSet</a> ) <a name="l00578"></a>00578 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00579"></a>00579 <span class="keywordflow">else</span> <a name="l00580"></a>00580 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00581"></a>00581 } <a name="l00582"></a>00582 <a name="l00583"></a><a class="code" href="classTCLAP_1_1Arg.html#a33816b5ccc58a15f3a998480e5d988e2">00583</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a33816b5ccc58a15f3a998480e5d988e2" title="Indicates whether the argument can be ignored, if desired.">Arg::isIgnoreable</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1Arg.html#a9832bb7564f4ab472bd51b7b1bbc683f" title="Whether this argument can be ignored, if desired.">_ignoreable</a>; } <a name="l00584"></a>00584 <a name="l00585"></a><a class="code" href="classTCLAP_1_1Arg.html#aae5c959f31af1a484a8af06f84a6e8b0">00585</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#aae5c959f31af1a484a8af06f84a6e8b0" title="Sets the requireLabel.">Arg::setRequireLabel</a>( <span class="keyword">const</span> std::string& s) <a name="l00586"></a>00586 { <a name="l00587"></a>00587 <a class="code" href="classTCLAP_1_1Arg.html#a2ed097a868e34a0c4f6062ead744ac54" title="Label to be used in usage description.">_requireLabel</a> = s; <a name="l00588"></a>00588 } <a name="l00589"></a>00589 <a name="l00590"></a><a class="code" href="classTCLAP_1_1Arg.html#aac37b1b734b477e5d16f2037dba9c125">00590</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#aac37b1b734b477e5d16f2037dba9c125" title="A method that tests whether a string matches this argument.">Arg::argMatches</a>( <span class="keyword">const</span> std::string& argFlag )<span class="keyword"> const</span> <a name="l00591"></a>00591 <span class="keyword"></span>{ <a name="l00592"></a>00592 <span class="keywordflow">if</span> ( ( argFlag == <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>() + <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> && <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> != <span class="stringliteral">""</span> ) || <a name="l00593"></a>00593 argFlag == <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() + <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a> ) <a name="l00594"></a>00594 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00595"></a>00595 <span class="keywordflow">else</span> <a name="l00596"></a>00596 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00597"></a>00597 } <a name="l00598"></a>00598 <a name="l00599"></a><a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2">00599</a> <span class="keyword">inline</span> std::string <a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2" title="Returns a simple string representation of the argument.">Arg::toString</a>()<span class="keyword"> const</span> <a name="l00600"></a>00600 <span class="keyword"></span>{ <a name="l00601"></a>00601 std::string s = <span class="stringliteral">""</span>; <a name="l00602"></a>00602 <a name="l00603"></a>00603 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> != <span class="stringliteral">""</span> ) <a name="l00604"></a>00604 s += <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>() + <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a> + <span class="stringliteral">" "</span>; <a name="l00605"></a>00605 <a name="l00606"></a>00606 s += <span class="stringliteral">"("</span> + <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() + <a class="code" href="classTCLAP_1_1Arg.html#ac0f138057a99fb5d94ff4acb41a083aa" title="A single work namd indentifying the argument.">_name</a> + <span class="stringliteral">")"</span>; <a name="l00607"></a>00607 <a name="l00608"></a>00608 <span class="keywordflow">return</span> s; <a name="l00609"></a>00609 } <a name="l00610"></a>00610 <a name="l00611"></a><a class="code" href="classTCLAP_1_1Arg.html#aa963d0d4c8cb297e1f4cf74143bf6d1b">00611</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#aa963d0d4c8cb297e1f4cf74143bf6d1b" title="Performs the special handling described by the Vistitor.">Arg::_checkWithVisitor</a>()<span class="keyword"> const</span> <a name="l00612"></a>00612 <span class="keyword"></span>{ <a name="l00613"></a>00613 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#aa9ff037e92c9fa5bd85e532f61899300" title="A pointer to a vistitor object.">_visitor</a> != NULL ) <a name="l00614"></a>00614 <a class="code" href="classTCLAP_1_1Arg.html#aa9ff037e92c9fa5bd85e532f61899300" title="A pointer to a vistitor object.">_visitor</a>-><a class="code" href="classTCLAP_1_1Visitor.html#a08625664637579a24ba2f0ab3e713670" title="Does nothing.">visit</a>(); <a name="l00615"></a>00615 } <a name="l00616"></a>00616 <a name="l00620"></a><a class="code" href="classTCLAP_1_1Arg.html#a54595328e81f5fb77859563690faab25">00620</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#a54595328e81f5fb77859563690faab25" title="Trims a value off of the flag.">Arg::trimFlag</a>(std::string& flag, std::string& value)<span class="keyword"> const</span> <a name="l00621"></a>00621 <span class="keyword"></span>{ <a name="l00622"></a>00622 <span class="keywordtype">int</span> stop = 0; <a name="l00623"></a>00623 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; <span class="keyword">static_cast<</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">></span>(i) < flag.length(); i++ ) <a name="l00624"></a>00624 <span class="keywordflow">if</span> ( flag[i] == <a class="code" href="classTCLAP_1_1Arg.html#aadef6ca7e40f5b3d3fd03186976aea7e" title="The delimiter that separates an argument flag/name from the value.">Arg::delimiter</a>() ) <a name="l00625"></a>00625 { <a name="l00626"></a>00626 stop = i; <a name="l00627"></a>00627 <span class="keywordflow">break</span>; <a name="l00628"></a>00628 } <a name="l00629"></a>00629 <a name="l00630"></a>00630 <span class="keywordflow">if</span> ( stop > 1 ) <a name="l00631"></a>00631 { <a name="l00632"></a>00632 value = flag.substr(stop+1); <a name="l00633"></a>00633 flag = flag.substr(0,stop); <a name="l00634"></a>00634 } <a name="l00635"></a>00635 <a name="l00636"></a>00636 } <a name="l00637"></a>00637 <a name="l00641"></a><a class="code" href="classTCLAP_1_1Arg.html#a2eb0ffefe163218bdc8b4b7a33a974a7">00641</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a2eb0ffefe163218bdc8b4b7a33a974a7" title="Checks whether a given string has blank chars, indicating that it is a combined SwitchArg...">Arg::_hasBlanks</a>( <span class="keyword">const</span> std::string& s )<span class="keyword"> const</span> <a name="l00642"></a>00642 <span class="keyword"></span>{ <a name="l00643"></a>00643 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 1; <span class="keyword">static_cast<</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">></span>(i) < s.length(); i++ ) <a name="l00644"></a>00644 <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="l00645"></a>00645 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00646"></a>00646 <a name="l00647"></a>00647 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00648"></a>00648 } <a name="l00649"></a>00649 <a name="l00650"></a><a class="code" href="classTCLAP_1_1Arg.html#a58e3de560f364d0bb6bdf36ab533a6fd">00650</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#a58e3de560f364d0bb6bdf36ab533a6fd" title="Sets _required to true.">Arg::forceRequired</a>() <a name="l00651"></a>00651 { <a name="l00652"></a>00652 <a class="code" href="classTCLAP_1_1Arg.html#ad16408bd1ca4d8b1d14d6c5129545a84" title="Indicating whether the argument is required.">_required</a> = <span class="keyword">true</span>; <a name="l00653"></a>00653 } <a name="l00654"></a>00654 <a name="l00655"></a><a class="code" href="classTCLAP_1_1Arg.html#aec525c8092e56f7f5aa455e71bc72374">00655</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#aec525c8092e56f7f5aa455e71bc72374" title="Sets the _alreadySet value to true.">Arg::xorSet</a>() <a name="l00656"></a>00656 { <a name="l00657"></a>00657 <a class="code" href="classTCLAP_1_1Arg.html#a829e32129857d2683e5791a5df1208ec" title="Indicates whether the argument has been set.">_alreadySet</a> = <span class="keyword">true</span>; <a name="l00658"></a>00658 <a class="code" href="classTCLAP_1_1Arg.html#ab413bd1d8a7ecf3c89672ee23ef791ba" title="Indicates that the arg was set as part of an XOR and not on the command line.">_xorSet</a> = <span class="keyword">true</span>; <a name="l00659"></a>00659 } <a name="l00660"></a>00660 <a name="l00664"></a><a class="code" href="classTCLAP_1_1Arg.html#a9ff1564beeea2ef855f7fa483c37d0e2">00664</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#a9ff1564beeea2ef855f7fa483c37d0e2" title="Adds this to the specified list of Args.">Arg::addToList</a>( std::list<Arg*>& argList )<span class="keyword"> const</span> <a name="l00665"></a>00665 <span class="keyword"></span>{ <a name="l00666"></a>00666 argList.push_front( const_cast<Arg*>(<span class="keyword">this</span>) ); <a name="l00667"></a>00667 } <a name="l00668"></a>00668 <a name="l00669"></a><a class="code" href="classTCLAP_1_1Arg.html#a9aef735d37ef95ca1b7dc7a07850b984">00669</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#a9aef735d37ef95ca1b7dc7a07850b984" title="Used for MultiArgs and XorHandler to determine whether args can still be set.">Arg::allowMore</a>() <a name="l00670"></a>00670 { <a name="l00671"></a>00671 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00672"></a>00672 } <a name="l00673"></a>00673 <a name="l00674"></a><a class="code" href="classTCLAP_1_1Arg.html#ad356870538a255d639e26b30330202ae">00674</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1Arg.html#ad356870538a255d639e26b30330202ae" title="Use by output classes to determine whether an Arg accepts multiple values.">Arg::acceptsMultipleValues</a>() <a name="l00675"></a>00675 { <a name="l00676"></a>00676 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1Arg.html#a13130a9a5d22c57a6d42a8883c9b1e0f">_acceptsMultipleValues</a>; <a name="l00677"></a>00677 } <a name="l00678"></a>00678 <a name="l00679"></a><a class="code" href="classTCLAP_1_1Arg.html#ab5b5dc9a9b0381561f0684523f943a2c">00679</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1Arg.html#ab5b5dc9a9b0381561f0684523f943a2c" title="Clears the Arg object and allows it to be reused by new command lines.">Arg::reset</a>() <a name="l00680"></a>00680 { <a name="l00681"></a>00681 <a class="code" href="classTCLAP_1_1Arg.html#ab413bd1d8a7ecf3c89672ee23ef791ba" title="Indicates that the arg was set as part of an XOR and not on the command line.">_xorSet</a> = <span class="keyword">false</span>; <a name="l00682"></a>00682 <a class="code" href="classTCLAP_1_1Arg.html#a829e32129857d2683e5791a5df1208ec" title="Indicates whether the argument has been set.">_alreadySet</a> = <span class="keyword">false</span>; <a name="l00683"></a>00683 } <a name="l00684"></a>00684 <a name="l00686"></a>00686 <span class="comment">//END Arg.cpp</span> <a name="l00688"></a>00688 <span class="comment"></span> <a name="l00689"></a>00689 } <span class="comment">//namespace TCLAP</span> <a name="l00690"></a>00690 <a name="l00691"></a>00691 <span class="preprocessor">#endif</span> <a name="l00692"></a>00692 <span class="preprocessor"></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 <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.0 </small></address> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 16129 | tjuricek |
Rename/move files again... this time to the hyphenated-approach. |
||
//guest/tjuricek/file_system_client/main/vendor/tclap-1.2.1/docs/html/Arg_8h_source.html | |||||
#1 | 16119 | tjuricek | Rename/move to meet workshop project conventions. | ||
//guest/tjuricek/fsclient/vendor/tclap-1.2.1/docs/html/Arg_8h_source.html | |||||
#1 | 16118 | tjuricek |
FSClient initial version: handles add, edit This is a proof-of-concept app that mirrors an existing Perforce workspace to handle running commands like "p4 add" and "p4 edit" automatically when your apps add and write files. See the readme for more information. |