Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a964702347d726c5f8ba742f8b9d5908 > files > 14

incron-0.5.9-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>incron: appargs.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</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>
<h1>appargs.h</h1><a href="appargs_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00003"></a>00003 
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef APPARGS_H_</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define APPARGS_H_</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;cstring&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;map&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;deque&gt;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 
<a name="l00033"></a><a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a7915">00033</a> <span class="keyword">typedef</span> <span class="keyword">enum</span>
<a name="l00034"></a>00034 {
<a name="l00035"></a><a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a79151c31909a2b0bc9adb3f629dd23708283">00035</a>   <a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a79151c31909a2b0bc9adb3f629dd23708283" title="no value needed">AAT_NO_VALUE</a>,       
<a name="l00036"></a><a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a7915e9375c7b4472dee83cc87409620716fb">00036</a>   <a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a7915e9375c7b4472dee83cc87409620716fb" title="optional value">AAT_OPTIONAL_VALUE</a>, 
<a name="l00037"></a><a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a7915ade55a552973ac01419c6b768ad98436">00037</a>   <a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a7915ade55a552973ac01419c6b768ad98436" title="mandatory value">AAT_MANDATORY_VALUE</a> 
<a name="l00038"></a>00038 } <a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a7915" title="Option argument type.">AppArgType_t</a>;
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="appargs_8h.html#e17492b30f7d6cb4900a8fba81385f88">00041</a> <span class="preprocessor">#define APPARGS_NOLIMIT 0x7fffffff </span>
<a name="l00042"></a>00042 <span class="preprocessor"></span>
<a name="l00044"></a><a class="code" href="structAppArgOption__t.html">00044</a> <span class="preprocessor">typedef struct</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>{
<a name="l00046"></a><a class="code" href="structAppArgOption__t.html#dac46478f6aa74c770dbac7f8662b825">00046</a>   <a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a7915" title="Option argument type.">AppArgType_t</a> type;  
<a name="l00047"></a><a class="code" href="structAppArgOption__t.html#d7aa21e64ba053701e84bf08b1f16234">00047</a>   <span class="keywordtype">bool</span> mand;          
<a name="l00048"></a><a class="code" href="structAppArgOption__t.html#5f68151ff4fb08e8dbb2ed35168808a7">00048</a>   <span class="keywordtype">bool</span> found;         
<a name="l00049"></a><a class="code" href="structAppArgOption__t.html#a66e5d7dd5f1696cd66bd7149293dde8">00049</a>   std::string val;    
<a name="l00050"></a><a class="code" href="structAppArgOption__t.html#0c92cda0cdbb11e6c3cb14560628aac2">00050</a>   <span class="keywordtype">bool</span> hasVal;        
<a name="l00051"></a>00051 } <a class="code" href="structAppArgOption__t.html" title="Argument option type.">AppArgOption_t</a>;
<a name="l00052"></a>00052 
<a name="l00053"></a>00053 
<a name="l00055"></a><a class="code" href="appargs_8h.html#a051ebe9550c766490a595e2946a1ee7">00055</a> <span class="keyword">typedef</span> std::map&lt;std::string, AppArgOption_t*&gt; <a class="code" href="appargs_8h.html#a051ebe9550c766490a595e2946a1ee7" title="Mapping from long option name to option data.">AA_LONG_MAP</a>;
<a name="l00056"></a>00056 
<a name="l00058"></a><a class="code" href="appargs_8h.html#3a520fd6ca0fc05ca5789e3a5c879ad6">00058</a> <span class="keyword">typedef</span> std::map&lt;char, AppArgOption_t*&gt; <a class="code" href="appargs_8h.html#3a520fd6ca0fc05ca5789e3a5c879ad6" title="Mapping from short option name to option data.">AA_SHORT_MAP</a>;
<a name="l00059"></a>00059 
<a name="l00061"></a><a class="code" href="appargs_8h.html#7214da6cf795c2b9a22a763997d674f0">00061</a> <span class="keyword">typedef</span> std::deque&lt;std::string&gt; <a class="code" href="appargs_8h.html#7214da6cf795c2b9a22a763997d674f0" title="Value list type.">AA_VAL_LIST</a>;
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 
<a name="l00065"></a>00065 
<a name="l00088"></a><a class="code" href="classAppArgs.html">00088</a> <span class="keyword">class </span><a class="code" href="classAppArgs.html" title="Application arguments.">AppArgs</a>
<a name="l00089"></a>00089 {
<a name="l00090"></a>00090 <span class="keyword">public</span>:
<a name="l00092"></a>00092 
<a name="l00096"></a>00096   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classAppArgs.html#5365bfc9a54a0318166cbb003f905dc0" title="Initializes the processor.">Init</a>(<span class="keywordtype">size_t</span> valMinCnt = 0, <span class="keywordtype">size_t</span> valMaxCnt = <a class="code" href="appargs_8h.html#e17492b30f7d6cb4900a8fba81385f88" title="value count has no limit">APPARGS_NOLIMIT</a>);
<a name="l00097"></a>00097 
<a name="l00099"></a>00099 
<a name="l00103"></a>00103   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classAppArgs.html#42655a3eff85509c7f2ce1fcba0b1f31" title="Releases resources allocated by the processor.">Destroy</a>();
<a name="l00104"></a>00104 
<a name="l00106"></a>00106 
<a name="l00112"></a>00112   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classAppArgs.html#0f2ab8497fa8c6aaf7b9faf0c75dbcff" title="Parses arguments and builds the appropriate structure.">Parse</a>(<span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span>* argv);
<a name="l00113"></a>00113   
<a name="l00115"></a>00115 
<a name="l00124"></a>00124   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classAppArgs.html#a4a29548cfffac89df731267b79d1d49" title="Checks whether the arguments have valid form.">IsValid</a>();
<a name="l00125"></a>00125   
<a name="l00127"></a>00127 
<a name="l00131"></a>00131   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classAppArgs.html#f3336e77fc109c12def19406787d7126" title="Checks whether an option exists.">ExistsOption</a>(<span class="keyword">const</span> std::string&amp; rArg);
<a name="l00132"></a>00132   
<a name="l00134"></a>00134 
<a name="l00139"></a>00139   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classAppArgs.html#274f64c50b8cbbe3094dde621ef3b11d" title="Extracts an option value.">GetOption</a>(<span class="keyword">const</span> std::string&amp; rArg, std::string&amp; rVal);
<a name="l00140"></a>00140 
<a name="l00142"></a>00142 
<a name="l00153"></a>00153   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classAppArgs.html#b19a36ff2e25a416415309b8224bbab1" title="Adds an option.">AddOption</a>(<span class="keyword">const</span> std::string&amp; rName, <span class="keywordtype">char</span> cShort, <a class="code" href="appargs_8h.html#5704dc04528b6c626472cea01c9a7915" title="Option argument type.">AppArgType_t</a> type, <span class="keywordtype">bool</span> fMandatory);
<a name="l00154"></a>00154   
<a name="l00156"></a>00156 
<a name="l00159"></a>00159   <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="classAppArgs.html#4d6e538d8c08bbecc2a3c8dfab75cde7" title="Returns the count of values.">GetValueCount</a>();
<a name="l00160"></a>00160   
<a name="l00162"></a>00162 
<a name="l00167"></a>00167   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classAppArgs.html#050217dd528c4d6c30dc559ba19bbe3d" title="Extracts a value.">GetValue</a>(<span class="keywordtype">size_t</span> index, std::string&amp; rVal);
<a name="l00168"></a>00168   
<a name="l00170"></a>00170 
<a name="l00173"></a>00173   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classAppArgs.html#00d5d4d822c8c1bc792313b51eeeec44" title="Dumps information about options and value to STDERR.">Dump</a>();  
<a name="l00174"></a>00174   
<a name="l00175"></a>00175 <span class="keyword">protected</span>:
<a name="l00177"></a>00177 
<a name="l00181"></a>00181   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classAppArgs.html#2471f11b0d74e3a427f1d9c02c9d6494" title="Checks whether a string is an option.">IsOption</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* pchStr);
<a name="l00182"></a>00182   
<a name="l00184"></a>00184 
<a name="l00191"></a>00191   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classAppArgs.html#7058134b8e90e9ee7ee9c23d98a03708" title="Checks whether a string is a long option.">IsLongOption</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* pchStr);
<a name="l00192"></a>00192   
<a name="l00194"></a>00194 
<a name="l00201"></a>00201   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classAppArgs.html#1b3384fa201fb04948776c4e79cf633c" title="Parses a string and attempts to treat it as a long option.">ParseLong</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* pchStr, std::string&amp; rName, std::string&amp; rVal, <span class="keywordtype">bool</span>&amp; rfHasVal);
<a name="l00202"></a>00202   
<a name="l00204"></a>00204 
<a name="l00212"></a>00212   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classAppArgs.html#9d503ca65c0025cf6d04a00cb2e8b12e" title="Parses a string and attempts to treat it as a short option.">ParseShort</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* pchStr, <span class="keywordtype">char</span>&amp; rcName, std::string&amp; rVal, <span class="keywordtype">bool</span>&amp; rfHasVal);
<a name="l00213"></a>00213 
<a name="l00215"></a>00215 
<a name="l00220"></a>00220   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classAppArgs.html#ee73398d0548dd1aaeb1eee8c959a3a5" title="Dumps an option to STDERR.">DumpOption</a>(<span class="keyword">const</span> std::string&amp; rName, <span class="keywordtype">char</span> cShort, <a class="code" href="structAppArgOption__t.html" title="Argument option type.">AppArgOption_t</a>* pOpt);
<a name="l00221"></a>00221   
<a name="l00222"></a>00222   
<a name="l00223"></a>00223 <span class="keyword">private</span>:
<a name="l00224"></a>00224   <span class="keyword">static</span> <span class="keywordtype">size_t</span> s_minCnt;         
<a name="l00225"></a>00225   <span class="keyword">static</span> <span class="keywordtype">size_t</span> s_maxCnt;         
<a name="l00226"></a>00226 
<a name="l00227"></a>00227   <span class="keyword">static</span> <a class="code" href="appargs_8h.html#a051ebe9550c766490a595e2946a1ee7" title="Mapping from long option name to option data.">AA_LONG_MAP</a> s_longMap;   
<a name="l00228"></a>00228   <span class="keyword">static</span> <a class="code" href="appargs_8h.html#3a520fd6ca0fc05ca5789e3a5c879ad6" title="Mapping from short option name to option data.">AA_SHORT_MAP</a> s_shortMap; 
<a name="l00229"></a>00229   <span class="keyword">static</span> <a class="code" href="appargs_8h.html#7214da6cf795c2b9a22a763997d674f0" title="Value list type.">AA_VAL_LIST</a> s_valList;   
<a name="l00230"></a>00230   
<a name="l00231"></a>00231 };
<a name="l00232"></a>00232 
<a name="l00233"></a>00233 
<a name="l00234"></a>00234 <span class="preprocessor">#endif </span><span class="comment">/*APPARGS_H_*/</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jun 21 22:27:24 2009 for incron by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>