mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
refs #192, enable value objects for JSON:
* from/toJson methods * jsonMembers where applicable
This commit is contained in:
@@ -85,6 +85,32 @@ namespace BlackMisc
|
||||
return BlackMisc::calculateHash(hashs, "CComSystem");
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
QJsonObject CComSystem::toJson() const
|
||||
{
|
||||
QJsonObject json = BlackMisc::serializeJson(CComSystem::jsonMembers(), TupleConverter<CComSystem>::toTuple(*this));
|
||||
return BlackMisc::Json::appendJsonObject(json, CModulator::toJson());
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
void CComSystem::fromJson(const QJsonObject &json)
|
||||
{
|
||||
CModulator::fromJson(json);
|
||||
BlackMisc::deserializeJson(json, CComSystem::jsonMembers(), TupleConverter<CComSystem>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CComSystem::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CComSystem>::jsonMembers();
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
@@ -149,5 +175,6 @@ namespace BlackMisc
|
||||
default: qFatal("Wrong channel spacing"); return 0.0; // return just supressing compiler warning
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user