mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +08:00
refs #624 CLogPattern can use Mixin::HashByTuple because QSet is hashable since Qt 5.5.
This commit is contained in:
@@ -27,6 +27,7 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
class BLACKMISC_EXPORT CLogPattern :
|
class BLACKMISC_EXPORT CLogPattern :
|
||||||
public Mixin::MetaType<CLogPattern>,
|
public Mixin::MetaType<CLogPattern>,
|
||||||
|
public Mixin::HashByTuple<CLogPattern>,
|
||||||
public Mixin::EqualsByTuple<CLogPattern>,
|
public Mixin::EqualsByTuple<CLogPattern>,
|
||||||
public Mixin::DBusOperators<CLogPattern>,
|
public Mixin::DBusOperators<CLogPattern>,
|
||||||
public Mixin::Index<CLogPattern>,
|
public Mixin::Index<CLogPattern>,
|
||||||
@@ -92,15 +93,6 @@ namespace BlackMisc
|
|||||||
//! \copydoc BlackMisc::Mixin::DBusByTuple::unmarshallFromDbus()
|
//! \copydoc BlackMisc::Mixin::DBusByTuple::unmarshallFromDbus()
|
||||||
void unmarshallFromDbus(const QDBusArgument &argument);
|
void unmarshallFromDbus(const QDBusArgument &argument);
|
||||||
|
|
||||||
//! \copydoc CValueObject::qHash
|
|
||||||
//! \todo Use Mixin::HashByTuple when Qt 5.5 is baseline (qHash(QSet<T>) was added in Qt 5.5).
|
|
||||||
friend uint qHash(const CLogPattern &p, uint seed = 0)
|
|
||||||
{
|
|
||||||
seed = std::accumulate(p.m_severities.begin(), p.m_severities.end(), seed, [](uint i, CStatusMessage::StatusSeverity s) { return i + (1 << static_cast<int>(s)); });
|
|
||||||
seed ^= std::accumulate(p.m_strings.begin(), p.m_strings.end(), 0, [](uint i, const QString &s) { return i + qHash(s); });
|
|
||||||
return qHash(static_cast<int>(p.m_strategy), seed);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkInvariants() const;
|
bool checkInvariants() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user