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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user