1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <!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/xhtml;charset=UTF-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=9"/>
- <meta name="generator" content="Doxygen 1.8.13"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>TTTT Analysis: /home/caleb/Sources/TTTT/filval/argparse.hpp Source File</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="dynsections.js"></script>
- <link href="search/search.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="search/searchdata.js"></script>
- <script type="text/javascript" src="search/search.js"></script>
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
- <div id="titlearea">
- <table cellspacing="0" cellpadding="0">
- <tbody>
- <tr style="height: 56px;">
- <td id="projectalign" style="padding-left: 0.5em;">
- <div id="projectname">TTTT Analysis
-  <span id="projectnumber">0.1</span>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.13 -->
- <script type="text/javascript">
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- </script>
- <script type="text/javascript" src="menudata.js"></script>
- <script type="text/javascript" src="menu.js"></script>
- <script type="text/javascript">
- $(function() {
- initMenu('',true,false,'search.php','Search');
- $(document).ready(function() { init_search(); });
- });
- </script>
- <div id="main-nav"></div>
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- </div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <iframe src="javascript:void(0)" frameborder="0"
- name="MSearchResults" id="MSearchResults">
- </iframe>
- </div>
- <div id="nav-path" class="navpath">
- <ul>
- <li class="navelem"><a class="el" href="dir_b2e1228fdb7fe80fc606210a4045f658.html">filval</a></li> </ul>
- </div>
- </div><!-- top -->
- <div class="header">
- <div class="headertitle">
- <div class="title">argparse.hpp</div> </div>
- </div><!--header-->
- <div class="contents">
- <a href="argparse_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> </div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#ifndef argparse_hpp</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#define argparse_hpp</span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#include <algorithm></span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="preprocessor">#include <string></span></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="preprocessor">#include <vector></span></div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="keyword">namespace </span><a class="code" href="namespacefv_1_1util.html">fv::util</a>{</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="keyword">class </span>ArgParser{</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  std::vector <std::string> tokens;</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  std::string empty_string;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  ArgParser (<span class="keywordtype">int</span> &argc, <span class="keywordtype">char</span> **argv){</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=1; i < argc; ++i)</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  this->tokens.push_back(std::string(argv[i]));</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  }</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keyword">const</span> std::string& getCmdOption(<span class="keyword">const</span> std::string &option)<span class="keyword"> const</span>{</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  std::vector<std::string>::const_iterator itr;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  itr = std::find(this->tokens.begin(), this->tokens.end(), option);</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="keywordflow">if</span> (itr != this->tokens.end() && ++itr != this->tokens.end()){</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordflow">return</span> *itr;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  }</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">return</span> empty_string;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  }</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordtype">bool</span> cmdOptionExists(<span class="keyword">const</span> std::string &option)<span class="keyword"> const</span>{</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">return</span> std::find(this->tokens.begin(), this->tokens.end(), option)</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  != this->tokens.end();</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  }</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span> };</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> }</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="preprocessor">#endif // argparse_hpp</span></div><div class="ttc" id="namespacefv_1_1util_html"><div class="ttname"><a href="namespacefv_1_1util.html">fv::util</a></div><div class="ttdef"><b>Definition:</b> <a href="argparse_8hpp_source.html#l00039">argparse.hpp:39</a></div></div>
- </div><!-- fragment --></div><!-- contents -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.13
- </small></address>
- </body>
- </html>
|