|
OpenTop 1.5 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||||
| SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD | |||||||
#include "ot/auxil/MultiListOption.h"

A MultiLisOption could be thought of as a container of several BasicOption objects, but with the exception that it allows each BasicOption to appear more than once on the same command line.
A MultiListOption is useful when an application can take a variable number of arguments of the same type (or types). For example the webform sample application uses a MultiListOption to hold details of the form fields expressed on the command line. It assembles fields in the order that they are specified on the command line, and allows both filename fields and text fields. For example the following command line may be passed to the webform sample application:-
webform -f to:another@acme.com -F thefile:myfile.txt -f subject:File
In the webform sample, the -f and -F options are both handled by the same MultiListOption object, with the result that al the fields can be retrieved in the order they appear on the command line as well allowing the application to determine how each option was specified (i.e. as -F or -f).
| Constructor/Destructor Summary | |
MultiListOption()Default constructor. | |
MultiListOption(const String& longName, CharType shortName, ArgumentType argType)Constructor taking the details of a single option type. | |
| Method Summary | |
void |
addOption(const String& longName, CharType shortName, ArgumentType argType)Adds a command line option to the list of options handled by this MultiListOption. |
String |
getArgument(size_t index) constReturns the argument (if any) for an option which was specified on the command line. |
String |
getHowSpecified(size_t index) constReturns a String depicting how an option was specified on the command line. |
String |
getLongName(size_t index) constReturns the long name for an option which was specified on the command line. |
size_t |
getNumPresent() constReturns the number of command line options, matching options handled by this MultiListOption, that was specified on the parsed command line. |
CharType |
getShortName(size_t index) constReturns the short name for an option which was specified on the command line. |
virtual void |
setPresent(const String& howSpecified, OptionType optionTypeUsed, const String& argument)Called by the CommandLineParser once it has determined that this CommandLineOption has been specified on the command line being parsed. |
virtual ArgumentType |
testLongOption(const String& option) constCalled by the CommandLineParser to test if a long option contained within the command line matches the long option name accepted by this CommandLineOption. |
virtual ArgumentType |
testShortOption(CharType option) constCalled by the CommandLineParser to test if a short option contained within the command line matches the short option name accepted by this CommandLineOption. |
| Constructor/Destructor Detail |
MultiListOption()
MultiListOption(const String& longName,
CharType shortName,
ArgumentType argType)
| Method Detail |
void addOption(const String& longName,
CharType shortName,
ArgumentType argType)
longName - shortName - argType - String getArgument(size_t index) const
index - String getHowSpecified(size_t index) const
index - String getLongName(size_t index) const
index - size_t getNumPresent() const
CharType getShortName(size_t index) const
index - virtual void setPresent(const String& howSpecified,
OptionType optionTypeUsed,
const String& argument)
howSpecified - optionTypeUsed - argument - CommandLineException - virtual ArgumentType testLongOption(const String& option) const
If the passed option name does match, a value from the CommandLineOption::ArgumentType enumeration is returned to indicate whether an argument is expected for this option.
option - virtual ArgumentType testShortOption(CharType option) const
option -
|
OpenTop 1.5 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||||
| SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD | |||||||