mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
very dirty metacompiler for protocol information code
This commit is contained in:
parent
dbd3af8265
commit
b0841dd6e8
7 changed files with 163 additions and 103 deletions
|
|
@ -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)();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue