Bladeren bron

Parse HOTKEY in XML files

Conflicts:

	clish/shell/shell_xml.c
Serj Kalichev 13 jaren geleden
bovenliggende
commit
c9b71ddd06
1 gewijzigde bestanden met toevoegingen van 18 en 1 verwijderingen
  1. 18 1
      clish/shell/shell_tinyxml.cpp

+ 18 - 1
clish/shell/shell_tinyxml.cpp

@@ -39,7 +39,8 @@ static PROCESS_FN
 	process_namespace,
 	process_config,
 	process_var,
-	process_wdog;
+	process_wdog,
+	process_hotkey;
 
 static clish_xml_cb_t xml_elements[] = {
 	{"CLISH_MODULE", process_clish_module},
@@ -55,6 +56,7 @@ static clish_xml_cb_t xml_elements[] = {
 	{"CONFIG", process_config},
 	{"VAR", process_var},
 	{"WATCHDOG", process_wdog},
+	{"HOTKEY", process_hotkey},
 	{NULL, NULL}
 };
 
@@ -741,6 +743,21 @@ static void process_wdog(clish_shell_t *shell,
 	process_children(shell, element, cmd);
 }
 
+///////////////////////////////////////
+static void process_hotkey(clish_shell_t *shell,
+	TiXmlElement *element, void *parent)
+{
+	clish_view_t *v = (clish_view_t *)parent;
+
+	const char *key = element->Attribute("key");
+	const char *cmd = element->Attribute("cmd");
+
+	assert(key);
+	assert(cmd);
+
+	assert (!clish_view_insert_hotkey(v, key, cmd));
+}
+
 ///////////////////////////////////////
 int clish_shell_xml_read(clish_shell_t * shell, const char *filename)
 {