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

@@ -75,15 +75,6 @@ namespace BlackMisc
return this->m_indexes.size() > 1;
}
/*
* Register metadata
*/
void CPropertyIndex::registerMetadata()
{
qRegisterMetaType<CPropertyIndex>();
qDBusRegisterMetaType<CPropertyIndex>();
}
/*
* Convert to string
*/
@@ -93,49 +84,6 @@ namespace BlackMisc
return this->m_indexString;
}
/*
* metaTypeId
*/
int CPropertyIndex::getMetaTypeId() const
{
return qMetaTypeId<CPropertyIndex>();
}
/*
* is a
*/
bool CPropertyIndex::isA(int metaTypeId) const
{
if (metaTypeId == qMetaTypeId<CPropertyIndex>()) { return true; }
return this->CValueObject::isA(metaTypeId);
}
/*
* Compare
*/
int CPropertyIndex::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CPropertyIndex &>(otherBase);
return compare(TupleConverter<CPropertyIndex>::toTuple(*this), TupleConverter<CPropertyIndex>::toTuple(other));
}
/*
* Marshall to DBus
*/
void CPropertyIndex::marshallToDbus(QDBusArgument &argument) const
{
argument << TupleConverter<CPropertyIndex>::toTuple(*this);
}
/*
* Unmarshall from DBus
*/
void CPropertyIndex::unmarshallFromDbus(const QDBusArgument &argument)
{
argument >> TupleConverter<CPropertyIndex>::toTuple(*this);
this->stringToList();
}
/*
* Parse from string
*/
@@ -179,54 +127,4 @@ namespace BlackMisc
}
}
/*
* Equal?
*/
bool CPropertyIndex::operator ==(const CPropertyIndex &other) const
{
if (this == &other) return true;
return TupleConverter<CPropertyIndex>::toTuple(*this) == TupleConverter<CPropertyIndex>::toTuple(other);
}
/*
* Unequal?
*/
bool CPropertyIndex::operator !=(const CPropertyIndex &other) const
{
return !((*this) == other);
}
/*
* Hash
*/
uint CPropertyIndex::getValueHash() const
{
return qHash(TupleConverter<CPropertyIndex>::toTuple(*this));
}
/*
* To JSON
*/
QJsonObject CPropertyIndex::toJson() const
{
return BlackMisc::serializeJson(CPropertyIndex::jsonMembers(), TupleConverter<CPropertyIndex>::toTuple(*this));
}
/*
* From JSON
*/
void CPropertyIndex::convertFromJson(const QJsonObject &json)
{
BlackMisc::deserializeJson(json, CPropertyIndex::jsonMembers(), TupleConverter<CPropertyIndex>::toTuple(*this));
this->stringToList();
}
/*
* Members
*/
const QStringList &CPropertyIndex::jsonMembers()
{
return TupleConverter<CPropertyIndex>::jsonMembers();
}
} // namespace