dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
command.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Possibility to pass class method reference
[command.git]
/
include
/
argument.h
diff --git
a/include/argument.h
b/include/argument.h
index 80deabb9c22f903aa4f518b89dc940342b179d23..2cd3c300f970a8d2e205de7685a6f10fd9ad241d 100644
(file)
--- a/
include/argument.h
+++ b/
include/argument.h
@@
-4,6
+4,7
@@
#include <string>
#include <sstream>
#include <iostream>
#include <string>
#include <sstream>
#include <iostream>
+#include <functional>
#include "parameter.h"
#include "callable.h"
#include "parameter.h"
#include "callable.h"
@@
-35,6
+36,10
@@
namespace command {
: Parameter(description), Callable<ParameterType>(function) {
}
: 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;
virtual bool understand(const std::string & argv) {
std::stringstream ss;
- ss << argv;
+ ss <<
std::fixed <<
argv;
ss >> value;
if (!ss.fail()) {
ss >> value;
if (!ss.fail()) {