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

@@ -31,48 +31,6 @@ namespace BlackMisc
return s;
}
/*
* metaTypeId
*/
int CAircraftIcao::getMetaTypeId() const
{
return qMetaTypeId<CAircraftIcao>();
}
/*
* is a
*/
bool CAircraftIcao::isA(int metaTypeId) const
{
if (metaTypeId == qMetaTypeId<CAircraftIcao>()) { return true; }
return this->CValueObject::isA(metaTypeId);
}
/*
* Compare
*/
int CAircraftIcao::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CAircraftIcao &>(otherBase);
return compare(TupleConverter<CAircraftIcao>::toTuple(*this), TupleConverter<CAircraftIcao>::toTuple(other));
}
/*
* Marshall to DBus
*/
void CAircraftIcao::marshallToDbus(QDBusArgument &argument) const
{
argument << TupleConverter<CAircraftIcao>::toTuple(*this);
}
/*
* Unmarshall from DBus
*/
void CAircraftIcao::unmarshallFromDbus(const QDBusArgument &argument)
{
argument >> TupleConverter<CAircraftIcao>::toTuple(*this);
}
/*
* As string
*/
@@ -93,12 +51,6 @@ namespace BlackMisc
return s;
}
bool CAircraftIcao::operator ==(const CAircraftIcao &other) const
{
if (this == &other) return true;
return TupleConverter<CAircraftIcao>::toTuple(*this) == TupleConverter<CAircraftIcao>::toTuple(other);
}
bool CAircraftIcao::matchesWildcardIcao(const CAircraftIcao &otherIcao) const
{
if ((*this) == otherIcao) return true;
@@ -110,22 +62,6 @@ namespace BlackMisc
return true;
}
/*
* Unequal?
*/
bool CAircraftIcao::operator !=(const CAircraftIcao &other) const
{
return !((*this) == other);
}
/*
* Hash
*/
uint CAircraftIcao::getValueHash() const
{
return qHash(TupleConverter<CAircraftIcao>::toTuple(*this));
}
/*
* Property by index
*/
@@ -192,38 +128,5 @@ namespace BlackMisc
return (regexp.match(designator).hasMatch());
}
/*
* Register metadata
*/
void CAircraftIcao::registerMetadata()
{
qRegisterMetaType<CAircraftIcao>();
qDBusRegisterMetaType<CAircraftIcao>();
}
/*
* To JSON
*/
QJsonObject CAircraftIcao::toJson() const
{
return BlackMisc::serializeJson(CAircraftIcao::jsonMembers(), TupleConverter<CAircraftIcao>::toTuple(*this));
}
/*
* To JSON
*/
void CAircraftIcao::convertFromJson(const QJsonObject &json)
{
BlackMisc::deserializeJson(json, CAircraftIcao::jsonMembers(), TupleConverter<CAircraftIcao>::toTuple(*this));
}
/*
* Members
*/
const QStringList &CAircraftIcao::jsonMembers()
{
return TupleConverter<CAircraftIcao>::jsonMembers();
}
} // namespace
} // namespace