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
Remove commented out code
[command.git]
/
include
/
callable.h
diff --git
a/include/callable.h
b/include/callable.h
index 544b37115fb2cbe4b756ae1bb10f439812c76c8b..efff3e8d88b2d1d0fbe36668a6798e85acc47128 100644
(file)
--- a/
include/callable.h
+++ b/
include/callable.h
@@
-2,18
+2,19
@@
#define __COMMAND_CALLABLE_H
#include <string>
#define __COMMAND_CALLABLE_H
#include <string>
+#include <functional>
namespace command {
/**
* Callable behaviour class.
*/
namespace command {
/**
* Callable behaviour class.
*/
- template<typename
Argument
Type>
+ template<typename
Parameter
Type>
class Callable {
protected:
/**
* Function handling user Arguments
*/
class Callable {
protected:
/**
* Function handling user Arguments
*/
-
void (*func)(ArgumentType)
;
+
std::function<void(ParameterType)> func
;
public:
/**
public:
/**
@@
-21,7
+22,7
@@
namespace command {
*
* @param function Function that will be invoked
*/
*
* @param function Function that will be invoked
*/
- Callable(
void (*function)(ArgumentType)
)
+ Callable(
std::function<void(ParameterType)> function
)
: func(function) {
}
: func(function) {
}
@@
-33,7
+34,7
@@
namespace command {
*
* @param value Value passed to program argument
*/
*
* @param value Value passed to program argument
*/
- void call(
Argument
Type value) {
+ void call(
Parameter
Type value) {
this->func(value);
}
};
this->func(value);
}
};
@@
-48,7
+49,7
@@
namespace command {
/**
* Function handling user Arguments
*/
/**
* Function handling user Arguments
*/
-
void (*func)(void)
;
+
std::function<void(void)> func
;
public:
/**
public:
/**
@@
-56,9
+57,10
@@
namespace command {
*
* @param function Function that will be invoked
*/
*
* @param function Function that will be invoked
*/
- Callable(
void (*function)(void)
)
+ Callable(
std::function<void(void)> function
)
: func(function) {
}
: func(function) {
}
+
virtual ~Callable() { }
protected:
virtual ~Callable() { }
protected: