<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>cmdoptns.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Thu Oct 4 15:32:57 2001 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>cmdoptns.h</h1><a href="cmdoptns_h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// Copyright (C) 2001 Gianni Mariani</font> 00002 <font class="comment">//</font> 00003 <font class="comment">// This program is free software; you can redistribute it and/or modify</font> 00004 <font class="comment">// it under the terms of the GNU General Public License as published by</font> 00005 <font class="comment">// the Free Software Foundation; either version 2 of the License, or</font> 00006 <font class="comment">// (at your option) any later version.</font> 00007 <font class="comment">//</font> 00008 <font class="comment">// This program is distributed in the hope that it will be useful,</font> 00009 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00010 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00011 <font class="comment">// GNU General Public License for more details.</font> 00012 <font class="comment">//</font> 00013 <font class="comment">// You should have received a copy of the GNU General Public License</font> 00014 <font class="comment">// along with this program; if not, write to the Free Software</font> 00015 <font class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font> 00016 <font class="comment">//</font> 00017 <font class="comment">// As a special exception to the GNU General Public License, permission is</font> 00018 <font class="comment">// granted for additional uses of the text contained in its release</font> 00019 <font class="comment">// of Common C++.</font> 00020 <font class="comment">//</font> 00021 <font class="comment">// The exception is that, if you link the Common C++ library with other</font> 00022 <font class="comment">// files to produce an executable, this does not by itself cause the</font> 00023 <font class="comment">// resulting executable to be covered by the GNU General Public License.</font> 00024 <font class="comment">// Your use of that executable is in no way restricted on account of</font> 00025 <font class="comment">// linking the Common C++ library code into it.</font> 00026 <font class="comment">//</font> 00027 <font class="comment">// This exception does not however invalidate any other reasons why</font> 00028 <font class="comment">// the executable file might be covered by the GNU General Public License.</font> 00029 <font class="comment">//</font> 00030 <font class="comment">// This exception applies only to the code released under the</font> 00031 <font class="comment">// name Common C++. If you copy code from other releases into a copy of</font> 00032 <font class="comment">// Common C++, as the General Public License permits, the exception does</font> 00033 <font class="comment">// not apply to the code that you add in this way. To avoid misleading</font> 00034 <font class="comment">// anyone as to the status of such modified files, you must delete</font> 00035 <font class="comment">// this exception notice from them.</font> 00036 <font class="comment">//</font> 00037 <font class="comment">// If you write modifications of your own for Common C++, it is your choice</font> 00038 <font class="comment">// whether to permit this exception to apply to your modifications.</font> 00039 <font class="comment">// If you do not wish that, delete this exception notice.</font> 00040 <font class="comment">//</font> 00041 00042 <font class="preprocessor">#ifndef __CCXX_CMDOPTNS_H__</font> 00043 <font class="preprocessor"></font><font class="preprocessor">#define __CCXX_CMDOPTNS_H__</font> 00044 <font class="preprocessor"></font> 00045 <font class="preprocessor">#include "<a class="code" href="config_h.html">config.h</a>"</font> 00046 00047 <font class="preprocessor">#ifdef HAVE_GETOPT_LONG</font> 00048 <font class="preprocessor"></font> 00056 <font class="keyword">class </font><a class="code" href="class_commandoption.html">CommandOption</a>; 00057 <font class="keyword">class </font><a class="code" href="class_commandoptionparse.html">CommandOptionParse</a>; 00058 <a name="l00066"></a><a class="code" href="cmdoptns_h.html#a0">00066</a> <font class="keyword">extern</font> <a class="code" href="class_commandoption.html">CommandOption</a> * DefaultCommandOptionList; 00067 <a name="l00078"></a><a class="code" href="class_commandoption.html">00078</a> <font class="keyword">class </font><a class="code" href="class_commandoption.html">CommandOption</a> { 00079 <font class="keyword">public</font>: 00080 <a name="l00085"></a><a class="code" href="class_commandoption.html#m0">00085</a> <font class="keyword">const</font> <font class="keywordtype">char</font> * option_name; 00086 <a name="l00091"></a><a class="code" href="class_commandoption.html#m1">00091</a> <font class="keyword">const</font> <font class="keywordtype">char</font> * option_letter; 00092 <a name="l00098"></a><a class="code" href="class_commandoption.html#m2">00098</a> <font class="keyword">const</font> <font class="keywordtype">char</font> * description; 00099 <a name="l00105"></a><a class="code" href="class_commandoption.html#s4">00105</a> <font class="keyword">enum</font> OptionType { 00109 HasArg, 00113 NoArg, 00117 Trailing, 00121 Collect 00122 }; 00123 <a name="l00127"></a><a class="code" href="class_commandoption.html#m3">00127</a> OptionType option_type; <font class="comment">// HasArg, NoArg or Trailing</font> 00128 <a name="l00133"></a><a class="code" href="class_commandoption.html#m4">00133</a> <font class="keywordtype">bool</font> required; <font class="comment">// Option is required - fail without it</font> 00134 <a name="l00139"></a><a class="code" href="class_commandoption.html#m5">00139</a> <a class="code" href="class_commandoption.html">CommandOption</a> * next; 00140 00144 <font class="keyword">virtual</font> <a class="code" href="class_commandoption.html#a0">~CommandOption</a>(); 00145 00157 <a class="code" href="class_commandoption.html#a1">CommandOption</a>( 00158 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_name, 00159 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_letter, 00160 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_description, 00161 OptionType in_option_type, 00162 <font class="keywordtype">bool</font> in_required = <font class="keyword">false</font>, 00163 <a class="code" href="class_commandoption.html">CommandOption</a> ** pp_next = & DefaultCommandOptionList 00164 ); 00165 00173 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoption.html#a2">FoundOption</a>( <a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> * value = 0 ); 00174 00183 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoption.html#a2">FoundOption</a>( <a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> ** value, <font class="keywordtype">int</font> num ); 00184 00191 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoption.html#a4">ParseDone</a>( <a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> * cop ); 00192 00200 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoption.html#a5">PerformTask</a>( <a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> * cop ); 00201 00208 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="class_commandoption.html#a6">HasValue</a>(); 00209 00210 }; 00211 <a name="l00216"></a><a class="code" href="class_commandoptionwitharg.html">00216</a> <font class="keyword">class </font><a class="code" href="class_commandoptionwitharg.html">CommandOptionWithArg</a> : <font class="keyword">public</font> <a class="code" href="class_commandoption.html">CommandOption</a> { 00217 <font class="keyword">public</font>: 00218 <a name="l00222"></a><a class="code" href="class_commandoptionwitharg.html#m0">00222</a> <font class="keyword">const</font> <font class="keywordtype">char</font> ** values; 00223 <a name="l00227"></a><a class="code" href="class_commandoptionwitharg.html#m1">00227</a> <font class="keywordtype">int</font> numvalue; 00228 00240 <a class="code" href="class_commandoptionwitharg.html#a0">CommandOptionWithArg</a>( 00241 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_name, 00242 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_letter, 00243 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_description, 00244 OptionType in_option_type, 00245 <font class="keywordtype">bool</font> in_required = <font class="keyword">false</font>, 00246 <a class="code" href="class_commandoption.html">CommandOption</a> ** pp_next = & DefaultCommandOptionList 00247 ); 00248 00249 <font class="keyword">virtual</font> <a class="code" href="class_commandoptionwitharg.html#a1">~CommandOptionWithArg</a>(); 00250 00251 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoption.html#a2">FoundOption</a>( <a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> * value = 0 ); 00252 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoption.html#a2">FoundOption</a>( <a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> ** value, <font class="keywordtype">int</font> num ); 00253 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="class_commandoption.html#a6">HasValue</a>(); 00254 }; 00255 <a name="l00259"></a><a class="code" href="class_commandoptionarg.html">00259</a> <font class="keyword">class </font><a class="code" href="class_commandoptionarg.html">CommandOptionArg</a> : <font class="keyword">public</font> <a class="code" href="class_commandoptionwitharg.html">CommandOptionWithArg</a> { 00260 <font class="keyword">public</font>: 00261 00272 <a class="code" href="class_commandoptionarg.html#a0">CommandOptionArg</a>( 00273 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_name, 00274 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_letter, 00275 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_description, 00276 <font class="keywordtype">bool</font> in_required = <font class="keyword">false</font>, 00277 <a class="code" href="class_commandoption.html">CommandOption</a> ** pp_next = & DefaultCommandOptionList 00278 ); 00279 00280 <font class="keyword">virtual</font> <a class="code" href="class_commandoptionarg.html#a1">~CommandOptionArg</a>(); 00281 00282 00283 }; 00284 <a name="l00294"></a><a class="code" href="class_commandoptionrest.html">00294</a> <font class="keyword">class </font><a class="code" href="class_commandoptionrest.html">CommandOptionRest</a> : <font class="keyword">public</font> <a class="code" href="class_commandoptionwitharg.html">CommandOptionWithArg</a> { 00295 <font class="keyword">public</font>: 00296 00307 <a class="code" href="class_commandoptionrest.html#a0">CommandOptionRest</a>( 00308 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_name, 00309 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_letter, 00310 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_description, 00311 <font class="keywordtype">bool</font> in_required = <font class="keyword">false</font>, 00312 <a class="code" href="class_commandoption.html">CommandOption</a> ** pp_next = & DefaultCommandOptionList 00313 ); 00314 00315 }; 00316 <a name="l00324"></a><a class="code" href="class_commandoptioncollect.html">00324</a> <font class="keyword">class </font><a class="code" href="class_commandoptioncollect.html">CommandOptionCollect</a> : <font class="keyword">public</font> <a class="code" href="class_commandoptionwitharg.html">CommandOptionWithArg</a> { 00325 <font class="keyword">public</font>: 00326 00337 <a class="code" href="class_commandoptioncollect.html#a0">CommandOptionCollect</a>( 00338 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_name, 00339 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_letter, 00340 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_description, 00341 <font class="keywordtype">bool</font> in_required = <font class="keyword">false</font>, 00342 <a class="code" href="class_commandoption.html">CommandOption</a> ** pp_next = & DefaultCommandOptionList 00343 ); 00344 00345 }; 00346 <a name="l00350"></a><a class="code" href="class_commandoptionnoarg.html">00350</a> <font class="keyword">class </font><a class="code" href="class_commandoptionnoarg.html">CommandOptionNoArg</a> : <font class="keyword">public</font> <a class="code" href="class_commandoption.html">CommandOption</a> { 00351 <font class="keyword">public</font>: 00352 <a name="l00356"></a><a class="code" href="class_commandoptionnoarg.html#m0">00356</a> <font class="keywordtype">int</font> numset; <font class="comment">// The number of times this argument is set</font> 00357 00368 <a class="code" href="class_commandoptionnoarg.html#a0">CommandOptionNoArg</a>( 00369 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_name, 00370 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_option_letter, 00371 <font class="keyword">const</font> <font class="keywordtype">char</font> * in_description, 00372 <font class="keywordtype">bool</font> in_required = <font class="keyword">false</font>, 00373 <a class="code" href="class_commandoption.html">CommandOption</a> ** pp_next = & DefaultCommandOptionList 00374 ); 00375 00379 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoption.html#a2">FoundOption</a>( <a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> * value = 0 ); 00380 00381 }; 00382 <a name="l00392"></a><a class="code" href="class_commandoptionparse.html">00392</a> <font class="keyword">class </font><a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> { 00393 <font class="keyword">public</font>: 00394 00398 <font class="keyword">virtual</font> <a class="code" href="class_commandoptionparse.html#a0">~CommandOptionParse</a>() = 0; 00399 00403 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="class_commandoptionparse.html#a1">ArgsHaveError</a>() = 0; 00404 00408 <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="class_commandoptionparse.html#a2">PrintErrors</a>() = 0; 00409 00413 <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="class_commandoptionparse.html#a3">PrintUsage</a>() = 0; 00414 00419 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoptionparse.html#a4">RegisterError</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> * err_msg ) = 0; 00420 00425 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_commandoption.html#a5">PerformTask</a>() = 0; 00426 00427 }; 00428 00437 <a class="code" href="class_commandoptionparse.html">CommandOptionParse</a> * <a class="code" href="cmdoptns_h.html#a1">MakeCommandOptionParse</a>( 00438 <font class="keywordtype">int</font> argc, 00439 <font class="keywordtype">char</font> ** argv, 00440 <font class="keywordtype">char</font> * comment, 00441 <a class="code" href="class_commandoption.html">CommandOption</a> * options = DefaultCommandOptionList 00442 ); 00443 00444 00445 <font class="preprocessor">#endif</font> 00446 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00447 <font class="preprocessor"></font> </div></pre><hr><address><small>Generated at Thu Oct 4 15:32:57 2001 for CommonC++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.5 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>