Bayonne2 / Common C++ 2 Framework
Public Types | Public Member Functions | Data Fields
CommandOptionWithArg Class Reference

Derived class of CommandOption for options that have a value associated with them. More...

#include <cmdoptns.h>

Inheritance diagram for CommandOptionWithArg:
Inheritance graph
[legend]
Collaboration diagram for CommandOptionWithArg:
Collaboration graph
[legend]

Public Types

  OptionType is for denoting what type of option this is, with an arg, without an arg or the trailing args. More...
 

Public Member Functions

  CommandOptionWithArg (const char *inOptionName, const char *inOptionLetter, const char *inDescription, OptionType inOptionType, bool inRequired=false, CommandOption **ppNext=&defaultCommandOptionList)
  CommandOptionWithArg contructor. More...
 
virtual  ~CommandOptionWithArg ()
 
virtual void  foundOption (CommandOptionParse *cop, const char *value=0)
  foundOption is called by the CommandOptionParse object during the parsing of the command line options. More...
 
virtual void  foundOption (CommandOptionParse *cop, const char **value, int num)
  foundOption is called by the CommandOptionParse object during the parsing of the command line options. More...
 
virtual bool  hasValue ()
  For fields with the required flag set, this method is used to determine if the Option has satisfied it's required status. More...
 
virtual void  parseDone (CommandOptionParse *cop)
  Once parsing of command line options is complete, this method is called. More...
 
virtual void  performTask (CommandOptionParse *cop)
  Once CommandOption objects have completed parsing and there are no errors they may have some specific tasks to perform. More...
 

Data Fields

const char **  values
  Array of list of values collected for this option. More...
 
int  numValue
  Number of values in the values array. More...
 
const char *  optionName
  Long option name, these will be preceded with "--" on the command line. More...
 
const char *  optionLetter
  option letter, these will be preceded with "-" on the command line. More...
 
const char *  description
  A short description of the option for Usage messages. More...
 
  This command option's OptionType. More...
 
bool  required
  True if this parameter is required. More...
 
  This next CommandOption in this list of options or nil if no more options exist. More...
 

Detailed Description

Derived class of CommandOption for options that have a value associated with them.

Classes CommandOptionRest and CommandOptionArg derive from this class.

Definition at line 214 of file cmdoptns.h.

Member Enumeration Documentation

inherited

OptionType is for denoting what type of option this is, with an arg, without an arg or the trailing args.

Option type

Enumerator
hasArg 

This option is associated with a value.

noArg 

This option is a flag only.

trailing 

Remaining of the command line arguments.

collect 

Collect values that are not a value to an option.

Definition at line 103 of file cmdoptns.h.

Constructor & Destructor Documentation

CommandOptionWithArg::CommandOptionWithArg ( const char *  inOptionName,
const char *  inOptionLetter,
const char *  inDescription,
OptionType  inOptionType,
bool  inRequired = false,
)

CommandOptionWithArg contructor.

Note the default values for required and ppNext.

Parameters
inOptionName long option name
inOptionLetter short letter name
inDescription short description of the option
inOptionType the type of this option
inRequired true if option is required
ppNext the linked list header
virtual CommandOptionWithArg::~CommandOptionWithArg ( )
virtual

Member Function Documentation

virtual void CommandOptionWithArg::foundOption ( CommandOptionParsecop,
const char *  value = 0 
)
virtual

foundOption is called by the CommandOptionParse object during the parsing of the command line options.

Parameters
cop pointer to the command option parser
value the value of this option

Reimplemented from CommandOption.

virtual void CommandOptionWithArg::foundOption ( CommandOptionParsecop,
const char **  value,
int  num 
)
virtual

foundOption is called by the CommandOptionParse object during the parsing of the command line options.

Parameters
cop pointer to the command option parser
value an array of values of this option
num number of values in the array

Reimplemented from CommandOption.

virtual bool CommandOptionWithArg::hasValue ( )
virtual

For fields with the required flag set, this method is used to determine if the Option has satisfied it's required status.

The default methods simply returns true if any values have been found. This could be specialized to return true based on some other criteria.

Reimplemented from CommandOption.

virtual void CommandOption::parseDone ( CommandOptionParsecop )
virtualinherited

Once parsing of command line options is complete, this method is called.

This can be used to perform last minute checks on the options collected.

Parameters
cop pointer to the command option parser
virtual void CommandOption::performTask ( CommandOptionParsecop )
virtualinherited

Once CommandOption objects have completed parsing and there are no errors they may have some specific tasks to perform.

PerformTask must return.

Parameters
cop pointer to the command option parser

Field Documentation

const char* CommandOption::description
inherited

A short description of the option for Usage messages.

e.g. Usage: mycommand : blah -f, –file <DESCRIPTION here>

Definition at line 96 of file cmdoptns.h.

CommandOption* CommandOption::next
inherited

This next CommandOption in this list of options or nil if no more options exist.

Definition at line 137 of file cmdoptns.h.

int CommandOptionWithArg::numValue

Number of values in the values array.

Definition at line 225 of file cmdoptns.h.

const char* CommandOption::optionLetter
inherited

option letter, these will be preceded with "-" on the command line.

e.g. -f foo.x

Definition at line 89 of file cmdoptns.h.

const char* CommandOption::optionName
inherited

Long option name, these will be preceded with "--" on the command line.

e.g. –file foo.x

Definition at line 83 of file cmdoptns.h.

OptionType CommandOption::optionType
inherited

This command option's OptionType.

Definition at line 125 of file cmdoptns.h.

bool CommandOption::required
inherited

True if this parameter is required.

If the parameter is not supplied and required is true, an error will be flagged in the option processor.

Definition at line 131 of file cmdoptns.h.

const char** CommandOptionWithArg::values

Array of list of values collected for this option.

Definition at line 220 of file cmdoptns.h.


The documentation for this class was generated from the following file:

Generated on Dec 21, 2017 for commoncpp2-1.8.1, ccrtp-1.7.2, libzrtpcpp-2.3.4, ccscript3-1.1.7, ccaudio2-1.0.0 and bayonne2-2.3.2 (after installation in /usr/local/) by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /