From fbe3c5fbe1327fd81e2eb8fe30a75c4cf5d7b35c Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Sun, 4 Jan 2015 13:57:11 +0100 Subject: Cleanup completed. New Interface based system. --- CmdFunctionRef.hpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 CmdFunctionRef.hpp (limited to 'CmdFunctionRef.hpp') diff --git a/CmdFunctionRef.hpp b/CmdFunctionRef.hpp new file mode 100644 index 0000000..586090a --- /dev/null +++ b/CmdFunctionRef.hpp @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include + +class CRSM; + +#define CMD_FUNCTION(name) void name(const QString& cmd, const QString& args, const ClientInfo& client, UserType userTypeModerator) +#define CMD_FUNCTION_IMPL(name) void CRSM::name(const QString& cmd, const QString& args, const ClientInfo& client, UserType userType) + +enum UserType { + User = 0, + Admin = 1, + Moderator = 2 +}; + +typedef void (CRSM::*CmdFunction)(const QString&, const QString&, const ClientInfo&, UserType); + +const QMap 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() + { + + } +}; -- cgit v1.2.3-54-g00ecf