summaryrefslogtreecommitdiff
path: root/tclap-1.2.1/docs/html/ValuesConstraint_8h_source.html
diff options
context:
space:
mode:
Diffstat (limited to 'tclap-1.2.1/docs/html/ValuesConstraint_8h_source.html')
-rw-r--r--tclap-1.2.1/docs/html/ValuesConstraint_8h_source.html151
1 files changed, 151 insertions, 0 deletions
diff --git a/tclap-1.2.1/docs/html/ValuesConstraint_8h_source.html b/tclap-1.2.1/docs/html/ValuesConstraint_8h_source.html
new file mode 100644
index 0000000..eaad1f5
--- /dev/null
+++ b/tclap-1.2.1/docs/html/ValuesConstraint_8h_source.html
@@ -0,0 +1,151 @@
+<!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: ValuesConstraint.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>ValuesConstraint.h</h1><a href="ValuesConstraint_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
+<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: ValuesConstraint.h</span>
+<a name="l00006"></a>00006 <span class="comment"> * </span>
+<a name="l00007"></a>00007 <span class="comment"> * Copyright (c) 2005, Michael E. Smoot</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 <span class="preprocessor">#ifndef TCLAP_VALUESCONSTRAINT_H</span>
+<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define TCLAP_VALUESCONSTRAINT_H</span>
+<a name="l00025"></a>00025 <span class="preprocessor"></span>
+<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;string&gt;</span>
+<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;vector&gt;</span>
+<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;<a class="code" href="Constraint_8h.html">tclap/Constraint.h</a>&gt;</span>
+<a name="l00029"></a>00029
+<a name="l00030"></a>00030 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#include &lt;config.h&gt;</span>
+<a name="l00032"></a>00032 <span class="preprocessor">#else</span>
+<a name="l00033"></a><a class="code" href="ValuesConstraint_8h.html#a91e904e6e4f21f803c49113b934e6966">00033</a> <span class="preprocessor"></span><span class="preprocessor">#define HAVE_SSTREAM</span>
+<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+<a name="l00035"></a>00035 <span class="preprocessor"></span>
+<a name="l00036"></a>00036 <span class="preprocessor">#if defined(HAVE_SSTREAM)</span>
+<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sstream&gt;</span>
+<a name="l00038"></a>00038 <span class="preprocessor">#elif defined(HAVE_STRSTREAM)</span>
+<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#include &lt;strstream&gt;</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#else</span>
+<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#error &quot;Need a stringstream (sstream or strstream) to compile!&quot;</span>
+<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+<a name="l00043"></a>00043 <span class="preprocessor"></span>
+<a name="l00044"></a>00044 <span class="keyword">namespace </span>TCLAP {
+<a name="l00045"></a>00045
+<a name="l00050"></a>00050 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
+<a name="l00051"></a><a class="code" href="classTCLAP_1_1ValuesConstraint.html">00051</a> <span class="keyword">class </span><a class="code" href="classTCLAP_1_1ValuesConstraint.html" title="A Constraint that constrains the Arg to only those values specified in the constraint...">ValuesConstraint</a> : <span class="keyword">public</span> <a class="code" href="classTCLAP_1_1Constraint.html" title="The interface that defines the interaction between the Arg and Constraint.">Constraint</a>&lt;T&gt;
+<a name="l00052"></a>00052 {
+<a name="l00053"></a>00053
+<a name="l00054"></a>00054 <span class="keyword">public</span>:
+<a name="l00055"></a>00055
+<a name="l00060"></a>00060 <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a8ab127461012bb1dcfac159e17105db9" title="Constructor.">ValuesConstraint</a>(std::vector&lt;T&gt;&amp; allowed);
+<a name="l00061"></a>00061
+<a name="l00065"></a><a class="code" href="classTCLAP_1_1ValuesConstraint.html#a9b0c218300a9e0937386f2e566ba21bd">00065</a> <span class="keyword">virtual</span> <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a9b0c218300a9e0937386f2e566ba21bd" title="Virtual destructor.">~ValuesConstraint</a>() {}
+<a name="l00066"></a>00066
+<a name="l00070"></a>00070 <span class="keyword">virtual</span> std::string <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a07b08c05a7bfcbe5815895353ffef1d5" title="Returns a description of the Constraint.">description</a>() <span class="keyword">const</span>;
+<a name="l00071"></a>00071
+<a name="l00075"></a>00075 <span class="keyword">virtual</span> std::string <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a1bbe12afcb1f185ee7ac808d69e2d345" title="Returns the short ID for the Constraint.">shortID</a>() <span class="keyword">const</span>;
+<a name="l00076"></a>00076
+<a name="l00082"></a>00082 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1ValuesConstraint.html#ae132b185413cf5dea5cc040f60e7ede6" title="The method used to verify that the value parsed from the command line meets the constraint...">check</a>(<span class="keyword">const</span> T&amp; value) <span class="keyword">const</span>;
+<a name="l00083"></a>00083
+<a name="l00084"></a>00084 <span class="keyword">protected</span>:
+<a name="l00085"></a>00085
+<a name="l00089"></a><a class="code" href="classTCLAP_1_1ValuesConstraint.html#ac43fa83688358c0ad06157053cce347a">00089</a> std::vector&lt;T&gt; <a class="code" href="classTCLAP_1_1ValuesConstraint.html#ac43fa83688358c0ad06157053cce347a" title="The list of valid values.">_allowed</a>;
+<a name="l00090"></a>00090
+<a name="l00094"></a><a class="code" href="classTCLAP_1_1ValuesConstraint.html#a6ebc63fa5eea116a50aa5f76aee56fd6">00094</a> std::string <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a6ebc63fa5eea116a50aa5f76aee56fd6" title="The string used to describe the allowed values of this constraint.">_typeDesc</a>;
+<a name="l00095"></a>00095
+<a name="l00096"></a>00096 };
+<a name="l00097"></a>00097
+<a name="l00098"></a>00098 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
+<a name="l00099"></a><a class="code" href="classTCLAP_1_1ValuesConstraint.html#a8ab127461012bb1dcfac159e17105db9">00099</a> <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a8ab127461012bb1dcfac159e17105db9" title="Constructor.">ValuesConstraint&lt;T&gt;::ValuesConstraint</a>(std::vector&lt;T&gt;&amp; allowed)
+<a name="l00100"></a>00100 : _allowed(allowed),
+<a name="l00101"></a>00101 _typeDesc(<span class="stringliteral">&quot;&quot;</span>)
+<a name="l00102"></a>00102 {
+<a name="l00103"></a>00103 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classTCLAP_1_1ValuesConstraint.html#ac43fa83688358c0ad06157053cce347a" title="The list of valid values.">_allowed</a>.size(); i++ )
+<a name="l00104"></a>00104 {
+<a name="l00105"></a>00105
+<a name="l00106"></a>00106 <span class="preprocessor">#if defined(HAVE_SSTREAM)</span>
+<a name="l00107"></a>00107 <span class="preprocessor"></span> std::ostringstream os;
+<a name="l00108"></a>00108 <span class="preprocessor">#elif defined(HAVE_STRSTREAM)</span>
+<a name="l00109"></a>00109 <span class="preprocessor"></span> std::ostrstream os;
+<a name="l00110"></a>00110 <span class="preprocessor">#else</span>
+<a name="l00111"></a>00111 <span class="preprocessor"></span><span class="preprocessor">#error &quot;Need a stringstream (sstream or strstream) to compile!&quot;</span>
+<a name="l00112"></a>00112 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+<a name="l00113"></a>00113 <span class="preprocessor"></span>
+<a name="l00114"></a>00114 os &lt;&lt; <a class="code" href="classTCLAP_1_1ValuesConstraint.html#ac43fa83688358c0ad06157053cce347a" title="The list of valid values.">_allowed</a>[i];
+<a name="l00115"></a>00115
+<a name="l00116"></a>00116 std::string temp( os.str() );
+<a name="l00117"></a>00117
+<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( i &gt; 0 )
+<a name="l00119"></a>00119 <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a6ebc63fa5eea116a50aa5f76aee56fd6" title="The string used to describe the allowed values of this constraint.">_typeDesc</a> += <span class="stringliteral">&quot;|&quot;</span>;
+<a name="l00120"></a>00120 <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a6ebc63fa5eea116a50aa5f76aee56fd6" title="The string used to describe the allowed values of this constraint.">_typeDesc</a> += temp;
+<a name="l00121"></a>00121 }
+<a name="l00122"></a>00122 }
+<a name="l00123"></a>00123
+<a name="l00124"></a>00124 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
+<a name="l00125"></a><a class="code" href="classTCLAP_1_1ValuesConstraint.html#ae132b185413cf5dea5cc040f60e7ede6">00125</a> <span class="keywordtype">bool</span> <a class="code" href="classTCLAP_1_1ValuesConstraint.html#ae132b185413cf5dea5cc040f60e7ede6" title="The method used to verify that the value parsed from the command line meets the constraint...">ValuesConstraint&lt;T&gt;::check</a>( <span class="keyword">const</span> T&amp; val )<span class="keyword"> const</span>
+<a name="l00126"></a>00126 <span class="keyword"></span>{
+<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( std::find(<a class="code" href="classTCLAP_1_1ValuesConstraint.html#ac43fa83688358c0ad06157053cce347a" title="The list of valid values.">_allowed</a>.begin(),<a class="code" href="classTCLAP_1_1ValuesConstraint.html#ac43fa83688358c0ad06157053cce347a" title="The list of valid values.">_allowed</a>.end(),val) == <a class="code" href="classTCLAP_1_1ValuesConstraint.html#ac43fa83688358c0ad06157053cce347a" title="The list of valid values.">_allowed</a>.end() )
+<a name="l00128"></a>00128 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+<a name="l00129"></a>00129 <span class="keywordflow">else</span>
+<a name="l00130"></a>00130 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+<a name="l00131"></a>00131 }
+<a name="l00132"></a>00132
+<a name="l00133"></a>00133 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
+<a name="l00134"></a><a class="code" href="classTCLAP_1_1ValuesConstraint.html#a1bbe12afcb1f185ee7ac808d69e2d345">00134</a> std::string <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a1bbe12afcb1f185ee7ac808d69e2d345" title="Returns the short ID for the Constraint.">ValuesConstraint&lt;T&gt;::shortID</a>()<span class="keyword"> const</span>
+<a name="l00135"></a>00135 <span class="keyword"></span>{
+<a name="l00136"></a>00136 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a6ebc63fa5eea116a50aa5f76aee56fd6" title="The string used to describe the allowed values of this constraint.">_typeDesc</a>;
+<a name="l00137"></a>00137 }
+<a name="l00138"></a>00138
+<a name="l00139"></a>00139 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
+<a name="l00140"></a><a class="code" href="classTCLAP_1_1ValuesConstraint.html#a07b08c05a7bfcbe5815895353ffef1d5">00140</a> std::string <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a07b08c05a7bfcbe5815895353ffef1d5" title="Returns a description of the Constraint.">ValuesConstraint&lt;T&gt;::description</a>()<span class="keyword"> const</span>
+<a name="l00141"></a>00141 <span class="keyword"></span>{
+<a name="l00142"></a>00142 <span class="keywordflow">return</span> <a class="code" href="classTCLAP_1_1ValuesConstraint.html#a6ebc63fa5eea116a50aa5f76aee56fd6" title="The string used to describe the allowed values of this constraint.">_typeDesc</a>;
+<a name="l00143"></a>00143 }
+<a name="l00144"></a>00144
+<a name="l00145"></a>00145
+<a name="l00146"></a>00146 } <span class="comment">//namespace TCLAP</span>
+<a name="l00147"></a>00147 <span class="preprocessor">#endif </span>
+<a name="l00148"></a>00148 <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&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>