refs #345 Third and final wave of value classes using the CValueObjectStdTuple CRTP class template, with policy classes.

This commit is contained in:
Mathew Sutcliffe
2014-11-08 00:17:13 +00:00
parent 2b9d4098d4
commit f219d290f1
48 changed files with 326 additions and 1389 deletions

View File

@@ -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
*/