blob: a480ec8104f9d38671b740cfd0b4aade5b54656c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#pragma once
#include "libcommon/string.h"
#include <functional>
#include <string>
#include <unordered_map>
class SubcommandDispatcher
{
typedef std::function<void(const common::string::KeyValuePairs &)> Handler;
public:
void addSubcommand(const std::wstring &command, Handler handler);
void dispatch(const std::wstring &command, const std::vector<std::wstring> &arguments);
private:
std::unordered_map<std::wstring, Handler> m_commands;
};
|