mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #345 Second wave of value classes using the CValueObjectStdTuple CRTP class template, with inheritance.
This commit is contained in:
@@ -46,83 +46,6 @@ namespace BlackMisc
|
||||
CModulator::setFrequencyStandby(f);
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall
|
||||
*/
|
||||
void CComSystem::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
CModulator::marshallToDbus(argument);
|
||||
argument << TupleConverter<CComSystem>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall
|
||||
*/
|
||||
void CComSystem::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
CModulator::unmarshallFromDbus(argument);
|
||||
argument >> TupleConverter<CComSystem>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash
|
||||
*/
|
||||
uint CComSystem::getValueHash() const
|
||||
{
|
||||
QList<uint> hashs;
|
||||
hashs << CModulator::getValueHash();
|
||||
hashs << qHash(TupleConverter<CComSystem>::toTuple(*this));
|
||||
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::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
CModulator::convertFromJson(json);
|
||||
BlackMisc::deserializeJson(json, CComSystem::jsonMembers(), TupleConverter<CComSystem>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CComSystem::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CComSystem>::jsonMembers();
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
int CComSystem::compareImpl(const CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CComSystem &>(otherBase);
|
||||
int result = compare(TupleConverter<CComSystem>::toTuple(*this), TupleConverter<CComSystem>::toTuple(other));
|
||||
return result == 0 ? CModulator::compareImpl(otherBase) : result;
|
||||
}
|
||||
|
||||
bool CComSystem::operator ==(const CComSystem &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
if (!CModulator::operator ==(other)) return false;
|
||||
return TupleConverter<CComSystem>::toTuple(*this) == TupleConverter<CComSystem>::toTuple(other);
|
||||
}
|
||||
|
||||
bool CComSystem::operator !=(const CComSystem &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Round to channel spacing
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user