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