refs #345 First wave of value classes using the CValueObjectStdTuple CRTP class template.

This commit is contained in:
Mathew Sutcliffe
2014-10-30 22:08:22 +00:00
parent ecf8e6aafb
commit 4c8148acf1
68 changed files with 34 additions and 4499 deletions

View File

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