mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
refs #345 Third and final wave of value classes using the CValueObjectStdTuple CRTP class template, with policy classes.
This commit is contained in:
@@ -30,108 +30,6 @@ namespace BlackMisc
|
||||
return s.arg(this->m_latitude.valueRoundedWithUnit(6, i18n)).arg(this->m_longitude.valueRoundedWithUnit(6, i18n)).arg(this->m_geodeticHeight.valueRoundedWithUnit(6, i18n));
|
||||
}
|
||||
|
||||
/*
|
||||
* metaTypeId
|
||||
*/
|
||||
int CCoordinateGeodetic::getMetaTypeId() const
|
||||
{
|
||||
return qMetaTypeId<CCoordinateGeodetic>();
|
||||
}
|
||||
|
||||
/*
|
||||
* is a
|
||||
*/
|
||||
bool CCoordinateGeodetic::isA(int metaTypeId) const
|
||||
{
|
||||
if (metaTypeId == qMetaTypeId<CCoordinateGeodetic>()) { return true; }
|
||||
|
||||
return this->CValueObject::isA(metaTypeId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
int CCoordinateGeodetic::compareImpl(const CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CCoordinateGeodetic &>(otherBase);
|
||||
|
||||
return compare(TupleConverter<CCoordinateGeodetic>::toTuple(*this), TupleConverter<CCoordinateGeodetic>::toTuple(other));
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall to Dbus
|
||||
*/
|
||||
void CCoordinateGeodetic::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
argument << TupleConverter<CCoordinateGeodetic>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall from Dbus
|
||||
*/
|
||||
void CCoordinateGeodetic::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
argument >> TupleConverter<CCoordinateGeodetic>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Same coordinate
|
||||
*/
|
||||
bool CCoordinateGeodetic::operator ==(const CCoordinateGeodetic &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return TupleConverter<CCoordinateGeodetic>::toTuple(*this) == TupleConverter<CCoordinateGeodetic>::toTuple(other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unequal?
|
||||
*/
|
||||
bool CCoordinateGeodetic::operator !=(const CCoordinateGeodetic &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CCoordinateGeodetic::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CCoordinateGeodetic>();
|
||||
qDBusRegisterMetaType<CCoordinateGeodetic>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash
|
||||
*/
|
||||
uint CCoordinateGeodetic::getValueHash() const
|
||||
{
|
||||
return qHash(TupleConverter<CCoordinateGeodetic>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
QJsonObject CCoordinateGeodetic::toJson() const
|
||||
{
|
||||
return BlackMisc::serializeJson(CCoordinateGeodetic::jsonMembers(), TupleConverter<CCoordinateGeodetic>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
void CCoordinateGeodetic::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
BlackMisc::deserializeJson(json, CCoordinateGeodetic::jsonMembers(), TupleConverter<CCoordinateGeodetic>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CCoordinateGeodetic::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CCoordinateGeodetic>::jsonMembers();
|
||||
}
|
||||
|
||||
/*
|
||||
* From WGS84 coordinates
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user