Changed to std::function in DebuggerParser.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3079 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-17 00:08:23 +00:00
parent a6eded9c65
commit 021e0caa55
2 changed files with 4 additions and 10 deletions

View File

@ -48,9 +48,6 @@ using namespace Common;
#include "DebuggerParser.hxx" #include "DebuggerParser.hxx"
// Call the pointed-to method on the this object. Whew.
#define CALL_METHOD(method) ( (this->*method)() )
// TODO - use C++ streams instead of nasty C-strings and pointers // TODO - use C++ streams instead of nasty C-strings and pointers
@ -114,7 +111,7 @@ string DebuggerParser::run(const string& command)
if(BSPF_equalsIgnoreCase(verb, commands[i].cmdString)) if(BSPF_equalsIgnoreCase(verb, commands[i].cmdString))
{ {
if(validateArgs(i)) if(validateArgs(i))
CALL_METHOD(commands[i].executor); commands[i].executor(this);
if(commands[i].refreshRequired) if(commands[i].refreshRequired)
debugger.myBaseDialog->loadConfig(); debugger.myBaseDialog->loadConfig();

View File

@ -20,6 +20,7 @@
#ifndef DEBUGGER_PARSER_HXX #ifndef DEBUGGER_PARSER_HXX
#define DEBUGGER_PARSER_HXX #define DEBUGGER_PARSER_HXX
#include <functional>
#include <sstream> #include <sstream>
class Debugger; class Debugger;
@ -71,7 +72,6 @@ class DebuggerParser
private: private:
enum { enum {
kNumCommands = 70, kNumCommands = 70,
kMAX_ARG_TYPES = 10
}; };
// Constants for argument processing // Constants for argument processing
@ -94,16 +94,13 @@ class DebuggerParser
kARG_END_ARGS // sentinel, occurs at end of list kARG_END_ARGS // sentinel, occurs at end of list
}; };
// Pointer to DebuggerParser instance method, no args, returns void.
typedef void (DebuggerParser::*METHOD)();
struct Command { struct Command {
string cmdString; string cmdString;
string description; string description;
bool parmsRequired; bool parmsRequired;
bool refreshRequired; bool refreshRequired;
parameters parms[kMAX_ARG_TYPES]; parameters parms[10];
METHOD executor; std::function<void(DebuggerParser*)> executor;
}; };
// Reference to our debugger object // Reference to our debugger object