mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
refs #345 First wave of value classes using the CValueObjectStdTuple CRTP class template.
This commit is contained in:
@@ -39,97 +39,6 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* metaTypeId
|
||||
*/
|
||||
int CSettingsNetwork::getMetaTypeId() const
|
||||
{
|
||||
return qMetaTypeId<CSettingsNetwork>();
|
||||
}
|
||||
|
||||
/*
|
||||
* is a
|
||||
*/
|
||||
bool CSettingsNetwork::isA(int metaTypeId) const
|
||||
{
|
||||
if (metaTypeId == qMetaTypeId<CSettingsNetwork>()) { return true; }
|
||||
return this->CValueObject::isA(metaTypeId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
int CSettingsNetwork::compareImpl(const CValueObject &otherBase) const
|
||||
{
|
||||
const auto &other = static_cast<const CSettingsNetwork &>(otherBase);
|
||||
return compare(TupleConverter<CSettingsNetwork>::toTuple(*this), TupleConverter<CSettingsNetwork>::toTuple(other));
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall
|
||||
*/
|
||||
void CSettingsNetwork::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
argument << TupleConverter<CSettingsNetwork>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall
|
||||
*/
|
||||
void CSettingsNetwork::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
argument >> TupleConverter<CSettingsNetwork>::toTuple(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Equal?
|
||||
*/
|
||||
bool CSettingsNetwork::operator ==(const CSettingsNetwork &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return compare(*this, other) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unequal?
|
||||
*/
|
||||
bool CSettingsNetwork::operator !=(const CSettingsNetwork &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash
|
||||
*/
|
||||
uint CSettingsNetwork::getValueHash() const
|
||||
{
|
||||
return qHash(TupleConverter<CSettingsNetwork>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* To JSON
|
||||
*/
|
||||
QJsonObject CSettingsNetwork::toJson() const
|
||||
{
|
||||
return BlackMisc::serializeJson(CSettingsNetwork::jsonMembers(), TupleConverter<CSettingsNetwork>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* From JSON
|
||||
*/
|
||||
void CSettingsNetwork::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
BlackMisc::deserializeJson(json, CSettingsNetwork::jsonMembers(), TupleConverter<CSettingsNetwork>::toTuple(*this));
|
||||
}
|
||||
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
const QStringList &CSettingsNetwork::jsonMembers()
|
||||
{
|
||||
return TupleConverter<CSettingsNetwork>::jsonMembers();
|
||||
}
|
||||
|
||||
/*
|
||||
* Default values
|
||||
*/
|
||||
@@ -145,15 +54,6 @@ namespace BlackMisc
|
||||
this->addTrafficNetworkServer(CServer("USA-W", "VATSIM Server", "64.151.108.52", 6809, CUser("vatsimid", "Black Client", "", "vatsimpw")));
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CSettingsNetwork::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CSettingsNetwork>();
|
||||
qDBusRegisterMetaType<CSettingsNetwork>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Value
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user