aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlexander Tkachev2016-05-26 19:02:55 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitf4547f44df32ce1f49a6a36df083e7703751adcd (patch)
treea69e2f703a42348d9766ad128bb88b2c169719ad /common
parent62ccf1f902100febfb1be02b67e84a6e4938ebbf (diff)
downloadscummvm-rg350-f4547f44df32ce1f49a6a36df083e7703751adcd.tar.gz
scummvm-rg350-f4547f44df32ce1f49a6a36df083e7703751adcd.tar.bz2
scummvm-rg350-f4547f44df32ce1f49a6a36df083e7703751adcd.zip
CLOUD: Add RequestIdPair struct
Can be used with Callback<T> (means it's still type safe). It's used to pass not only Request id to user's callback, but also a value user wanted. void *data field is removed from RequestInfo.
Diffstat (limited to 'common')
-rw-r--r--common/callback.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/callback.h b/common/callback.h
index 2101331bf0..4356e4b551 100644
--- a/common/callback.h
+++ b/common/callback.h
@@ -48,21 +48,21 @@ public:
};
/**
-* GlobalFunctionCallback is a simple wrapper for global C functions.
+* GlobalFunctionCallback<T> is a simple wrapper for global C functions.
*
-* If there is a method, which accepts BaseCallback<void *>, you can
+* If there is a method, which accepts BaseCallback<T>, you can
* easily pass your C function by passing
-* new GlobalFunctionCallback(yourFunction)
+* new GlobalFunctionCallback<T>(yourFunction)
*/
-class GlobalFunctionCallback: public BaseCallback<void *> {
- typedef void(*GlobalFunction)(void *result);
+template<typename T> class GlobalFunctionCallback: public BaseCallback<T> {
+ typedef void(*GlobalFunction)(T result);
GlobalFunction _callback;
public:
GlobalFunctionCallback(GlobalFunction cb): _callback(cb) {}
virtual ~GlobalFunctionCallback() {}
- virtual void operator()(void *data) {
+ virtual void operator()(T data) {
if (_callback) _callback(data);
}
};