<!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>CommandOption class Reference</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:59 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>CommandOption Class Reference</h1>CommandOption is the base class for all command line options. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="cmdoptns_h-source.html">cmdoptns.h</a>></code> <p> <p>Inheritance diagram for CommandOption: <p><center><img src="class_commandoption.gif" usemap="#CommandOption_map" border="0"></center> <map name="CommandOption_map"> <area href="class_commandoptionnoarg.html" alt="CommandOptionNoArg" shape="rect" coords="0,56,149,80"> <area href="class_commandoptionwitharg.html" alt="CommandOptionWithArg" shape="rect" coords="159,56,308,80"> <area href="class_commandoptionarg.html" alt="CommandOptionArg" shape="rect" coords="0,112,149,136"> <area href="class_commandoptioncollect.html" alt="CommandOptionCollect" shape="rect" coords="159,112,308,136"> <area href="class_commandoptionrest.html" alt="CommandOptionRest" shape="rect" coords="318,112,467,136"> </map> <a href="class_commandoption-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0> <tr><td colspan=2><br><h2>Public Types</h2></td></tr> <tr><td nowrap align=right valign=top>enum </td><td valign=bottom><a class="el" href="class_commandoption.html#s4">OptionType</a> { <a class="el" href="class_commandoption.html#s4s0">HasArg</a>, <a class="el" href="class_commandoption.html#s4s1">NoArg</a>, <a class="el" href="class_commandoption.html#s4s2">Trailing</a>, <a class="el" href="class_commandoption.html#s4s3">Collect</a> }</td></tr> <tr><td> </td><td><font size=-1><em>OptionType is for denoting what type of option this is, with an arg, without an arg or the trailing args. Option type.</em> <a href="#s4">More...</a><em></em></font><br><br></td></tr> <tr><td colspan=2><br><h2>Public Methods</h2></td></tr> <tr><td nowrap align=right valign=top>virtual </td><td valign=bottom><a class="el" href="class_commandoption.html#a0">~CommandOption</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>A virtual destructor just in case.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="class_commandoption.html#a1">CommandOption</a> (const char *in_option_name, const char *in_option_letter, const char *in_description, <a class="el" href="class_commandoption.html#s4">OptionType</a> in_option_type, <a class="el" href="config_h.html#a17">bool</a> in_required=false, CommandOption **pp_next=&<a class="el" href="cmdoptns_h.html#a0">DefaultCommandOptionList</a>)</td></tr> <tr><td> </td><td><font size=-1><em>CommandOption contructor.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="class_commandoption.html#a2">FoundOption</a> (<a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> *cop, const char *value=0)</td></tr> <tr><td> </td><td><font size=-1><em>FoundOption is called by the <a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> object during the parsing of the command line options.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="class_commandoption.html#a3">FoundOption</a> (<a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> *cop, const char **value, int num)</td></tr> <tr><td> </td><td><font size=-1><em>FoundOption is called by the <a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> object during the parsing of the command line options.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="class_commandoption.html#a4">ParseDone</a> (<a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> *cop)</td></tr> <tr><td> </td><td><font size=-1><em>Once parsing of command line options is complete, this method is called.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="class_commandoption.html#a5">PerformTask</a> (<a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> *cop)</td></tr> <tr><td> </td><td><font size=-1><em>Once CommandOption objects have completed parsing and there are no errors they may have some specific tasks to perform.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual <a class="el" href="config_h.html#a17">bool</a> </td><td valign=bottom><a class="el" href="class_commandoption.html#a6">HasValue</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>For fields with the required flag set, this method is used to determine if the Option has satisfied it's required status.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr> <tr><td colspan=2><br><h2>Public Attributes</h2></td></tr> <tr><td nowrap align=right valign=top>const char* </td><td valign=bottom><a class="el" href="class_commandoption.html#m0">option_name</a></td></tr> <tr><td> </td><td><font size=-1><em>Long option name, these will be preceded with "--" on the command line.</em> <a href="#m0">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>const char* </td><td valign=bottom><a class="el" href="class_commandoption.html#m1">option_letter</a></td></tr> <tr><td> </td><td><font size=-1><em>option letter, these will be preceded with "-" on the command line.</em> <a href="#m1">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>const char* </td><td valign=bottom><a class="el" href="class_commandoption.html#m2">description</a></td></tr> <tr><td> </td><td><font size=-1><em>A short description of the option for Usage messages.</em> <a href="#m2">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="class_commandoption.html#s4">OptionType</a> </td><td valign=bottom><a class="el" href="class_commandoption.html#m3">option_type</a></td></tr> <tr><td> </td><td><font size=-1><em>This command option's OptionType.</em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="config_h.html#a17">bool</a> </td><td valign=bottom><a class="el" href="class_commandoption.html#m4">required</a></td></tr> <tr><td> </td><td><font size=-1><em>True if this parameter is required.</em> <a href="#m4">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>CommandOption* </td><td valign=bottom><a class="el" href="class_commandoption.html#m5">next</a></td></tr> <tr><td> </td><td><font size=-1><em>This next CommandOption in this list of options or nil if no more options exist.</em></font><br><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> CommandOption is the base class for all command line options. <p> Command line options can be defined statically and used when constructing a command line parser onject using MakeCommandOptionParse. This serves only as a base class to <a class="el" href="class_commandoptionwitharg.html">CommandOptionWithArg</a>, <a class="el" href="class_commandoptionrest.html">CommandOptionRest</a> or <a class="el" href="class_commandoptionnoarg.html">CommandOptionNoArg</a> which can also be used to derive more complex classes or even entire applications. <p> <dl compact><dt> <b>Author(s): </b><dd> Gianni Mariani <<a href="mailto:gianni@mariani.ws">gianni@mariani.ws</a>> </dl> <p> <hr><h2>Member Enumeration Documentation</h2> <a name="s4" doxytag="CommandOption::OptionType"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> enum CommandOption::OptionType </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> OptionType is for denoting what type of option this is, with an arg, without an arg or the trailing args. Option type. <p> <dl compact><dt> <b>Enumeration values:</b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><a name="s4s0" doxytag="HasArg"></a><em>HasArg</em> </td><td> This option is associated with a value.</td></tr> <tr><td valign=top><a name="s4s1" doxytag="NoArg"></a><em>NoArg</em> </td><td> This option is a flag only.</td></tr> <tr><td valign=top><a name="s4s2" doxytag="Trailing"></a><em>Trailing</em> </td><td> Remaining of the command line arguments.</td></tr> <tr><td valign=top><a name="s4s3" doxytag="Collect"></a><em>Collect</em> </td><td> Collect values that are not a value to an option.</td></tr> </table> </dl> </td> </tr> </table> <hr><h2>Constructor & Destructor Documentation</h2> <a name="a0" doxytag="CommandOption::~CommandOption"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> CommandOption::~CommandOption ( </b></td> <td valign="bottom"><b> )<code> [virtual]</code> </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> A virtual destructor just in case. <p> </td> </tr> </table> <a name="a1" doxytag="CommandOption::CommandOption"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> CommandOption::CommandOption ( </b></td> <td valign="bottom"><b> const char * <em>in_option_name</em>, </b></td> </tr> <tr> <td></td> <td><b> const char * <em>in_option_letter</em>, </b></td> </tr> <tr> <td></td> <td><b> const char * <em>in_description</em>, </b></td> </tr> <tr> <td></td> <td><b> <a class="el" href="class_commandoption.html#s4">OptionType</a> <em>in_option_type</em>, </b></td> </tr> <tr> <td></td> <td><b> <a class="el" href="config_h.html#a17">bool</a> <em>in_required</em> = false, </b></td> </tr> <tr> <td></td> <td><b> CommandOption ** <em>pp_next</em> = & <a class="el" href="cmdoptns_h.html#a0">DefaultCommandOptionList</a> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> CommandOption contructor. <p> Note the default values for required and pp_next.<dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>in_option_name</em> </td><td> long option name </td></tr> <tr><td valign=top><em>in_option_letter</em> </td><td> short letter name </td></tr> <tr><td valign=top><em>in_description</em> </td><td> short description of the option </td></tr> <tr><td valign=top><em>in_option_type</em> </td><td> the type of this option </td></tr> <tr><td valign=top><em>in_required</em> </td><td> true if option is required </td></tr> <tr><td valign=top><em>pp_next</em> </td><td> the linked list header </td></tr> </table> </dl> </td> </tr> </table> <hr><h2>Member Function Documentation</h2> <a name="a3" doxytag="CommandOption::FoundOption"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void CommandOption::FoundOption ( </b></td> <td valign="bottom"><b> <a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> * <em>cop</em>, </b></td> </tr> <tr> <td></td> <td><b> const char ** <em>value</em>, </b></td> </tr> <tr> <td></td> <td><b> int <em>num</em> )<code> [virtual]</code> </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> FoundOption is called by the <a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> object during the parsing of the command line options. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>cop</em> </td><td> pointer to the command option parser </td></tr> <tr><td valign=top><em>value</em> </td><td> an array of values of this option </td></tr> <tr><td valign=top><em>num</em> </td><td> number of values in the array </td></tr> </table> </dl> <p> Reimplemented in <a class="el" href="class_commandoptionwitharg.html#a3">CommandOptionWithArg</a>. </td> </tr> </table> <a name="a2" doxytag="CommandOption::FoundOption"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void CommandOption::FoundOption ( </b></td> <td valign="bottom"><b> <a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> * <em>cop</em>, </b></td> </tr> <tr> <td></td> <td><b> const char * <em>value</em> = 0 )<code> [virtual]</code> </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> FoundOption is called by the <a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> object during the parsing of the command line options. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>cop</em> </td><td> pointer to the command option parser </td></tr> <tr><td valign=top><em>value</em> </td><td> the value of this option </td></tr> </table> </dl> <p> Reimplemented in <a class="el" href="class_commandoptionwitharg.html#a2">CommandOptionWithArg</a>, and <a class="el" href="class_commandoptionnoarg.html#a1">CommandOptionNoArg</a>. </td> </tr> </table> <a name="a6" doxytag="CommandOption::HasValue"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="config_h.html#a17">bool</a> CommandOption::HasValue ( </b></td> <td valign="bottom"><b> )<code> [virtual]</code> </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> For fields with the required flag set, this method is used to determine if the Option has satisfied it's required status. <p> The default methods simply returns true if any values have been found. This could be specialized to return true based on some other criteria. <p> Reimplemented in <a class="el" href="class_commandoptionwitharg.html#a4">CommandOptionWithArg</a>. </td> </tr> </table> <a name="a4" doxytag="CommandOption::ParseDone"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void CommandOption::ParseDone ( </b></td> <td valign="bottom"><b> <a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> * <em>cop</em> )<code> [virtual]</code> </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Once parsing of command line options is complete, this method is called. <p> This can be used to perform last minute checks on the options collected.<dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>cop</em> </td><td> pointer to the command option parser </td></tr> </table> </dl> </td> </tr> </table> <a name="a5" doxytag="CommandOption::PerformTask"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void CommandOption::PerformTask ( </b></td> <td valign="bottom"><b> <a class="el" href="class_commandoptionparse.html">CommandOptionParse</a> * <em>cop</em> )<code> [virtual]</code> </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Once CommandOption objects have completed parsing and there are no errors they may have some specific tasks to perform. <p> PerformTask must return.<dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>cop</em> </td><td> pointer to the command option parser </td></tr> </table> </dl> </td> </tr> </table> <hr><h2>Member Data Documentation</h2> <a name="m2" doxytag="CommandOption::description"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> const char * CommandOption::description </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> A short description of the option for Usage messages. <p> e.g. Usage: mycommand : blah -f, --file <DESCRIPTION here> </td> </tr> </table> <a name="m5" doxytag="CommandOption::next"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> CommandOption * CommandOption::next </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> This next CommandOption in this list of options or nil if no more options exist. <p> </td> </tr> </table> <a name="m1" doxytag="CommandOption::option_letter"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> const char * CommandOption::option_letter </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> option letter, these will be preceded with "-" on the command line. <p> e.g. -f foo.x </td> </tr> </table> <a name="m0" doxytag="CommandOption::option_name"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> const char * CommandOption::option_name </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Long option name, these will be preceded with "--" on the command line. <p> e.g. --file foo.x </td> </tr> </table> <a name="m3" doxytag="CommandOption::option_type"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="class_commandoption.html#s4">OptionType</a> CommandOption::option_type </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> This command option's OptionType. <p> </td> </tr> </table> <a name="m4" doxytag="CommandOption::required"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="config_h.html#a17">bool</a> CommandOption::required </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> True if this parameter is required. <p> If the parameter is not supplied and required is true, an error will be flagged in the option processor. </td> </tr> </table> <hr>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="cmdoptns_h-source.html">cmdoptns.h</a></ul> <hr><address><small>Generated at Thu Oct 4 15:32:59 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>