]> git.tdb.fi Git - gldbg.git/blob - source/commandinterpreter.h
Add help
[gldbg.git] / source / commandinterpreter.h
1 /* $Id$
2
3 This file is part of gldbg
4 Copyright © 2009  Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
6 */
7
8 #ifndef COMMANDINTERPRETER_H_
9 #define COMMANDINTERPRETER_H_
10
11 #include <map>
12 #include <string>
13
14 class GlDbg;
15
16 class CommandInterpreter
17 {
18 private:
19         struct Command
20         {
21                 typedef void (CommandInterpreter::*Func)(const std::string &);
22
23                 Func func;
24                 std::string description;
25                 std::string help;
26
27                 Command();
28                 Command(Func, const std::string &);
29                 Command(Func, const std::string &, const std::string &);
30         };
31
32         typedef std::map<std::string, Command> CommandMap;
33
34         GlDbg &gldbg;
35         CommandMap commands;
36
37 public:
38         CommandInterpreter(GlDbg &);
39         void execute(const std::string &);
40
41 private:
42         void cmd_help(const std::string &);
43         void cmd_run(const std::string &);
44         void cmd_continue(const std::string &);
45         void cmd_signal(const std::string &);
46         void cmd_kill(const std::string &);
47         void cmd_exit(const std::string &);
48         void cmd_trace(const std::string &);
49 };
50
51 #endif