From cba0b1edb82adf487a40f1d7ba2f2fc65f93df92 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 28 Oct 2011 20:40:20 +0000 Subject: [PATCH] Add a function to get a list of all registered command names Originally committed to SVN as r5792. --- aegisub/src/command/command.cpp | 8 ++++++++ aegisub/src/command/command.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/aegisub/src/command/command.cpp b/aegisub/src/command/command.cpp index 86fce7993..e40d719e4 100644 --- a/aegisub/src/command/command.cpp +++ b/aegisub/src/command/command.cpp @@ -64,6 +64,14 @@ namespace cmd { } } + std::vector get_registered_commands() { + std::vector 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(); diff --git a/aegisub/src/command/command.h b/aegisub/src/command/command.h index 0d2ab0c6c..6a995fe88 100644 --- a/aegisub/src/command/command.h +++ b/aegisub/src/command/command.h @@ -153,6 +153,9 @@ namespace cmd { /// @param Command object. Command* get(std::string const& name); + /// Get a list of registered command names + std::vector get_registered_commands(); + /// Unregister and deletes all commands void clear(); } // namespace cmd