refs #815 Throw CJsonException when required JSON objects are not found.

This commit is contained in:
Mathew Sutcliffe
2016-12-18 04:44:25 +00:00
parent 7c5c9d30e6
commit bbdbd26f82
10 changed files with 112 additions and 40 deletions

View File

@@ -35,9 +35,11 @@ namespace BlackMisc
clear();
for (auto it = json.begin(); it != json.end(); ++it)
{
const QString key = it.key();
CJsonScope scope(key);
CVariant value;
value.convertFromJson(it.value().toObject());
implementationOf(*this).insert(cend(), it.key(), value);
implementationOf(*this).insert(cend(), key, value);
}
}
@@ -48,6 +50,7 @@ namespace BlackMisc
{
auto value = json.value(key);
if (value.isUndefined()) { continue; }
CJsonScope scope(key);
CVariant var;
var.convertFromJson(value.toObject());
insert(key, var);
@@ -75,9 +78,11 @@ namespace BlackMisc
clear();
for (auto it = json.begin(); it != json.end(); ++it)
{
const QString key = it.key();
CJsonScope scope(key);
CVariant value;
value.convertFromMemoizedJson(it.value().toObject());
implementationOf(*this).insert(cend(), it.key(), value);
implementationOf(*this).insert(cend(), key, value);
}
}
@@ -88,6 +93,7 @@ namespace BlackMisc
{
auto value = json.value(key);
if (value.isUndefined()) { continue; }
CJsonScope scope(key);
CVariant var;
var.convertFromMemoizedJson(value.toObject());
insert(key, var);