Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 68d373e54fb21da3730c08bede406633 > files > 743

libCommonC++1.9_3-devel-1.9.4-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><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.10 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>cmdoptns.h</h1><a href="cmdoptns_8h.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">#ifndef CCXX_CONFIG_H_</font>
00046 <font class="preprocessor"></font><font class="preprocessor">#include &lt;cc++/config.h&gt;</font>
00047 <font class="preprocessor">#endif</font>
00048 <font class="preprocessor"></font>
00049 <font class="preprocessor">#ifdef  CCXX_NAMESPACES</font>
<a name="l00050"></a><a class="code" href="namespaceost.html">00050</a> <font class="preprocessor"></font><font class="keyword">namespace </font>ost {
00051 <font class="preprocessor">#endif</font>
00052 <font class="preprocessor"></font>
00053 <font class="preprocessor">#ifdef HAVE_GETOPT_LONG</font>
00054 <font class="preprocessor"></font>
00062 <font class="keyword">class </font>CommandOption;
00063 <font class="keyword">class </font>CommandOptionParse;
00064 
<a name="l00072"></a><a class="code" href="namespaceost.html#a0">00072</a> <font class="keyword">extern</font> CommandOption * DefaultCommandOptionList;
00073 
<a name="l00084"></a><a class="code" href="classost_1_1_command_option.html">00084</a> <font class="keyword">class </font>CommandOption {
00085 <font class="keyword">public</font>:
00086 
<a name="l00091"></a><a class="code" href="classost_1_1_command_option.html#m0">00091</a>         <font class="keyword">const</font> <font class="keywordtype">char</font>      * option_name;
00092         
<a name="l00097"></a><a class="code" href="classost_1_1_command_option.html#m1">00097</a>         <font class="keyword">const</font> <font class="keywordtype">char</font>      * option_letter;
00098 
<a name="l00104"></a><a class="code" href="classost_1_1_command_option.html#m2">00104</a>         <font class="keyword">const</font> <font class="keywordtype">char</font>      * description;
00105 
<a name="l00111"></a><a class="code" href="classost_1_1_command_option.html#s4">00111</a>         <font class="keyword">enum</font> OptionType {
00115                 HasArg,
00119                 NoArg,
00123                 Trailing,
00127                 Collect
00128         };
00129 
<a name="l00133"></a><a class="code" href="classost_1_1_command_option.html#m3">00133</a>         OptionType        option_type;  <font class="comment">// HasArg, NoArg or Trailing</font>
00134 
<a name="l00139"></a><a class="code" href="classost_1_1_command_option.html#m4">00139</a>         <font class="keywordtype">bool</font>              required;             <font class="comment">// Option is required - fail without it</font>
00140 
<a name="l00145"></a><a class="code" href="classost_1_1_command_option.html#m5">00145</a>         CommandOption   * next;
00146                 
00150         <font class="keyword">virtual</font> <a class="code" href="classost_1_1_command_option.html#a0">~CommandOption</a>();
00151 
00163         <a class="code" href="classost_1_1_command_option.html#a1">CommandOption</a>(
00164                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_name,
00165                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_letter,
00166                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_description,
00167                 OptionType                in_option_type,
00168                 <font class="keywordtype">bool</font>                      in_required = <font class="keyword">false</font>,
00169                 CommandOption  ** pp_next = &amp; DefaultCommandOptionList
00170         );
00171 
00179         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option.html#a2">FoundOption</a>( CommandOptionParse * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> * value = 0 );
00180         
00189         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option.html#a2">FoundOption</a>( CommandOptionParse * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> ** value, <font class="keywordtype">int</font> num );
00190         
00197         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option.html#a4">ParseDone</a>( CommandOptionParse * cop );
00198         
00206         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option.html#a5">PerformTask</a>( CommandOptionParse * cop );
00207 
00214         <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="classost_1_1_command_option.html#a6">HasValue</a>();
00215         
00216 };
00217 
<a name="l00222"></a><a class="code" href="classost_1_1_command_option_with_arg.html">00222</a> <font class="keyword">class </font>CommandOptionWithArg : <font class="keyword">public</font> CommandOption {
00223 <font class="keyword">public</font>:
00224 
<a name="l00228"></a><a class="code" href="classost_1_1_command_option_with_arg.html#m0">00228</a>         <font class="keyword">const</font> <font class="keywordtype">char</font> ** values;
00229 
<a name="l00233"></a><a class="code" href="classost_1_1_command_option_with_arg.html#m1">00233</a>         <font class="keywordtype">int</font>                       numvalue;
00234 
00246         <a class="code" href="classost_1_1_command_option_with_arg.html#a0">CommandOptionWithArg</a>(
00247                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_name,
00248                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_letter,
00249                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_description,
00250                 OptionType                in_option_type,
00251                 <font class="keywordtype">bool</font>                      in_required = <font class="keyword">false</font>,
00252                 CommandOption  ** pp_next = &amp; DefaultCommandOptionList
00253         );
00254 
00255         <font class="keyword">virtual</font> <a class="code" href="classost_1_1_command_option_with_arg.html#a1">~CommandOptionWithArg</a>();
00256         
00257         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option_with_arg.html#a2">FoundOption</a>( CommandOptionParse * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> * value = 0 );
00258         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option_with_arg.html#a2">FoundOption</a>( CommandOptionParse * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> ** value, <font class="keywordtype">int</font> num );
00259         <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="classost_1_1_command_option_with_arg.html#a4">HasValue</a>();
00260 };
00261         
<a name="l00265"></a><a class="code" href="classost_1_1_command_option_arg.html">00265</a> <font class="keyword">class </font>CommandOptionArg : <font class="keyword">public</font> CommandOptionWithArg {
00266 <font class="keyword">public</font>:
00267 
00278         <a class="code" href="classost_1_1_command_option_arg.html#a0">CommandOptionArg</a>(
00279                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_name,
00280                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_letter,
00281                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_description,
00282                 <font class="keywordtype">bool</font>                      in_required = <font class="keyword">false</font>,
00283                 CommandOption  ** pp_next = &amp; DefaultCommandOptionList
00284         );
00285 
00286         <font class="keyword">virtual</font> <a class="code" href="classost_1_1_command_option_arg.html#a1">~CommandOptionArg</a>();
00287         
00288 
00289 };
00290         
<a name="l00300"></a><a class="code" href="classost_1_1_command_option_rest.html">00300</a> <font class="keyword">class </font>CommandOptionRest : <font class="keyword">public</font> CommandOptionWithArg {
00301 <font class="keyword">public</font>:
00302 
00313         <a class="code" href="classost_1_1_command_option_rest.html#a0">CommandOptionRest</a>(
00314                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_name,
00315                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_letter,
00316                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_description,
00317                 <font class="keywordtype">bool</font>                      in_required = <font class="keyword">false</font>,
00318                 CommandOption  ** pp_next = &amp; DefaultCommandOptionList
00319         );
00320 
00321 };
00322         
<a name="l00330"></a><a class="code" href="classost_1_1_command_option_collect.html">00330</a> <font class="keyword">class </font>CommandOptionCollect : <font class="keyword">public</font> CommandOptionWithArg {
00331 <font class="keyword">public</font>:
00332 
00343         <a class="code" href="classost_1_1_command_option_collect.html#a0">CommandOptionCollect</a>(
00344                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_name,
00345                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_letter,
00346                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_description,
00347                 <font class="keywordtype">bool</font>                      in_required = <font class="keyword">false</font>,
00348                 CommandOption  ** pp_next = &amp; DefaultCommandOptionList
00349         );
00350 
00351 };
00352         
<a name="l00356"></a><a class="code" href="classost_1_1_command_option_no_arg.html">00356</a> <font class="keyword">class </font>CommandOptionNoArg : <font class="keyword">public</font> CommandOption {
00357 <font class="keyword">public</font>:
00358 
<a name="l00362"></a><a class="code" href="classost_1_1_command_option_no_arg.html#m0">00362</a>         <font class="keywordtype">int</font>                       numset;       <font class="comment">// The number of times this argument is set</font>
00363 
00374         <a class="code" href="classost_1_1_command_option_no_arg.html#a0">CommandOptionNoArg</a>(
00375                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_name,
00376                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_option_letter,
00377                 <font class="keyword">const</font> <font class="keywordtype">char</font>              * in_description,
00378                 <font class="keywordtype">bool</font>                      in_required = <font class="keyword">false</font>,
00379                 CommandOption  ** pp_next = &amp; DefaultCommandOptionList
00380         );
00381 
00385         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option_no_arg.html#a1">FoundOption</a>( CommandOptionParse * cop, <font class="keyword">const</font> <font class="keywordtype">char</font> * value = 0 );
00386 
00387 };
00388 
<a name="l00398"></a><a class="code" href="classost_1_1_command_option_parse.html">00398</a> <font class="keyword">class </font>CommandOptionParse {
00399 <font class="keyword">public</font>:
00400 
00404         <font class="keyword">virtual</font> <a class="code" href="classost_1_1_command_option_parse.html#a0">~CommandOptionParse</a>() = 0;
00405 
00409         <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="classost_1_1_command_option_parse.html#a1">ArgsHaveError</a>() = 0;
00410 
00414         <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="classost_1_1_command_option_parse.html#a2">PrintErrors</a>() = 0;
00415 
00419         <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="classost_1_1_command_option_parse.html#a3">PrintUsage</a>() = 0;
00420 
00425         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option_parse.html#a4">RegisterError</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> * err_msg ) = 0;
00426 
00431         <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_command_option_parse.html#a5">PerformTask</a>() = 0;
00432 
00433 };
00434 
00443 CommandOptionParse * <a class="code" href="namespaceost.html#a179">MakeCommandOptionParse</a>(
00444         <font class="keywordtype">int</font>                                argc,
00445         <font class="keywordtype">char</font>                    ** argv,
00446         <font class="keywordtype">char</font>                     * comment,
00447         CommandOption    * options = DefaultCommandOptionList
00448 );
00449 <font class="preprocessor">#endif</font>
00450 <font class="preprocessor"></font>
00451 <font class="preprocessor">#ifdef  CCXX_NAMESPACES</font>
00452 <font class="preprocessor"></font>};
00453 <font class="preprocessor">#endif</font>
00454 <font class="preprocessor"></font>
00455 <font class="preprocessor">#endif</font>
00456 <font class="preprocessor"></font>
</pre></div><hr><address><small>Generated at Fri Jan 4 18:51:45 2002 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.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2001</small></address>
</body>
</html>