teditor
1.8.0@@fee5e94
Terminal based editor written in C++
|
Go to the documentation of this file.
21 KeyCmdMap(): key2cmd(), cmd2key(), keyTree(), currNode(nullptr) {}
22 void add(
char key,
const std::string& cmd);
23 void add(
const std::string& keySeq,
const std::string& cmd);
27 const std::string
getCmd()
const;
29 void eraseKey(
const std::string& key);
32 std::unordered_map<std::string, std::string> key2cmd, cmd2key;
38 template <
typename Keys>
40 if(clear) kcm.
clear();
41 for(
auto& kc : Keys::All) {
42 if (kc.cmd.empty()) kcm.
eraseKey(kc.keySeq);
TrieStatus
Definition: key_cmd_map.h:7
void eraseKey(const std::string &key)
Definition: key_cmd_map.cpp:31
Node * getRoot()
Definition: trie.h:35
std::string keySeq
Definition: key_cmd_map.h:15
TrieStatus traverse(const std::string &currKey)
Definition: key_cmd_map.cpp:18
const std::string & data()
Definition: trie.h:19
KeyCmdMap()
Definition: key_cmd_map.h:21
Definition: key_cmd_map.h:19
void clear()
Definition: key_cmd_map.cpp:44
void resetTraversal()
Definition: key_cmd_map.h:26
@ TS_NULL
Definition: key_cmd_map.h:8
const std::string getCmd() const
Definition: key_cmd_map.cpp:26
void add(const std::string &keys, const std::string &str)
Definition: trie.cpp:59
@ TS_NON_LEAF
Definition: key_cmd_map.h:9
Node * getNode(const std::string &key)
Definition: trie.cpp:24
void add(char key, const std::string &cmd)
Definition: key_cmd_map.cpp:6
void populateKeyMap(KeyCmdMap &kcm, bool clear=false)
Definition: key_cmd_map.h:39
void clear()
Definition: trie.h:36
void add(const KeyCmdPair &pair)
Definition: key_cmd_map.h:24
Definition: key_cmd_map.h:14
@ TS_LEAF
Definition: key_cmd_map.h:10
std::string cmd
Definition: key_cmd_map.h:15
void del(const std::string &keys)
Definition: trie.cpp:73
bool leaf() const
Definition: trie.h:18