]> git.tdb.fi Git - gldbg.git/blob - source/commandinterpreter.h
537245fb53c1a0f38bea5b0a652f490e97fa64cf
[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                 Command *alias_for;
27
28                 Command();
29                 Command(Command *);
30                 Command(Func, const std::string &);
31                 Command(Func, const std::string &, const std::string &);
32         };
33
34         typedef std::map<std::string, Command> CommandMap;
35
36         GlDbg &gldbg;
37         CommandMap commands;
38
39 public:
40         CommandInterpreter(GlDbg &);
41         void execute(const std::string &);
42
43 private:
44         void cmd_help(const std::string &);
45         void cmd_run(const std::string &);
46         void cmd_continue(const std::string &);
47         void cmd_signal(const std::string &);
48         void cmd_kill(const std::string &);
49         void cmd_exit(const std::string &);
50         void cmd_trace(const std::string &);
51         void cmd_profile(const std::string &);
52         void cmd_state(const std::string &);
53         void cmd_texture(const std::string &);
54         void cmd_buffer(const std::string &);
55 };
56
57 #endif