summaryrefslogtreecommitdiffstats
path: root/CmdFunctionRef.hpp
blob: f86282344bafc790da95d06b5799c106b6dd0eee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include <QString>
#include <QMap>
#include <ClientInfo.hpp>

class CRSM;

#define CMD_FUNCTION(name) void name(const QString& cmd, const QString& args, const ClientInfo& client, UserType userType)
#define CMD_FUNCTION_IMPL(name) void CRSM::name(const QString& cmd, const QString& args, const ClientInfo& client, UserType userType) { (void)cmd; (void)args; (void)client; (void)userType;

enum UserType {
    User = 0,
    Admin = 1,
    Moderator = 2,
    Max = Moderator
};

typedef void (CRSM::*CmdFunction)(const QString&, const QString&, const ClientInfo&, UserType);

const QMap<UserType, QString> userTypeStrings {
    {User, "Benutzer"},
    {Admin, "Rundenadmin oder Moderator"},
    {Moderator, "Moderator"}
};

struct CmdFunctionRef
{
    CmdFunction func = nullptr;
    int interfaces = Clonk | IRC;
    UserType userType = User;
    QString shortDescription = "";
    QString longDescription = "";
    QString name = "";
    QString argList = "";

    CmdFunctionRef(QString name, CmdFunction func, int interfaces, UserType userType, const QString& shortDescription = "", QString argList = "", const QString &longDescription = "") : func(func), interfaces(interfaces), userType(userType), shortDescription(shortDescription), longDescription(longDescription), name(name), argList(argList)
    {

    }

    CmdFunctionRef()
    {

    }
};