diff options
author | Johannes Schickel | 2008-04-20 15:47:11 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-20 15:47:11 +0000 |
commit | f173041811398817ffce870d30ef3b87d1302736 (patch) | |
tree | 78e43d204662641a5d687cbc184ac60913ac870d /gui/debugger.h | |
parent | 38319954d1035a7ec8df335c88d455a4042a94fc (diff) | |
download | scummvm-rg350-f173041811398817ffce870d30ef3b87d1302736.tar.gz scummvm-rg350-f173041811398817ffce870d30ef3b87d1302736.tar.bz2 scummvm-rg350-f173041811398817ffce870d30ef3b87d1302736.zip |
- moved kyra functor code to common/func.h
- adapted debugger code to use functor code from common/func.h
- adapted kyra engine to use functor code from common/func.h
svn-id: r31614
Diffstat (limited to 'gui/debugger.h')
-rw-r--r-- | gui/debugger.h | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/gui/debugger.h b/gui/debugger.h index ac6ae62e03..0e48f384de 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -25,6 +25,8 @@ #ifndef GUI_DEBUGGER_H #define GUI_DEBUGGER_H +#include "common/func.h" + namespace GUI { // Choose between text console or ScummConsole @@ -47,32 +49,12 @@ public: bool isAttached() const { return _isAttached; } protected: - class Debuglet { - public: - virtual ~Debuglet() {} - virtual bool operator()(int argc, const char **argv) = 0; - }; - - template <class T> - class DelegateDebuglet : public Debuglet { - typedef bool (T::*Method)(int argc, const char **argv); - - T *_delegate; - const Method _method; - public: - DelegateDebuglet(T *delegate, Method method) - : _delegate(delegate), _method(method) { - assert(delegate != 0); - } - virtual bool operator()(int argc, const char **argv) { - return (_delegate->*_method)(argc, argv); - }; - }; + typedef Common::Functor2<int, const char **, bool> Debuglet; // Convenicence macro for registering a method of a debugger class // as the current command. #define WRAP_METHOD(cls, method) \ - new DelegateDebuglet<cls>(this, &cls::method) + new Common::Functor2Mem<int, const char **, bool, cls>(this, &cls::method) enum { DVAR_BYTE, |