diff --git a/src/plugins/qmlprofiler/qmleventlocation.h b/src/plugins/qmlprofiler/qmleventlocation.h index bfb427adaee..5eede5ddb06 100644 --- a/src/plugins/qmlprofiler/qmleventlocation.h +++ b/src/plugins/qmlprofiler/qmleventlocation.h @@ -28,6 +28,7 @@ #include "qmlprofiler_global.h" #include +#include namespace QmlProfiler { @@ -75,6 +76,14 @@ inline bool operator!=(const QmlEventLocation &location1, const QmlEventLocation return !(location1 == location2); } +inline uint qHash(const QmlEventLocation &location) +{ + return qHash(location.filename()) + ^ ((location.line() & 0xfff) // 12 bits of line number + | ((location.column() << 16) & 0xff0000)); // 8 bits of column + +} + QDataStream &operator>>(QDataStream &stream, QmlEventLocation &location); QDataStream &operator<<(QDataStream &stream, const QmlEventLocation &location); diff --git a/src/plugins/qmlprofiler/qmleventtype.h b/src/plugins/qmlprofiler/qmleventtype.h index f4a0a4c8ed1..a2e16525f86 100644 --- a/src/plugins/qmlprofiler/qmleventtype.h +++ b/src/plugins/qmlprofiler/qmleventtype.h @@ -28,6 +28,7 @@ #include "qmlprofilereventtypes.h" #include #include +#include namespace QmlProfiler { @@ -67,6 +68,25 @@ private: QDataStream &operator>>(QDataStream &stream, QmlEventType &type); QDataStream &operator<<(QDataStream &stream, const QmlEventType &type); +inline uint qHash(const QmlEventType &type) +{ + return qHash(type.location()) + ^ (((type.message() << 12) & 0xf000) // 4 bits of message + | ((type.rangeType() << 24) & 0xf000000) // 4 bits of rangeType + | ((type.detailType() << 28) & 0xf0000000)); // 4 bits of detailType +} + +inline bool operator==(const QmlEventType &type1, const QmlEventType &type2) +{ + return type1.message() == type2.message() && type1.rangeType() == type2.rangeType() + && type1.detailType() == type2.detailType() && type1.location() == type2.location(); +} + +inline bool operator!=(const QmlEventType &type1, const QmlEventType &type2) +{ + return !(type1 == type2); +} + } // namespace QmlProfiler Q_DECLARE_METATYPE(QmlProfiler::QmlEventType) diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp index 8b3af29d8e5..4c586a37eaf 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp @@ -34,22 +34,6 @@ namespace QmlProfiler { -inline static uint qHash(const QmlEventType &type) -{ - return qHash(type.location().filename()) ^ - ((type.location().line() & 0xfff) | // 12 bits of line number - ((type.message() << 12) & 0xf000) | // 4 bits of message - ((type.location().column() << 16) & 0xff0000) | // 8 bits of column - ((type.rangeType() << 24) & 0xf000000) | // 4 bits of rangeType - ((type.detailType() << 28) & 0xf0000000)); // 4 bits of detailType -} - -inline static bool operator==(const QmlEventType &type1, const QmlEventType &type2) -{ - return type1.message() == type2.message() && type1.rangeType() == type2.rangeType() && - type1.detailType() == type2.detailType() && type1.location() == type2.location(); -} - class QmlProfilerTraceClientPrivate { public: QmlProfilerTraceClientPrivate(QmlProfilerTraceClient *_q, QmlDebug::QmlDebugConnection *client,