mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 17:30:12 +08:00
refs #314, calculcate hash for QList<int>
This commit is contained in:
@@ -321,6 +321,30 @@ uint BlackMisc::calculateHash(const QList<uint> &values, const char *className)
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add hash values
|
||||||
|
*/
|
||||||
|
uint BlackMisc::calculateHash(const QList<int> &values, const char *className)
|
||||||
|
{
|
||||||
|
QList<uint> list;
|
||||||
|
uint s = 0;
|
||||||
|
foreach(int i, values)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (i >= 0)
|
||||||
|
{
|
||||||
|
list.append(static_cast<uint>(i));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list.append(static_cast<uint>(i));
|
||||||
|
list.append(s++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return calculateHash(list, className);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fix QVariant if it comes from DBus and contains QDBusArgument
|
* Fix QVariant if it comes from DBus and contains QDBusArgument
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -141,6 +141,9 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
uint calculateHash(const QList<uint> &values, const char *className);
|
uint calculateHash(const QList<uint> &values, const char *className);
|
||||||
|
|
||||||
|
//! Hash value, but with int list
|
||||||
|
uint calculateHash(const QList<int> &values, const char *className);
|
||||||
|
|
||||||
//! Real heap size of an object
|
//! Real heap size of an object
|
||||||
size_t heapSizeOf(const QMetaType &type);
|
size_t heapSizeOf(const QMetaType &type);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user