<!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>ost::CommandOption class Reference</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> <a class="qindex" href="namespaces.html">Namespace List</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="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>ost::CommandOption Class Reference</h1><a class="el" href="classost_1_1_command_option.html">CommandOption</a> is the base class for all command line options. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="cmdoptns_8h-source.html">cmdoptns.h</a>></code> <p> <p>Inheritance diagram for ost::CommandOption:: <p><center><img src="classost_1_1_command_option.gif" usemap="#ost::CommandOption_map" border="0"></center> <map name="ost::CommandOption_map"> <area href="classost_1_1_command_option_no_arg.html" alt="ost::CommandOptionNoArg" shape="rect" coords="0,56,171,80"> <area href="classost_1_1_command_option_with_arg.html" alt="ost::CommandOptionWithArg" shape="rect" coords="181,56,352,80"> <area href="classost_1_1_command_option_arg.html" alt="ost::CommandOptionArg" shape="rect" coords="0,112,171,136"> <area href="classost_1_1_command_option_collect.html" alt="ost::CommandOptionCollect" shape="rect" coords="181,112,352,136"> <area href="classost_1_1_command_option_rest.html" alt="ost::CommandOptionRest" shape="rect" coords="362,112,533,136"> </map> <a href="classost_1_1_command_option-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="classost_1_1_command_option.html#s4">OptionType</a> { <a class="el" href="classost_1_1_command_option.html#s4s0">HasArg</a>, <a class="el" href="classost_1_1_command_option.html#s4s1">NoArg</a>, <a class="el" href="classost_1_1_command_option.html#s4s2">Trailing</a>, <a class="el" href="classost_1_1_command_option.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="classost_1_1_command_option.html#a0">~CommandOption</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>A virtual destructor just in case.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classost_1_1_command_option.html#a1">CommandOption</a> (const char *in_option_name, const char *in_option_letter, const char *in_description, <a class="el" href="classost_1_1_command_option.html#s4">OptionType</a> in_option_type, bool in_required=false, CommandOption **pp_next=&<a class="el" href="namespaceost.html#a0">DefaultCommandOptionList</a>)</td></tr> <tr><td> </td><td><font size=-1><em><a class="el" href="classost_1_1_command_option.html">CommandOption</a> 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="classost_1_1_command_option.html#a2">FoundOption</a> (<a class="el" href="classost_1_1_command_option_parse.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="classost_1_1_command_option_parse.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="classost_1_1_command_option.html#a3">FoundOption</a> (<a class="el" href="classost_1_1_command_option_parse.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="classost_1_1_command_option_parse.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="classost_1_1_command_option.html#a4">ParseDone</a> (<a class="el" href="classost_1_1_command_option_parse.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="classost_1_1_command_option.html#a5">PerformTask</a> (<a class="el" href="classost_1_1_command_option_parse.html">CommandOptionParse</a> *cop)</td></tr> <tr><td> </td><td><font size=-1><em>Once <a class="el" href="classost_1_1_command_option.html">CommandOption</a> 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 bool </td><td valign=bottom><a class="el" href="classost_1_1_command_option.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="classost_1_1_command_option.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="classost_1_1_command_option.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="classost_1_1_command_option.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="classost_1_1_command_option.html#s4">OptionType</a> </td><td valign=bottom><a class="el" href="classost_1_1_command_option.html#m3">option_type</a></td></tr> <tr><td> </td><td><font size=-1><em>This command option's OptionType.</em> <a href="#m3">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classost_1_1_command_option.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="classost_1_1_command_option.html#m5">next</a></td></tr> <tr><td> </td><td><font size=-1><em>This next <a class="el" href="classost_1_1_command_option.html">CommandOption</a> in this list of options or nil if no more options exist.</em> <a href="#m5">More...</a><em></em></font><br><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> <a class="el" href="classost_1_1_command_option.html">CommandOption</a> 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="classost_1_1_command_option_with_arg.html">CommandOptionWithArg</a>, <a class="el" href="classost_1_1_command_option_rest.html">CommandOptionRest</a> or <a class="el" href="classost_1_1_command_option_no_arg.html">CommandOptionNoArg</a> which can also be used to derive more complex classes or even entire applications. <p> <dl compact><dt><b> Author: </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="ost::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 class="md" nowrap valign="top"> enum ost::CommandOption::OptionType </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><em><a name="s4s0" doxytag="HasArg"></a><em>HasArg</em> </em> </td><td> This option is associated with a value.</td></tr> <tr><td valign=top><em><a name="s4s1" doxytag="NoArg"></a><em>NoArg</em> </em> </td><td> This option is a flag only.</td></tr> <tr><td valign=top><em><a name="s4s2" doxytag="Trailing"></a><em>Trailing</em> </em> </td><td> Remaining of the command line arguments.</td></tr> <tr><td valign=top><em><a name="s4s3" doxytag="Collect"></a><em>Collect</em> </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="ost::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 class="md" nowrap valign="top"> virtual ost::CommandOption::~CommandOption </td> <td class="md">( </td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [virtual]</code></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="ost::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 class="md" nowrap valign="top"> ost::CommandOption::CommandOption </td> <td class="md">( </td> <td class="md">const char *</td> <td class="mdname"> <em>in_option_name</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">const char *</td> <td class="mdname"> <em>in_option_letter</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">const char *</td> <td class="mdname"> <em>in_description</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md"><a class="el" href="classost_1_1_command_option.html#s4">OptionType</a></td> <td class="mdname"> <em>in_option_type</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">bool</td> <td class="mdname"> <em>in_required</em> = false, </td> </tr> <tr> <td></td> <td></td> <td class="md">CommandOption **</td> <td class="mdname"> <em>pp_next</em> = & <a class="el" href="namespaceost.html#a0">DefaultCommandOptionList</a></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> <a class="el" href="classost_1_1_command_option.html">CommandOption</a> 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="ost::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 class="md" nowrap valign="top"> virtual void ost::CommandOption::FoundOption </td> <td class="md">( </td> <td class="md"><a class="el" href="classost_1_1_command_option_parse.html">CommandOptionParse</a> *</td> <td class="mdname"> <em>cop</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">const char **</td> <td class="mdname"> <em>value</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">int</td> <td class="mdname"> <em>num</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [virtual]</code></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="classost_1_1_command_option_parse.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="classost_1_1_command_option_with_arg.html#a3">ost::CommandOptionWithArg</a>. </td> </tr> </table> <a name="a2" doxytag="ost::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 class="md" nowrap valign="top"> virtual void ost::CommandOption::FoundOption </td> <td class="md">( </td> <td class="md"><a class="el" href="classost_1_1_command_option_parse.html">CommandOptionParse</a> *</td> <td class="mdname"> <em>cop</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">const char *</td> <td class="mdname"> <em>value</em> = 0</td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [virtual]</code></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="classost_1_1_command_option_parse.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="classost_1_1_command_option_with_arg.html#a2">ost::CommandOptionWithArg</a>, and <a class="el" href="classost_1_1_command_option_no_arg.html#a1">ost::CommandOptionNoArg</a>. </td> </tr> </table> <a name="a6" doxytag="ost::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 class="md" nowrap valign="top"> virtual bool ost::CommandOption::HasValue </td> <td class="md">( </td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [virtual]</code></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="classost_1_1_command_option_with_arg.html#a4">ost::CommandOptionWithArg</a>. </td> </tr> </table> <a name="a4" doxytag="ost::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 class="md" nowrap valign="top"> virtual void ost::CommandOption::ParseDone </td> <td class="md">( </td> <td class="md"><a class="el" href="classost_1_1_command_option_parse.html">CommandOptionParse</a> *</td> <td class="mdname1"> <em>cop</em> </td> <td class="md">) </td> <td class="md"><code> [virtual]</code></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="ost::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 class="md" nowrap valign="top"> virtual void ost::CommandOption::PerformTask </td> <td class="md">( </td> <td class="md"><a class="el" href="classost_1_1_command_option_parse.html">CommandOptionParse</a> *</td> <td class="mdname1"> <em>cop</em> </td> <td class="md">) </td> <td class="md"><code> [virtual]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Once <a class="el" href="classost_1_1_command_option.html">CommandOption</a> 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="ost::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 class="md" nowrap valign="top"> const char* ost::CommandOption::description </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="ost::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 class="md" nowrap valign="top"> CommandOption* ost::CommandOption::next </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> This next <a class="el" href="classost_1_1_command_option.html">CommandOption</a> in this list of options or nil if no more options exist. <p> </td> </tr> </table> <a name="m1" doxytag="ost::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 class="md" nowrap valign="top"> const char* ost::CommandOption::option_letter </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="ost::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 class="md" nowrap valign="top"> const char* ost::CommandOption::option_name </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="ost::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 class="md" nowrap valign="top"> <a class="el" href="classost_1_1_command_option.html#s4">OptionType</a> ost::CommandOption::option_type </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="ost::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 class="md" nowrap valign="top"> bool ost::CommandOption::required </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_8h-source.html">cmdoptns.h</a></ul> <hr><address><small>Generated at Fri Jan 4 18:51:47 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>, © 1997-2001</small></address> </body> </html>