refs #140, changed CValueObject classes to tupel concept

Remarks: Changes looking like an added file result from the shift of namespace voice -> audio
This commit is contained in:
Klaus Basan
2014-03-10 14:48:56 +01:00
parent 8f6a22e833
commit 34320ad3e1
43 changed files with 1293 additions and 768 deletions

View File

@@ -47,46 +47,6 @@ namespace BlackMisc
return this->CValueObject::isA(metaTypeId);
}
/*
* Compare
*/
int CTextMessage::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CTextMessage &>(otherBase);
int result;
if ((result = compare(this->m_senderCallsign, other.m_senderCallsign))) { return result; }
if ((result = compare(this->m_recipientCallsign, other.m_recipientCallsign))) { return result; }
if ((result = compare(this->m_frequency, other.m_frequency))) { return result; }
if (this->m_received < other.m_received) { return -1; }
if (this->m_received > other.m_received) { return 1; }
return this->m_message.compare(other.m_message);
}
/*
* Marshall to DBus
*/
void CTextMessage::marshallToDbus(QDBusArgument &argument) const
{
argument << this->m_senderCallsign;
argument << this->m_recipientCallsign;
argument << this->m_message;
argument << this->m_frequency;
argument << this->m_received;
}
/*
* Unmarshall from DBus
*/
void CTextMessage::unmarshallFromDbus(const QDBusArgument &argument)
{
argument >> this->m_senderCallsign;
argument >> this->m_recipientCallsign;
argument >> this->m_message;
argument >> this->m_frequency;
argument >> this->m_received;
}
/*
* Private message?
*/
@@ -229,13 +189,46 @@ namespace BlackMisc
return candidate.right(4);
}
/*
* Compare
*/
int CTextMessage::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CTextMessage &>(otherBase);
return compare(TupleConverter<CTextMessage>::toTuple(*this), TupleConverter<CTextMessage>::toTuple(other));
}
/*
* Marshall to DBus
*/
void CTextMessage::marshallToDbus(QDBusArgument &argument) const
{
argument << TupleConverter<CTextMessage>::toTuple(*this);
}
/*
* Unmarshall from DBus
*/
void CTextMessage::unmarshallFromDbus(const QDBusArgument &argument)
{
argument >> TupleConverter<CTextMessage>::toTuple(*this);
}
/*
* Hash
*/
uint CTextMessage::getValueHash() const
{
return qHash(TupleConverter<CTextMessage>::toTuple(*this));
}
/*
* Equal?
*/
bool CTextMessage::operator ==(const CTextMessage &other) const
{
if (this == &other) return true;
return compare(*this, other);
return TupleConverter<CTextMessage>::toTuple(*this) == TupleConverter<CTextMessage>::toTuple(other);
}
/*
@@ -246,20 +239,6 @@ namespace BlackMisc
return !((*this) == other);
}
/*
* Hash
*/
uint CTextMessage::getValueHash() const
{
QList<uint> hashs;
hashs << qHash(this->m_senderCallsign.getValueHash());
hashs << qHash(this->m_recipientCallsign.getValueHash());
hashs << qHash(this->m_frequency.getValueHash());
hashs << qHash(this->m_message);
hashs << qHash(this->m_received);
return BlackMisc::calculateHash(hashs, "CTextMessage");
}
/*
* Register metadata
*/