Add a function to get a list of all registered command names

Originally committed to SVN as r5792.
This commit is contained in:
Thomas Goyne 2011-10-28 20:40:20 +00:00
parent ffa622d698
commit cba0b1edb8
2 changed files with 11 additions and 0 deletions

View file

@ -64,6 +64,14 @@ namespace cmd {
}
}
std::vector<std::string> get_registered_commands() {
std::vector<std::string> ret;
ret.reserve(cmd_map.size());
for (iterator it = cmd_map.begin(); it != cmd_map.end(); ++it)
ret.push_back(it->first);
return ret;
}
// These forward declarations exist here since we don't want to expose
// them in a header, they're strictly internal-use.
void init_app();

View file

@ -153,6 +153,9 @@ namespace cmd {
/// @param Command object.
Command* get(std::string const& name);
/// Get a list of registered command names
std::vector<std::string> get_registered_commands();
/// Unregister and deletes all commands
void clear();
} // namespace cmd