From: Rafał Długołęcki Date: Tue, 21 Apr 2015 23:27:44 +0000 (+0200) Subject: Added Option template class. X-Git-Tag: v0.2~45 X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=121c2f8b8cbcae79a82093421282b0526ddd17c1;p=command.git Added Option template class. --- diff --git a/include/argument.h b/include/argument.h index 6a292b4..743f0c2 100644 --- a/include/argument.h +++ b/include/argument.h @@ -8,7 +8,7 @@ namespace command { /** * Class responsible for handling commandline arguments. - * Arguments are required non-named parameters for program. + * Arguments are required,x non-named parameters of program. * * Example: * ./myprog ARGUMENT diff --git a/include/option.h b/include/option.h new file mode 100644 index 0000000..241754d --- /dev/null +++ b/include/option.h @@ -0,0 +1,35 @@ +#ifndef __COMMAND_OPTION_H +#define __COMMAND_OPTION_H + +namespace command { + /** + * Class responsible for handling commandline options. + * Options are non-required, named parameters of program. + * + * Example: + * ./myprog OptionName OptionValue + */ + template + class Option + : Argument { + protected: + /** + * Option name + */ + std::string name; + + public: + /** + * Default constructor. + * + * @param name Name of the current Option + * @param description Description of current Option + * @param function Function used to handle current Option. + */ + Argument(std::string name, std::string description, FunctionType function) + : name(name), Argument(description, function) { + } + }; +} + +#endif /* __COMMAND_OPTION_H */