summaryrefslogtreecommitdiffstats
path: root/logic/MMCJson.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-05-11 12:37:21 +0200
committerPetr Mrázek <peterix@gmail.com>2014-06-09 01:38:30 +0200
commit69c3e7111f93290d1278d6116e9fd50079b4fe79 (patch)
treecbaed3022e8705f1da29777afea0fca16c1abe60 /logic/MMCJson.h
parent92abe4c603e1f4931cd02ae6b752cb7054d8e30d (diff)
downloadMultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.tar
MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.tar.gz
MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.tar.lz
MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.tar.xz
MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.zip
Make 1.6+ work with new instance format.
Diffstat (limited to 'logic/MMCJson.h')
-rw-r--r--logic/MMCJson.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/logic/MMCJson.h b/logic/MMCJson.h
index 71ded435..8408f29b 100644
--- a/logic/MMCJson.h
+++ b/logic/MMCJson.h
@@ -43,4 +43,23 @@ int ensureInteger(const QJsonValue val, QString what = "value");
/// make sure the value is converted into a double precision floating number. throw otherwise.
double ensureDouble(const QJsonValue val, QString what = "value");
+
+void writeString(QJsonObject & to, QString key, QString value);
+
+void writeStringList (QJsonObject & to, QString key, QStringList values);
+
+template <typename T>
+void writeObjectList (QJsonObject & to, QString key, QList<T> values)
+{
+ if(values.size())
+ {
+ QJsonArray array;
+ for(auto value: values)
+ {
+ array.append(value->toJson());
+ }
+ to.insert(key, array);
+ }
+}
}
+