template<typename ParameterType>
class command::Option< ParameterType >
Class responsible for handling commandline options. Options are named parameters of program.
Example:
- ./myprog OptionName=OptionValue
- ./myprog -f=/some/file
- ./myprog –level=15
template<typename ParameterType >
virtual bool command::Option< ParameterType >::understand |
( |
const std::string & |
argv | ) |
|
|
inlinevirtual |
Method used for checking if Option understands given user value. If so current Option is flagged as used and no more checks against it will be done in future.
Passed value should be in form of: OptionName=OptionValue
If no equal sign is after OptionName part, std::invalid_argument exception with appropriate message is thrown
If conversion of OptionValue part to ParameterType failed, std::invalid_argument exception with appropriate message is thrown
- Parameters
-
argv | command line value against which test will be made. User value should be in format: OptionName=OptionValue. |
- Returns
- If passed argv succesfully detected OptionName part as a current option and its OptionValue part has been succesfully converted to ParameterType, returns true and Option is set as used one. Otherwise returns false and can be used to check against next value.
- Exceptions
-
Implements command::Parameter.