Parameter inheritance fixes.
[command.git] / include / option.h
index fef4e31376287290af7a988f3fdb279efa04a151..3cba30fe1691df1b0321a7659574c34cf5754bd8 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <string>
 
-#include "argument.h"
+#include "parameter.h"
 
 namespace command {
     /**
@@ -15,9 +15,7 @@ namespace command {
      */
     template<typename OptionType>
     class Option
-        : public Argument<OptionType> {
-    public:
-//         typedef typename Argument<OptionType, Lambda>::FunctionType FunctionType;
+        : public Parameter, public Callable<OptionType>  {
     protected:
         /**
          * Option name
@@ -33,14 +31,21 @@ namespace command {
          * @param function Function used to handle current Option.
          */
         Option(std::string name, std::string description, void (*function)(OptionType))
-            : name(name), Argument<OptionType>(description, function) {
+            : Parameter(description), Callable<OptionType>(function) {
         }
         virtual ~Option() { }
 
         virtual void handle() {
-            std::cout << "Option::handle()" << std::endl;
             this->call(std::string("O"));
         }
+
+        virtual bool understand(std::string argVal) {
+            if (argVal.find(name) != std::string::npos) {
+                return true;
+            }
+
+            return false;
+        }
     };
 }