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

@@ -30,48 +30,6 @@ namespace BlackMisc
return s;
}
/*
* metaTypeId
*/
int CServer::getMetaTypeId() const
{
return qMetaTypeId<CServer>();
}
/*
* is a
*/
bool CServer::isA(int metaTypeId) const
{
if (metaTypeId == qMetaTypeId<CServer>()) { return true; }
return this->CValueObject::isA(metaTypeId);
}
/*
* Compare
*/
int CServer::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CServer &>(otherBase);
return compare(TupleConverter<CServer>::toTuple(*this), TupleConverter<CServer>::toTuple(other));
}
/*
* Marshall to DBus
*/
void CServer::marshallToDbus(QDBusArgument &argument) const
{
argument << TupleConverter<CServer>::toTuple(*this);
}
/*
* Unmarshall from DBus
*/
void CServer::unmarshallFromDbus(const QDBusArgument &argument)
{
argument >> TupleConverter<CServer>::toTuple(*this);
}
/*
* Valid for login
*/
@@ -80,31 +38,6 @@ namespace BlackMisc
return this->m_user.hasValidCredentials() && this->m_port > 0 && !this->m_address.isEmpty() && this->isAcceptingConnections();
}
/*
* Equal?
*/
bool CServer::operator ==(const CServer &other) const
{
if (this == &other) return true;
return TupleConverter<CServer>::toTuple(*this) == TupleConverter<CServer>::toTuple(other);
}
/*
* Unequal?
*/
bool CServer::operator !=(const CServer &other) const
{
return !((*this) == other);
}
/*
* Hash
*/
uint CServer::getValueHash() const
{
return qHash(TupleConverter<CServer>::toTuple(*this));
}
/*
* Property by index
*/
@@ -173,38 +106,5 @@ namespace BlackMisc
}
}
/*
* Register metadata
*/
void CServer::registerMetadata()
{
qRegisterMetaType<CServer>();
qDBusRegisterMetaType<CServer>();
}
/*
* Members
*/
const QStringList &CServer::jsonMembers()
{
return TupleConverter<CServer>::jsonMembers();
}
/*
* To JSON
*/
QJsonObject CServer::toJson() const
{
return BlackMisc::serializeJson(CServer::jsonMembers(), TupleConverter<CServer>::toTuple(*this));
}
/*
* From Json
*/
void CServer::convertFromJson(const QJsonObject &json)
{
BlackMisc::deserializeJson(json, CServer::jsonMembers(), TupleConverter<CServer>::toTuple(*this));
}
} // namespace
} // namespace