1 #ifndef __COMMAND_ARGUMENT_H
2 #define __COMMAND_ARGUMENT_H
13 * Class responsible for handling commandline arguments.
14 * Arguments are non-named parameters of program.
18 * - ./myprog /path/to/file
19 * - ./myprog "some argument"
21 template<typename ParameterType>
22 class Argument : public Parameter, public Callable<ParameterType> {
26 typedef class Argument Type;
29 * Default constructor.
31 * @param description Description of current Argument
32 * @param function Function used to handle current Argument.
34 Argument(const std::string & description, void (*function)(ParameterType))
35 : Parameter(description), Callable<ParameterType>(function) {
41 virtual ~Argument() { }
46 virtual void handle() {
52 * Method used for checking if Argument understands user value.
53 * If so current Argument is flagged as used and no more checks against
54 * it will be done in future.
56 * \attention If conversion from passed value to ParameterType is
57 * impossible, it is ignored. It means that it is not understanded by
60 * @param argv command line value against which test will be made.
62 * @return If passed argv is succesfully converted to ParameterType,
63 * returns true and Argument is set as used one. If there was an error
64 * during conversion, method returns false and can be used to check
67 virtual bool understand(const std::string & argv) {
82 #endif /* __COMMAND_ARGUMENT_H */