Save working version Command library.
[command.git] / include / option.h
1 #ifndef __COMMAND_OPTION_H
2 #define __COMMAND_OPTION_H
3
4 #include <string>
5
6 #include "argument.h"
7
8 namespace command {
9     /**
10      * Class responsible for handling commandline options.
11      * Options are non-required, named parameters of program.
12      *
13      * Example:
14      *  ./myprog OptionName OptionValue
15      */
16     template<typename OptionType>
17     class Option
18         : Argument<OptionType> {
19     public:
20 //         typedef typename Argument<OptionType, Lambda>::FunctionType FunctionType;
21     protected:
22         /**
23          * Option name
24          */
25         std::string name;
26
27     public:
28         /**
29          * Default constructor.
30          *
31          * @param name Name of the current Option
32          * @param description Description of current Option
33          * @param function Function used to handle current Option.
34          */
35         Option(std::string name, std::string description, void (*function)(OptionType))
36             : name(name), Argument<OptionType>(description, function) {
37         }
38         virtual ~Option() { }
39
40         virtual void handle() {
41         }
42     };
43 }
44
45 #endif /* __COMMAND_OPTION_H */