Fix compilation, remove some warnings.
[command.git] / include / option.h
index 241754d973b274286360e1772b9d038c2ccfecb3..be65e772d06a6f42a868558d7d91002855e94d74 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef __COMMAND_OPTION_H
 #define __COMMAND_OPTION_H
 
+#include <string>
+
+#include "parameter.h"
+
 namespace command {
     /**
      * Class responsible for handling commandline options.
@@ -11,7 +15,7 @@ namespace command {
      */
     template<typename OptionType>
     class Option
-        : Argument<OptionType> {
+        : public Parameter, public Callable<OptionType>  {
     protected:
         /**
          * Option name
@@ -26,8 +30,21 @@ namespace command {
          * @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<OptionType>(description, function) {
+        Option(std::string name, std::string description, void (*function)(OptionType))
+            : Parameter(description), Callable<OptionType>(function), name(name) {
+        }
+        virtual ~Option() { }
+
+        virtual void handle() {
+            this->call(std::string("O"));
+        }
+
+        virtual bool understand(const std::string & argVal) {
+            if (argVal.find(name) != std::string::npos) {
+                return true;
+            }
+
+            return false;
         }
     };
 }