Update README with newly released version url
[command.git] / include / argument.h
index a32cf82064893f9f78677aea1a9e3c4bb3d4a3f7..bf5fc3354f304c7b894252069969451275ec7fff 100644 (file)
@@ -4,6 +4,7 @@
 #include <string>
 #include <sstream>
 #include <iostream>
+#include <functional>
 
 #include "parameter.h"
 #include "callable.h"
@@ -31,7 +32,7 @@ namespace command {
          * @param description Description of current Argument
          * @param function Function used to handle current Argument.
          */
-        Argument(const std::string & description, void (*function)(ParameterType))
+        Argument(const std::string & description, std::function<void(ParameterType)> function)
             : Parameter(description), Callable<ParameterType>(function) {
         }
 
@@ -67,7 +68,7 @@ namespace command {
         virtual bool understand(const std::string & argv) {
             std::stringstream ss;
 
-            ss << argv;
+            ss << std::fixed << argv;
             ss >> value;
 
             if (!ss.fail()) {
@@ -76,6 +77,13 @@ namespace command {
 
             return false;
         }
+
+        /**
+         * \inheritdoc
+         */
+        virtual unsigned int valuePosition(const std::string & ) {
+            return 0;
+        }
     };
 }