Make 1.6+ work with new instance format.

This commit is contained in:
Petr Mrázek
2014-05-11 12:37:21 +02:00
parent 92abe4c603
commit 69c3e7111f
29 changed files with 951 additions and 562 deletions

View File

@ -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);
}
}
}