pollymc/logic/minecraft/JarMod.cpp

23 lines
478 B
C++
Raw Normal View History

#include "JarMod.h"
2015-02-09 06:21:14 +05:30
#include "MMCJson.h"
using namespace MMCJson;
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;
}
QJsonObject Jarmod::toJson()
{
QJsonObject out;
writeString(out, "name", name);
return out;
}