1 #ifndef __COMMAND_ARGUMENT_H
2 #define __COMMAND_ARGUMENT_H
13 * Class responsible for handling commandline arguments.
14 * Arguments are required, non-named parameters of program.
20 template<typename ArgumentType>
21 class Argument : public Parameter, public Callable<ArgumentType> {
23 /** Variable indicating if current Argument was already used or not */
26 ArgumentType argument;
28 typedef class Argument Type;
31 * Default constructor.
33 * @param description Description of current Argument
34 * @param function Function used to handle current Argument.
36 Argument(const std::string & description, void (*function)(ArgumentType))
37 : Parameter(description), Callable<ArgumentType>(function) {
43 virtual ~Argument() { }
48 virtual void handle() {
53 * Method used for checking if Argument understands user value.
54 * If so current Argument is flagged as used, and no more checks against
55 * it will be done in future.
57 * If conversion from passed value to ArgumentType is impossible, it is
60 * @param argv command line value against which test will be made.
62 * @return If passed argv is succesfully converted to ArgumentType,
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) {
85 #endif /* __COMMAND_ARGUMENT_H */