Based on discussion around T107 and slack

* Use CJsonScope scope("MetaData") for stacktrace
* added Q_UNUSED(scope) to avoid QtC warnings
This commit is contained in:
Klaus Basan
2017-07-14 15:13:57 +02:00
committed by Mathew Sutcliffe
parent c4db854fad
commit 94c9886c35
8 changed files with 21 additions and 3 deletions

View File

@@ -69,6 +69,7 @@ namespace BlackMisc
CAircraftEngine engine;
int number = e.toInt();
CJsonScope scope(e);
Q_UNUSED(scope);
engine.convertFromJson(json.value(e).toObject());
engine.setNumber(number);
push_back(engine);

View File

@@ -129,6 +129,7 @@ namespace BlackMisc
for (auto i = array.begin(); i != array.end(); ++i)
{
CJsonScope scope("containerbase", index++);
Q_UNUSED(scope);
QJsonValueRef ref = (*i);
T val;
ref >> val;

View File

@@ -273,10 +273,12 @@ namespace BlackMisc
Value val;
{
CJsonScope scope("associativecontainerbase", 2 * index);
Q_UNUSED(scope);
jsonKey >> key;
}
{
CJsonScope scope("associativecontainerbase", 2 * index++ + 1);
Q_UNUSED(scope);
jsonValue >> val;
}
m_impl.insert(std::move(key), std::move(val));

View File

@@ -379,6 +379,7 @@ namespace BlackMisc
else
{
CJsonScope scope(member.latin1Name());
Q_UNUSED(scope);
value >> member.in(*this->derived());
}
});

View File

@@ -749,14 +749,17 @@ namespace BlackMisc
if (distributors.isUndefined()) { throw CJsonException("Missing 'distributors'"); }
{
CJsonScope scope("aircraftIcaos");
Q_UNUSED(scope);
helper.getTable<CAircraftIcaoCode>().convertFromJson(aircraftIcaos.toObject());
}
{
CJsonScope scope("liveries");
Q_UNUSED(scope);
helper.getTable<CLivery>().convertFromJson(liveries.toObject());
}
{
CJsonScope scope("distributors");
Q_UNUSED(scope);
helper.getTable<CDistributor>().convertFromJson(distributors.toObject());
}
@@ -764,6 +767,7 @@ namespace BlackMisc
for (auto i = array.begin(); i != array.end(); ++i)
{
CJsonScope scope("containerbase", index++);
Q_UNUSED(scope);
CAircraftModel value;
value.convertFromMemoizedJson(i->toObject(), helper);
insert(value);

View File

@@ -29,8 +29,8 @@ namespace BlackMisc
if (! json.contains("MetaData")) { throw CJsonException("Missing 'MetaData'"); }
// json data is already validated by CPluginManagerSimulator
//! \todo for RW See T107, remove, change code?
// CJsonScope scope("MetaData");
CJsonScope scope("MetaData");
Q_UNUSED(scope);
CValueObject::convertFromJson(json["MetaData"].toObject());
m_valid = true;
}

View File

@@ -39,6 +39,7 @@ namespace BlackMisc
{
const QString key = it.key();
CJsonScope scope(key);
Q_UNUSED(scope);
CVariant value;
value.convertFromJson(it.value().toObject());
implementationOf(*this).insert(cend(), key, value);
@@ -53,6 +54,7 @@ namespace BlackMisc
auto value = json.value(key);
if (value.isUndefined()) { continue; }
CJsonScope scope(key);
Q_UNUSED(scope);
CVariant var;
var.convertFromJson(value.toObject());
insert(key, var);
@@ -82,6 +84,7 @@ namespace BlackMisc
{
const QString key = it.key();
CJsonScope scope(key);
Q_UNUSED(scope);
CVariant value;
value.convertFromMemoizedJson(it.value().toObject());
implementationOf(*this).insert(cend(), key, value);
@@ -96,6 +99,7 @@ namespace BlackMisc
auto value = json.value(key);
if (value.isUndefined()) { continue; }
CJsonScope scope(key);
Q_UNUSED(scope);
CVariant var;
var.convertFromMemoizedJson(value.toObject());
insert(key, var);
@@ -110,6 +114,7 @@ namespace BlackMisc
{
const QString key = it.key();
CJsonScope scope(key);
Q_UNUSED(scope);
CVariant value;
auto message = value.convertFromJsonNoThrow(it.value().toObject(), categories, prefix);
if (message.isSuccess()) { implementationOf(*this).insert(cend(), key, value); }
@@ -127,6 +132,7 @@ namespace BlackMisc
auto value = json.value(key);
if (value.isUndefined()) { continue; }
CJsonScope scope(key);
Q_UNUSED(scope);
CVariant var;
auto message = var.convertFromJsonNoThrow(value.toObject(), categories, prefix);
if (message.isSuccess()) { insert(key, var); }
@@ -143,6 +149,7 @@ namespace BlackMisc
{
const QString key = it.key();
CJsonScope scope(key);
Q_UNUSED(scope);
CVariant value;
auto message = value.convertFromMemoizedJsonNoThrow(it.value().toObject(), categories, prefix);
if (message.isSuccess()) { implementationOf(*this).insert(cend(), key, value); }
@@ -160,6 +167,7 @@ namespace BlackMisc
auto value = json.value(key);
if (value.isUndefined()) { continue; }
CJsonScope scope(key);
Q_UNUSED(scope);
CVariant var;
auto message = var.convertFromMemoizedJsonNoThrow(value.toObject(), categories, prefix);
if (message.isSuccess()) { insert(key, var); }

View File

@@ -29,7 +29,8 @@ namespace BlackMisc
if (! json.contains("MetaData")) { throw CJsonException("Missing 'MetaData'"); }
// json data is already validated by CPluginManagerWeatherData
CJsonScope scope("MetaData");
CJsonScope scope("MetaData"); // for stack trace
Q_UNUSED(scope);
CValueObject::convertFromJson(json["MetaData"].toObject());
m_valid = true;
}