mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-02 23:55:12 +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);
|
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) {
|
bool ReadIntOption(QJsonObject obj, QString key, std::function<void(int)> callback) {
|
||||||
auto readResult = false;
|
auto readResult = false;
|
||||||
auto readValueResult = ReadOption(obj, key, [&](QJsonValue v) {
|
auto readValueResult = ReadOption(obj, key, [&](QJsonValue v) {
|
||||||
|
Reference in New Issue
Block a user