mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
refs #345 First wave of value classes using the CValueObjectStdTuple CRTP class template.
This commit is contained in:
@@ -41,22 +41,6 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall to DBus
|
||||
*/
|
||||
void CAircraft::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
argument << TupleConverter<CAircraft>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall from DBus
|
||||
*/
|
||||
void CAircraft::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
argument >> TupleConverter<CAircraft>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Distance to plane
|
||||
*/
|
||||
@@ -142,58 +126,6 @@ namespace BlackMisc
|
||||
this->setTransponder(xpdr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Equal?
|
||||
*/
|
||||
bool CAircraft::operator ==(const CAircraft &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return TupleConverter<CAircraft>::toTuple(*this) == TupleConverter<CAircraft>::toTuple(other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unequal?
|
||||
*/
|
||||
bool CAircraft::operator !=(const CAircraft &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash
|
||||
*/
|
||||
uint CAircraft::getValueHash() const
|
||||
{
|
||||
return qHash(TupleConverter<CAircraft>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* metaTypeId
|
||||
*/
|
||||
int CAircraft::getMetaTypeId() const
|
||||
{
|
||||
return qMetaTypeId<CAircraft>();
|
||||
}
|
||||
|
||||
/*
|
||||
* is a
|
||||
*/
|
||||
bool CAircraft::isA(int metaTypeId) const
|
||||
{
|
||||
if (metaTypeId == qMetaTypeId<CAircraft>()) { return true; }
|
||||
|
||||
return this->CValueObject::isA(metaTypeId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
int CAircraft::compareImpl(const CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CAircraft &>(otherBase);
|
||||
return compare(TupleConverter<CAircraft>::toTuple(*this), TupleConverter<CAircraft>::toTuple(other));
|
||||
}
|
||||
|
||||
/*
|
||||
* Property by index
|
||||
*/
|
||||
@@ -269,38 +201,6 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CAircraft::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CAircraft>();
|
||||
qDBusRegisterMetaType<CAircraft>();
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
QJsonObject CAircraft::toJson() const
|
||||
{
|
||||
return BlackMisc::serializeJson(TupleConverter<CAircraft>::toMetaTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* From JSON
|
||||
*/
|
||||
void CAircraft::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
BlackMisc::deserializeJson(json, TupleConverter<CAircraft>::toMetaTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CAircraft::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CAircraft>::jsonMembers();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user