Add reading of double options
This commit is contained in:
parent
92698b9f6b
commit
010b2faa08
1 changed files with 11 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue