<!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: SwitchArg.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>SwitchArg.h</h1><a href="SwitchArg_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00002"></a>00002 <span class="comment">/****************************************************************************** </span> <a name="l00003"></a>00003 <span class="comment"> * </span> <a name="l00004"></a>00004 <span class="comment"> * file: SwitchArg.h</span> <a name="l00005"></a>00005 <span class="comment"> * </span> <a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 2003, Michael E. Smoot .</span> <a name="l00007"></a>00007 <span class="comment"> * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.</span> <a name="l00008"></a>00008 <span class="comment"> * All rights reverved.</span> <a name="l00009"></a>00009 <span class="comment"> * </span> <a name="l00010"></a>00010 <span class="comment"> * See the file COPYING in the top directory of this distribution for</span> <a name="l00011"></a>00011 <span class="comment"> * more information.</span> <a name="l00012"></a>00012 <span class="comment"> * </span> <a name="l00013"></a>00013 <span class="comment"> * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS </span> <a name="l00014"></a>00014 <span class="comment"> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, </span> <a name="l00015"></a>00015 <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL </span> <a name="l00016"></a>00016 <span class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER </span> <a name="l00017"></a>00017 <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING </span> <a name="l00018"></a>00018 <span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER </span> <a name="l00019"></a>00019 <span class="comment"> * DEALINGS IN THE SOFTWARE. </span> <a name="l00020"></a>00020 <span class="comment"> * </span> <a name="l00021"></a>00021 <span class="comment"> *****************************************************************************/</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="preprocessor">#ifndef TCLAP_SWITCH_ARG_H</span> <a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define TCLAP_SWITCH_ARG_H</span> <a name="l00026"></a>00026 <span class="preprocessor"></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <string></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <vector></span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include <<a class="code" href="Arg_8h.html">tclap/Arg.h</a>></span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="keyword">namespace </span>TCLAP { <a name="l00033"></a>00033 <a name="l00039"></a><a class="code" href="classTCLAP_1_1SwitchArg.html">00039</a> <span class="keyword">class </span><a class="code" href="classTCLAP_1_1SwitchArg.html" title="A simple switch argument.">SwitchArg</a> : <span class="keyword">public</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="l00040"></a>00040 { <a name="l00041"></a>00041 <span class="keyword">protected</span>: <a name="l00042"></a>00042 <a name="l00046"></a><a class="code" href="classTCLAP_1_1SwitchArg.html#a0389ecebecc504d9756703d46e8cf3ca">00046</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#a0389ecebecc504d9756703d46e8cf3ca" title="The value of the switch.">_value</a>; <a name="l00047"></a>00047 <a name="l00052"></a><a class="code" href="classTCLAP_1_1SwitchArg.html#ae25a99eb06fc2ee75a3b98edba1d5d8d">00052</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#ae25a99eb06fc2ee75a3b98edba1d5d8d" title="Used to support the reset() method so that ValueArg can be reset to their constructed...">_default</a>; <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="keyword">public</span>: <a name="l00055"></a>00055 <a name="l00068"></a>00068 <a class="code" href="classTCLAP_1_1SwitchArg.html#a3895b036fa2d36e4fcfa41dfcdb298c1" title="SwitchArg constructor.">SwitchArg</a>(<span class="keyword">const</span> std::string& flag, <a name="l00069"></a>00069 <span class="keyword">const</span> std::string& name, <a name="l00070"></a>00070 <span class="keyword">const</span> std::string& desc, <a name="l00071"></a>00071 <span class="keywordtype">bool</span> def = <span class="keyword">false</span>, <a name="l00072"></a>00072 <a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v = NULL); <a name="l00073"></a>00073 <a name="l00074"></a>00074 <a name="l00088"></a>00088 <a class="code" href="classTCLAP_1_1SwitchArg.html#a3895b036fa2d36e4fcfa41dfcdb298c1" title="SwitchArg constructor.">SwitchArg</a>(<span class="keyword">const</span> std::string& flag, <a name="l00089"></a>00089 <span class="keyword">const</span> std::string& name, <a name="l00090"></a>00090 <span class="keyword">const</span> std::string& desc, <a name="l00091"></a>00091 <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>& parser, <a name="l00092"></a>00092 <span class="keywordtype">bool</span> def = <span class="keyword">false</span>, <a name="l00093"></a>00093 <a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v = NULL); <a name="l00094"></a>00094 <a name="l00095"></a>00095 <a name="l00104"></a>00104 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#a624f98df6c4907efec95ffc353e9d08c" title="Handles the processing of the argument.">processArg</a>(<span class="keywordtype">int</span>* i, std::vector<std::string>& args); <a name="l00105"></a>00105 <a name="l00110"></a>00110 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#af5fbd44d462539941b09e960034d692c" title="Checks a string to see if any of the chars in the string match the flag for this...">combinedSwitchesMatch</a>(std::string& combined); <a name="l00111"></a>00111 <a name="l00115"></a>00115 <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#aed1bc8a81a9bda4013cfcf407ccc7716" title="Returns bool, whether or not the switch has been set.">getValue</a>(); <a name="l00116"></a>00116 <a name="l00117"></a>00117 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#af8561d903ec3c11f5f2175e6db179d9c" title="Clears the Arg object and allows it to be reused by new command lines.">reset</a>(); <a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="keyword">private</span>: <a name="l00124"></a>00124 <span class="keywordtype">bool</span> lastCombined(std::string& combined); <a name="l00125"></a>00125 <a name="l00129"></a>00129 <span class="keywordtype">void</span> commonProcessing(); <a name="l00130"></a>00130 }; <a name="l00131"></a>00131 <a name="l00133"></a>00133 <span class="comment">//BEGIN SwitchArg.cpp</span> <a name="l00135"></a><a class="code" href="classTCLAP_1_1SwitchArg.html#a3895b036fa2d36e4fcfa41dfcdb298c1">00135</a> <span class="comment"></span><span class="keyword">inline</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#a3895b036fa2d36e4fcfa41dfcdb298c1" title="SwitchArg constructor.">SwitchArg::SwitchArg</a>(<span class="keyword">const</span> std::string& flag, <a name="l00136"></a>00136 <span class="keyword">const</span> std::string& name, <a name="l00137"></a>00137 <span class="keyword">const</span> std::string& desc, <a name="l00138"></a>00138 <span class="keywordtype">bool</span> default_val, <a name="l00139"></a>00139 <a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v ) <a name="l00140"></a>00140 : <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>(flag, name, desc, false, false, v), <a name="l00141"></a>00141 _value( default_val ), <a name="l00142"></a>00142 _default( default_val ) <a name="l00143"></a>00143 { } <a name="l00144"></a>00144 <a name="l00145"></a><a class="code" href="classTCLAP_1_1SwitchArg.html#af7e9628155772af0686f6a2114dfe78b">00145</a> <span class="keyword">inline</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#a3895b036fa2d36e4fcfa41dfcdb298c1" title="SwitchArg constructor.">SwitchArg::SwitchArg</a>(<span class="keyword">const</span> std::string& flag, <a name="l00146"></a>00146 <span class="keyword">const</span> std::string& name, <a name="l00147"></a>00147 <span class="keyword">const</span> std::string& desc, <a name="l00148"></a>00148 <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>& parser, <a name="l00149"></a>00149 <span class="keywordtype">bool</span> default_val, <a name="l00150"></a>00150 <a class="code" href="classTCLAP_1_1Visitor.html" title="A base class that defines the interface for visitors.">Visitor</a>* v ) <a name="l00151"></a>00151 : <a class="code" href="classTCLAP_1_1Arg.html" title="A virtual base class that defines the essential data for all arguments.">Arg</a>(flag, name, desc, false, false, v), <a name="l00152"></a>00152 _value( default_val ), <a name="l00153"></a>00153 _default(default_val) <a name="l00154"></a>00154 { <a name="l00155"></a>00155 parser.<a class="code" href="classTCLAP_1_1CmdLineInterface.html#a13b29ab754c030185e58f779dc355631" title="Adds an argument to the list of arguments to be parsed.">add</a>( <span class="keyword">this</span> ); <a name="l00156"></a>00156 } <a name="l00157"></a>00157 <a name="l00158"></a><a class="code" href="classTCLAP_1_1SwitchArg.html#aed1bc8a81a9bda4013cfcf407ccc7716">00158</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#aed1bc8a81a9bda4013cfcf407ccc7716" title="Returns bool, whether or not the switch has been set.">SwitchArg::getValue</a>() { <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#a0389ecebecc504d9756703d46e8cf3ca" title="The value of the switch.">_value</a>; } <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="keyword">inline</span> <span class="keywordtype">bool</span> SwitchArg::lastCombined(std::string& combinedSwitches ) <a name="l00161"></a>00161 { <a name="l00162"></a>00162 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 1; i < combinedSwitches.length(); i++ ) <a name="l00163"></a>00163 <span class="keywordflow">if</span> ( combinedSwitches[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="l00164"></a>00164 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a><a class="code" href="classTCLAP_1_1SwitchArg.html#af5fbd44d462539941b09e960034d692c">00169</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#af5fbd44d462539941b09e960034d692c" title="Checks a string to see if any of the chars in the string match the flag for this...">SwitchArg::combinedSwitchesMatch</a>(std::string& combinedSwitches ) <a name="l00170"></a>00170 { <a name="l00171"></a>00171 <span class="comment">// make sure this is actually a combined switch</span> <a name="l00172"></a>00172 <span class="keywordflow">if</span> ( combinedSwitches.length() > 0 && <a name="l00173"></a>00173 combinedSwitches[0] != <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>()[0] ) <a name="l00174"></a>00174 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="comment">// make sure it isn't a long name </span> <a name="l00177"></a>00177 <span class="keywordflow">if</span> ( combinedSwitches.substr( 0, <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>().length() ) == <a name="l00178"></a>00178 <a class="code" href="classTCLAP_1_1Arg.html#a1df2134870528b80f9f35347fef6fd14">Arg::nameStartString</a>() ) <a name="l00179"></a>00179 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00180"></a>00180 <a name="l00181"></a>00181 <span class="comment">// make sure the delimiter isn't in the string </span> <a name="l00182"></a>00182 <span class="keywordflow">if</span> ( combinedSwitches.find_first_of( <a class="code" href="classTCLAP_1_1Arg.html#aadef6ca7e40f5b3d3fd03186976aea7e" title="The delimiter that separates an argument flag/name from the value.">Arg::delimiter</a>() ) != std::string::npos ) <a name="l00183"></a>00183 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00184"></a>00184 <a name="l00185"></a>00185 <span class="comment">// ok, we're not specifying a ValueArg, so we know that we have</span> <a name="l00186"></a>00186 <span class="comment">// a combined switch list. </span> <a name="l00187"></a>00187 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 1; i < combinedSwitches.length(); i++ ) <a name="l00188"></a>00188 <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() > 0 && <a name="l00189"></a>00189 combinedSwitches[i] == <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a>[0] && <a name="l00190"></a>00190 <a class="code" href="classTCLAP_1_1Arg.html#ae68407a0a8223023ad0ae3b9dc7986f5" title="The single char flag used to identify the argument.">_flag</a>[0] != <a class="code" href="classTCLAP_1_1Arg.html#af8e739295b0f75028e7bff6d670d97a1">Arg::flagStartString</a>()[0] ) <a name="l00191"></a>00191 { <a name="l00192"></a>00192 <span class="comment">// update the combined switches so this one is no longer present</span> <a name="l00193"></a>00193 <span class="comment">// this is necessary so that no unlabeled args are matched</span> <a name="l00194"></a>00194 <span class="comment">// later in the processing.</span> <a name="l00195"></a>00195 <span class="comment">//combinedSwitches.erase(i,1);</span> <a name="l00196"></a>00196 combinedSwitches[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="l00197"></a>00197 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00198"></a>00198 } <a name="l00199"></a>00199 <a name="l00200"></a>00200 <span class="comment">// none of the switches passed in the list match. </span> <a name="l00201"></a>00201 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00202"></a>00202 } <a name="l00203"></a>00203 <a name="l00204"></a>00204 <span class="keyword">inline</span> <span class="keywordtype">void</span> SwitchArg::commonProcessing() <a name="l00205"></a>00205 { <a name="l00206"></a>00206 <span class="keywordflow">if</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="l00207"></a>00207 <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>( <a name="l00208"></a>00208 <span class="stringliteral">"Mutually exclusive argument already set!"</span>, <a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2" title="Returns a simple string representation of the argument.">toString</a>())); <a name="l00209"></a>00209 <a name="l00210"></a>00210 <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 name="l00211"></a>00211 <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">"Argument already set!"</span>, <a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2" title="Returns a simple string representation of the argument.">toString</a>())); <a name="l00212"></a>00212 <a name="l00213"></a>00213 <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="l00214"></a>00214 <a name="l00215"></a>00215 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1SwitchArg.html#a0389ecebecc504d9756703d46e8cf3ca" title="The value of the switch.">_value</a> == <span class="keyword">true</span> ) <a name="l00216"></a>00216 <a class="code" href="classTCLAP_1_1SwitchArg.html#a0389ecebecc504d9756703d46e8cf3ca" title="The value of the switch.">_value</a> = <span class="keyword">false</span>; <a name="l00217"></a>00217 <span class="keywordflow">else</span> <a name="l00218"></a>00218 <a class="code" href="classTCLAP_1_1SwitchArg.html#a0389ecebecc504d9756703d46e8cf3ca" title="The value of the switch.">_value</a> = <span class="keyword">true</span>; <a name="l00219"></a>00219 <a name="l00220"></a>00220 <a class="code" href="classTCLAP_1_1Arg.html#aa963d0d4c8cb297e1f4cf74143bf6d1b" title="Performs the special handling described by the Vistitor.">_checkWithVisitor</a>(); <a name="l00221"></a>00221 } <a name="l00222"></a>00222 <a name="l00223"></a><a class="code" href="classTCLAP_1_1SwitchArg.html#a624f98df6c4907efec95ffc353e9d08c">00223</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#a624f98df6c4907efec95ffc353e9d08c" title="Handles the processing of the argument.">SwitchArg::processArg</a>(<span class="keywordtype">int</span> *i, std::vector<std::string>& args) <a name="l00224"></a>00224 { <a name="l00225"></a>00225 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#a9832bb7564f4ab472bd51b7b1bbc683f" title="Whether this argument can be ignored, if desired.">_ignoreable</a> && <a class="code" href="classTCLAP_1_1Arg.html#a4d412155b8f9b4956e64e91c48e55a3b" title="Whether to ignore the rest.">Arg::ignoreRest</a>() ) <a name="l00226"></a>00226 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00227"></a>00227 <a name="l00228"></a>00228 <span class="comment">// if the whole string matches the flag or name string</span> <a name="l00229"></a>00229 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1Arg.html#aac37b1b734b477e5d16f2037dba9c125" title="A method that tests whether a string matches this argument.">argMatches</a>( args[*i] ) ) <a name="l00230"></a>00230 { <a name="l00231"></a>00231 commonProcessing(); <a name="l00232"></a>00232 <a name="l00233"></a>00233 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00234"></a>00234 } <a name="l00235"></a>00235 <span class="comment">// if a substring matches the flag as part of a combination</span> <a name="l00236"></a>00236 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1SwitchArg.html#af5fbd44d462539941b09e960034d692c" title="Checks a string to see if any of the chars in the string match the flag for this...">combinedSwitchesMatch</a>( args[*i] ) ) <a name="l00237"></a>00237 { <a name="l00238"></a>00238 <span class="comment">// check again to ensure we don't misinterpret </span> <a name="l00239"></a>00239 <span class="comment">// this as a MultiSwitchArg </span> <a name="l00240"></a>00240 <span class="keywordflow">if</span> ( <a class="code" href="classTCLAP_1_1SwitchArg.html#af5fbd44d462539941b09e960034d692c" title="Checks a string to see if any of the chars in the string match the flag for this...">combinedSwitchesMatch</a>( args[*i] ) ) <a name="l00241"></a>00241 <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">"Argument already set!"</span>, <a name="l00242"></a>00242 <a class="code" href="classTCLAP_1_1Arg.html#ac98a357568c21f0eb6ca2220b8a3d4a2" title="Returns a simple string representation of the argument.">toString</a>())); <a name="l00243"></a>00243 <a name="l00244"></a>00244 commonProcessing(); <a name="l00245"></a>00245 <a name="l00246"></a>00246 <span class="comment">// We only want to return true if we've found the last combined</span> <a name="l00247"></a>00247 <span class="comment">// match in the string, otherwise we return true so that other </span> <a name="l00248"></a>00248 <span class="comment">// switches in the combination will have a chance to match.</span> <a name="l00249"></a>00249 <span class="keywordflow">return</span> lastCombined( args[*i] ); <a name="l00250"></a>00250 } <a name="l00251"></a>00251 <span class="keywordflow">else</span> <a name="l00252"></a>00252 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00253"></a>00253 } <a name="l00254"></a>00254 <a name="l00255"></a><a class="code" href="classTCLAP_1_1SwitchArg.html#af8561d903ec3c11f5f2175e6db179d9c">00255</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classTCLAP_1_1SwitchArg.html#af8561d903ec3c11f5f2175e6db179d9c" title="Clears the Arg object and allows it to be reused by new command lines.">SwitchArg::reset</a>() <a name="l00256"></a>00256 { <a name="l00257"></a>00257 <a class="code" href="classTCLAP_1_1SwitchArg.html#af8561d903ec3c11f5f2175e6db179d9c" title="Clears the Arg object and allows it to be reused by new command lines.">Arg::reset</a>(); <a name="l00258"></a>00258 <a class="code" href="classTCLAP_1_1SwitchArg.html#a0389ecebecc504d9756703d46e8cf3ca" title="The value of the switch.">_value</a> = <a class="code" href="classTCLAP_1_1SwitchArg.html#ae25a99eb06fc2ee75a3b98edba1d5d8d" title="Used to support the reset() method so that ValueArg can be reset to their constructed...">_default</a>; <a name="l00259"></a>00259 } <a name="l00261"></a>00261 <span class="comment">//End SwitchArg.cpp</span> <a name="l00263"></a>00263 <span class="comment"></span> <a name="l00264"></a>00264 } <span class="comment">//namespace TCLAP</span> <a name="l00265"></a>00265 <a name="l00266"></a>00266 <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 <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/SwitchArg_8h_source.html | |||||
#1 | 16119 | tjuricek | Rename/move to meet workshop project conventions. | ||
//guest/tjuricek/fsclient/vendor/tclap-1.2.1/docs/html/SwitchArg_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. |