mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user