2014-05-09 16:16:25 +01:00
|
|
|
#include "JarMod.h"
|
|
|
|
#include "logic/MMCJson.h"
|
2014-05-11 11:37:21 +01:00
|
|
|
using namespace MMCJson;
|
2014-05-09 16:16:25 +01:00
|
|
|
|
|
|
|
JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename)
|
|
|
|
{
|
|
|
|
JarmodPtr out(new Jarmod());
|
|
|
|
if (!libObj.contains("name"))
|
|
|
|
{
|
|
|
|
throw JSONValidationError(filename +
|
|
|
|
"contains a jarmod that doesn't have a 'name' field");
|
|
|
|
}
|
|
|
|
out->name = libObj.value("name").toString();
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2014-05-11 11:37:21 +01:00
|
|
|
QJsonObject Jarmod::toJson()
|
|
|
|
{
|
|
|
|
QJsonObject out;
|
|
|
|
writeString(out, "name", name);
|
|
|
|
return out;
|
|
|
|
}
|