summaryrefslogtreecommitdiff
path: root/src/command_manager.hh
diff options
context:
space:
mode:
authorJustin Frank <justinpfrank@protonmail.com>2019-03-12 10:34:30 -0700
committerJustin Frank <justinpfrank@protonmail.com>2019-04-08 17:02:44 -0700
commit6092852640096c777f700cf669666504b10e2a58 (patch)
tree4d609cd77a8363c10e7286a6a46bf7a3aa251a26 /src/command_manager.hh
parent670f8192c8d68c33e42b95847edd0678f87ca39b (diff)
Added 'provide-module' and 'require-module' commands
Diffstat (limited to 'src/command_manager.hh')
-rw-r--r--src/command_manager.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/command_manager.hh b/src/command_manager.hh
index 0468a1fc..329c24f2 100644
--- a/src/command_manager.hh
+++ b/src/command_manager.hh
@@ -123,6 +123,12 @@ public:
void clear_last_complete_command() { m_last_complete_command = String{}; }
+ bool module_defined(StringView module_name) const;
+
+ void register_module(String module_name, String commands);
+
+ void load_module(StringView module_name, Context& context);
+
private:
void execute_single_command(CommandParameters params,
Context& context,
@@ -143,6 +149,14 @@ private:
String m_last_complete_command;
int m_command_depth = 0;
+ struct Module
+ {
+ bool loaded;
+ String commands;
+ };
+ using ModuleMap = HashMap<String, Module, MemoryDomain::Commands>;
+ ModuleMap m_modules;
+
CommandMap::const_iterator find_command(const Context& context,
StringView name) const;
};