Save working version Command library.
[command.git] / include / argument.h
1 #ifndef __COMMAND_ARGUMENT_H
2 #define __COMMAND_ARGUMENT_H
3
4 #include <string>
5 #include <iostream>
6
7 #include "parameter.h"
8 #include "callable.h"
9
10 namespace command {
11     /**
12      * Class responsible for handling commandline arguments.
13      * Arguments are required,x non-named parameters of program.
14      *
15      * Example:
16      *  ./myprog ARGUMENT
17      */
18     template<typename ArgumentType>
19     class Argument : public Parameter, public Callable<ArgumentType> {
20     public:
21         typedef class Argument Type;
22         /**
23          * Default constructor.
24          *
25          * @param description Description of current Argument
26          * @param function Function used to handle current Argument.
27          */
28         Argument(std::string description, void (*function)(ArgumentType))
29             : Parameter(description), Callable<ArgumentType>(function) {
30         }
31         virtual ~Argument() { }
32
33         virtual void handle() {
34             std::cout << "Argument::handle()" << std::endl;
35             this->call(std::string("A"));
36         }
37     };
38 }
39
40 #endif /* __COMMAND_ARGUMENT_H */