mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
Use nested namespaces (C++17 feature)
This commit is contained in:
@@ -13,37 +13,34 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackMisc
|
||||
namespace BlackMisc::Weather
|
||||
{
|
||||
namespace Weather
|
||||
CWeatherDataPluginInfo::CWeatherDataPluginInfo(const QString &identifier, const QString &name, const QString &description, bool valid) :
|
||||
m_identifier(identifier), m_name(name), m_description(description), m_valid(valid)
|
||||
{ }
|
||||
|
||||
void CWeatherDataPluginInfo::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
CWeatherDataPluginInfo::CWeatherDataPluginInfo(const QString &identifier, const QString &name, const QString &description, bool valid) :
|
||||
m_identifier(identifier), m_name(name), m_description(description), m_valid(valid)
|
||||
{ }
|
||||
|
||||
void CWeatherDataPluginInfo::convertFromJson(const QJsonObject &json)
|
||||
if (json.contains("IID")) // comes from the plugin
|
||||
{
|
||||
if (json.contains("IID")) // comes from the plugin
|
||||
{
|
||||
if (! json.contains("MetaData")) { throw CJsonException("Missing 'MetaData'"); }
|
||||
if (! json.contains("MetaData")) { throw CJsonException("Missing 'MetaData'"); }
|
||||
|
||||
// json data is already validated by CPluginManagerWeatherData
|
||||
CJsonScope scope("MetaData"); // for stack trace
|
||||
Q_UNUSED(scope);
|
||||
CValueObject::convertFromJson(json["MetaData"].toObject());
|
||||
m_valid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CValueObject::convertFromJson(json);
|
||||
}
|
||||
// json data is already validated by CPluginManagerWeatherData
|
||||
CJsonScope scope("MetaData"); // for stack trace
|
||||
Q_UNUSED(scope);
|
||||
CValueObject::convertFromJson(json["MetaData"].toObject());
|
||||
m_valid = true;
|
||||
}
|
||||
|
||||
QString CWeatherDataPluginInfo::convertToQString(bool i18n) const
|
||||
else
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return QStringLiteral("%1 (%2)").arg(m_name, m_identifier);
|
||||
CValueObject::convertFromJson(json);
|
||||
}
|
||||
}
|
||||
|
||||
QString CWeatherDataPluginInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return QStringLiteral("%1 (%2)").arg(m_name, m_identifier);
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user