mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-22 07:10:25 -08:00
very dirty metacompiler for protocol information code
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
#include "protocol.h"
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QDebug>
|
||||
#include "protocol.h"
|
||||
#include "protocol_commands.h"
|
||||
|
||||
QHash<QString, Command::NewCommandFunction> Command::commandHash;
|
||||
|
||||
Command::Command(const QString &_cmdName)
|
||||
: cmdName(_cmdName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Command::validateParameters()
|
||||
{
|
||||
}
|
||||
|
||||
bool Command::read(QXmlStreamReader &xml)
|
||||
@@ -22,7 +20,7 @@ bool Command::read(QXmlStreamReader &xml)
|
||||
} else if (xml.isEndElement()) {
|
||||
qDebug() << "endElement: " << xml.name().toString();
|
||||
if (xml.name() == cmdName) {
|
||||
validateParameters();
|
||||
extractParameters();
|
||||
qDebug() << "FERTIG";
|
||||
deleteLater();
|
||||
return true;
|
||||
@@ -53,3 +51,10 @@ void Command::write(QXmlStreamWriter &xml)
|
||||
|
||||
xml.writeEndElement();
|
||||
}
|
||||
|
||||
Command *Command::getNewCommand(const QString &name)
|
||||
{
|
||||
if (!commandHash.contains(name))
|
||||
return 0;
|
||||
return commandHash.value(name)();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user