2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Add reading of double options

This commit is contained in:
RadRussianRus
2020-08-10 00:49:25 +03:00
parent 92698b9f6b
commit 010b2faa08

View File

@@ -146,6 +146,17 @@ bool ReadStringOption(QJsonObject obj, QString key, std::function<void(QString)>
return (readValueResult && readResult);
}
bool ReadDoubleOption(QJsonObject obj, QString key, std::function<void(double)> callback) {
auto readResult = false;
auto readValueResult = ReadOption(obj, key, [&](QJsonValue v) {
if (v.isDouble()) {
callback(v.toDouble());
readResult = true;
}
});
return (readValueResult && readResult);
}
bool ReadIntOption(QJsonObject obj, QString key, std::function<void(int)> callback) {
auto readResult = false;
auto readValueResult = ReadOption(obj, key, [&](QJsonValue v) {