diff options
Diffstat (limited to 'server/src/util/commands.h')
| -rw-r--r-- | server/src/util/commands.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/server/src/util/commands.h b/server/src/util/commands.h index 1e5ae0f..547a78c 100644 --- a/server/src/util/commands.h +++ b/server/src/util/commands.h @@ -1,21 +1,19 @@ #pragma once class commands { - using func = std::function<void()>; - std::unordered_map<std::string_view, func> m_cmds; + using func = std::function<void()>; + std::unordered_map<std::string_view, func> m_cmds; - public: - bool parse_input(const std::string_view str) { - auto it = m_cmds.find(str); - if (it != m_cmds.end()) { - it->second(); - return true; +public: + bool parse_input(const std::string_view str) + { + auto it = m_cmds.find(str); + if(it != m_cmds.end()) { + it->second(); + return true; + } + return false; } - return false; - } - void add(const std::string_view cmd, const func &cb) { - - m_cmds[cmd] = cb; - } + void add(const std::string_view cmd, const func& cb) { m_cmds[cmd] = cb; } }; |