Options |
AP_OPTION is the common superclass of all options. It defines the fact that options can have a short and a long form and a descriptive text. It also can count the occurrences of an option and can mark the option as mandatory.
AP_OPTION_WITH_PARAMETER[G] extends AP_OPTION with the possibility of recoding parameters of type G. All options except for AP_FLAG inherit from this class.
The following standard option types are available:
It should be easy to implement customized option types do define specific parameters, for example for file names or dates. It is best to inherit form AP_OPTION_WITH_PARAMETER[G] or one of its descendants.
Sometimes, mostly for backward compatibility, it is necessary to make the parameter to an option optional. This can be done by calling the set_parameter_as_optional feature in class AP_STRING_OPTION. To prevent the grammar from becoming ambiguous, this only works for long options. Also, it is impossible to use the space as a delimiter between option and parameter: '--foo=X' will parse as option foo with parameter 'X', '--foo X' will parse as foo without a parameter, and then the global parameter 'X'.
The parameters list in the option will record usages of the option without parameters as Void values.
Copyright © 2001-2019, Bernd Schoeller mailto:bernd@fams.de http://www.gobosoft.com Last Updated: 27 February 2019 |