Possibility to pass class method reference
[command.git] / include / argument.h
index 80deabb9c22f903aa4f518b89dc940342b179d23..2cd3c300f970a8d2e205de7685a6f10fd9ad241d 100644 (file)
@@ -4,6 +4,7 @@
 #include <string>
 #include <sstream>
 #include <iostream>
+#include <functional>
 
 #include "parameter.h"
 #include "callable.h"
@@ -35,6 +36,10 @@ namespace command {
             : Parameter(description), Callable<ParameterType>(function) {
         }
 
+        Argument(const std::string & description, std::function<void(ParameterType)> function)
+            : Parameter(description), Callable<ParameterType>(function) {
+        }
+
         /**
          *
          */
@@ -67,7 +72,7 @@ namespace command {
         virtual bool understand(const std::string & argv) {
             std::stringstream ss;
 
-            ss << argv;
+            ss << std::fixed << argv;
             ss >> value;
 
             if (!ss.fail()) {