blob: bf711c1fc30e0a511c282284ff6f472b0c796004 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "JarMod.h"
#include "MMCJson.h"
using namespace MMCJson;
JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename, const QString &originalName)
{
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();
out->originalName = libObj.value("originalName").toString();
return out;
}
QJsonObject Jarmod::toJson()
{
QJsonObject out;
writeString(out, "name", name);
if(!originalName.isEmpty())
{
writeString(out, "originalName", originalName);
}
return out;
}
|