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.
19 * ./myprog /path/to/file
20 * ./myprog "some argument"
22 template<typename ArgumentType>
23 class Argument : public Parameter, public Callable<ArgumentType> {
25 /** Variable indicating if current Argument was already used or not */
28 ArgumentType argument;
30 typedef class Argument Type;
33 * Default constructor.
35 * @param description Description of current Argument
36 * @param function Function used to handle current Argument.
38 Argument(const std::string & description, void (*function)(ArgumentType))
39 : Parameter(description), Callable<ArgumentType>(function) {
45 virtual ~Argument() { }
50 virtual void handle() {
55 * Method used for checking if Argument understands user value.
56 * If so current Argument is flagged as used and no more checks against
57 * it will be done in future.
59 * \attention If conversion from passed value to ArgumentType is
60 * impossible, it is ignored. It means that it is not understanded by
63 * @param argv command line value against which test will be made.
65 * @return If passed argv is succesfully converted to ArgumentType,
66 * returns true and Argument is set as used one. If there was an error
67 * during conversion, method returns false and can be used to check
70 virtual bool understand(const std::string & argv) {
88 #endif /* __COMMAND_ARGUMENT_H */