aboutsummaryrefslogtreecommitdiff
path: root/include/Command.hpp
blob: fe08664439ed374d15a132cb26395fe43cf13051 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once

#include <vector>
#include <string>
#include <functional>
#include <unordered_map>

namespace dchat
{
    using CommandHandlerFunc = std::function<void(const std::vector<std::string> &args)>;
    
    class Command
    {
    public:
        static bool add(const std::string &cmd, CommandHandlerFunc handlerFunc);
        static bool call(const std::string &cmd, const std::vector<std::string> &args);
        
        static const std::unordered_map<std::string, CommandHandlerFunc>& getCommands();
    };
}