3 This file is part of gldbg
4 Copyright © 2009 Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
8 #ifndef COMMANDINTERPRETER_H_
9 #define COMMANDINTERPRETER_H_
16 class CommandInterpreter
22 std::string description;
29 void set_help(const std::string &);
30 void set_help(const std::string &, const std::string &);
31 const std::string &get_description() const { return description; }
32 const std::string &get_help() const { return help; }
34 virtual void execute(const std::string &) = 0;
39 class CommandFunction: public Command
42 typedef void (T::*Func)(const std::string &);
47 CommandFunction(T *o, Func f): obj(o), func(f) { }
49 virtual void execute(const std::string &a)
53 class CommandAlias: public Command
59 CommandAlias(Command *);
61 const Command *get_target() const { return target; }
63 virtual void execute(const std::string &);
66 typedef std::map<std::string, Command *> CommandMap;
72 CommandInterpreter(GlDbg &);
75 Command ®ister_command(const std::string &n, T *o, void (T::*f)(const std::string &))
76 { return *(commands[n] = new CommandFunction<T>(o, f)); }
78 void execute(const std::string &);
81 void cmd_help(const std::string &);
82 void cmd_run(const std::string &);
83 void cmd_continue(const std::string &);
84 void cmd_signal(const std::string &);
85 void cmd_kill(const std::string &);
86 void cmd_exit(const std::string &);
87 void cmd_trace(const std::string &);
88 void cmd_profile(const std::string &);
89 void cmd_state(const std::string &);
90 void cmd_texture(const std::string &);
91 void cmd_buffer(const std::string &);