summaryrefslogtreecommitdiffstats
path: root/src/ClonkInterface.cpp
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2017-03-21 22:00:59 +0100
committerMarkus Mittendrein <git@maxmitti.tk>2017-04-06 12:00:13 +0200
commit3fe710cb029522b86ef27c322f0cb793b1368051 (patch)
treea927da96f3851f68e2b16d40f2d20b73d67cce1d /src/ClonkInterface.cpp
parente56c72bf1a0edda6deb3da548923939a88fd930b (diff)
downloadmanager-3fe710cb029522b86ef27c322f0cb793b1368051.tar.gz
manager-3fe710cb029522b86ef27c322f0cb793b1368051.zip
Move Parser into own class
Diffstat (limited to 'src/ClonkInterface.cpp')
-rw-r--r--src/ClonkInterface.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/ClonkInterface.cpp b/src/ClonkInterface.cpp
new file mode 100644
index 0000000..8d6ab98
--- /dev/null
+++ b/src/ClonkInterface.cpp
@@ -0,0 +1,95 @@
+#include "ClonkInterface.hpp"
+
+
+ClonkOutputInterface::~ClonkOutputInterface() { }
+
+void ClonkOutputInterface::raw(const QString &msg) { Q_UNUSED(msg); }
+
+void ClonkOutputInterface::rawTimed(const QString &msg, const QTime &time) { Q_UNUSED(msg); Q_UNUSED(time); }
+
+void ClonkOutputInterface::lobbyCountdown(unsigned int seconds) { Q_UNUSED(seconds); }
+
+void ClonkOutputInterface::lobbyCountdownAborted() {}
+
+void ClonkOutputInterface::playerRemoved(const QString &name) { Q_UNUSED(name); }
+
+void ClonkOutputInterface::playerJoined(const ClientInfo &client, const QString &name) { Q_UNUSED(client); Q_UNUSED(name); }
+
+void ClonkOutputInterface::watchdog(const QString &id) { Q_UNUSED(id); }
+
+void ClonkOutputInterface::clientMessage(ClientInfo &client, const QString &message, ClonkOutputInterface::MessageType type, const QTime &time) { Q_UNUSED(client); Q_UNUSED(message); Q_UNUSED(type); Q_UNUSED(time); }
+
+void ClonkOutputInterface::clientConnected(const ClientInfo &client) { Q_UNUSED(client); }
+
+void ClonkOutputInterface::clientRemoved(const ClientInfo &client, const QString& reason) { Q_UNUSED(client); Q_UNUSED(reason); }
+
+void ClonkOutputInterface::clientStateChanged(const ClientInfo &client, bool activated) { Q_UNUSED(client); Q_UNUSED(activated); }
+
+void ClonkOutputInterface::gameLoading() {}
+
+void ClonkOutputInterface::gameStarted() {}
+
+void ClonkOutputInterface::masterserverError(const QString &msg) { Q_UNUSED(msg); }
+
+ClonkParser::ClonkParser(CRSMSession &session) : Session(session)
+{
+
+}
+
+ClonkParser::~ClonkParser()
+{
+
+}
+
+void ClonkParser::addTarget(ClonkOutputInterface *target)
+{
+ if(!targets.contains(target))
+ {
+ targets.push_back(target);
+ }
+}
+
+void ClonkParser::removeTarget(ClonkOutputInterface *target)
+{
+ targets.removeAll(target);
+}
+
+#define dispatch(x) for(auto target : targets)\
+{\
+ target->x;\
+}
+
+void ClonkParser::raw(const QString &msg) { dispatch(raw(msg)) }
+
+void ClonkParser::rawTimed(const QString &msg, const QTime &time) { dispatch(rawTimed(msg, time)) }
+
+void ClonkParser::lobbyCountdown(unsigned int seconds) { dispatch(lobbyCountdown(seconds)) }
+
+void ClonkParser::lobbyCountdownAborted() { dispatch(lobbyCountdownAborted()) }
+
+void ClonkParser::playerRemoved(const QString &name) { dispatch(playerRemoved(name)) }
+
+void ClonkParser::playerJoined(const ClientInfo &client, const QString &name) { dispatch(playerJoined(client, name)) }
+
+void ClonkParser::watchdog(const QString &id) { dispatch(watchdog(id)) }
+
+void ClonkParser::clientMessage(ClientInfo &client, const QString &message, ClonkOutputInterface::MessageType type, const QTime &time) { dispatch(clientMessage(client, message, type, time)) }
+
+void ClonkParser::clientConnected(const ClientInfo &client) { dispatch(clientConnected(client)) }
+
+void ClonkParser::clientRemoved(const ClientInfo &client, const QString& reason) { dispatch(clientRemoved(client, reason)) }
+
+void ClonkParser::clientStateChanged(const ClientInfo &client, bool activated) { dispatch(clientStateChanged(client, activated)) }
+
+void ClonkParser::gameLoading() { dispatch(gameLoading()) }
+
+void ClonkParser::gameStarted() { dispatch(gameStarted()) }
+
+void ClonkParser::masterserverError(const QString &msg) { dispatch(masterserverError(msg)) }
+
+#undef dispatch
+
+ClonkControllerInterface::~ClonkControllerInterface()
+{
+
+}