Make cmd::Command::name const

Originally committed to SVN as r5769.
This commit is contained in:
Thomas Goyne 2011-10-24 20:17:57 +00:00
parent 4e1e68c88b
commit 7f7aba1bcf
3 changed files with 4 additions and 4 deletions

View file

@ -257,7 +257,7 @@ namespace Automation4 {
public:
~LuaCommand();
const char* name() { return cmd_name.c_str(); }
const char* name() const { return cmd_name.c_str(); }
wxString StrMenu(const agi::Context *) const { return display; }
wxString StrDisplay(const agi::Context *) const { return display; }
wxString StrHelp() const { return help; }

View file

@ -36,7 +36,7 @@ DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandNotFound, CommandError, "command/notfound
DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandIconNone, CommandError, "command/icon")
DEFINE_SIMPLE_EXCEPTION_NOINNER(CommandIconInvalid, CommandError, "command/icon/invalid")
#define CMD_NAME(a) const char* name() { return a; }
#define CMD_NAME(a) const char* name() const { return a; }
#define STR_MENU(a) wxString StrMenu(const agi::Context *) const { return a; }
#define STR_DISP(a) wxString StrDisplay(const agi::Context *) const { return a; }
#define STR_HELP(a) wxString StrHelp() const { return a; }
@ -86,7 +86,7 @@ namespace cmd {
class Command {
public:
/// Command name
virtual const char* name()=0;
virtual const char* name() const=0;
/// String for menu purposes including accelerators, but not hotkeys
virtual wxString StrMenu(const agi::Context *) const=0;
/// Plain string for display purposes; should normally be the same as StrMenu

View file

@ -124,7 +124,7 @@ class mru_wrapper : public T {
int id;
std::string full_name;
public:
const char *name() { return full_name.c_str(); }
const char *name() const { return full_name.c_str(); }
void operator()(agi::Context *c) {
T::operator()(c, id);
}