diff options
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r-- | src/plugins/qmlprofiler/qmleventlocation.h | 43 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmleventtype.h | 3 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlnote.h | 11 |
3 files changed, 24 insertions, 33 deletions
diff --git a/src/plugins/qmlprofiler/qmleventlocation.h b/src/plugins/qmlprofiler/qmleventlocation.h index 5faf907101..0c6fb2007d 100644 --- a/src/plugins/qmlprofiler/qmleventlocation.h +++ b/src/plugins/qmlprofiler/qmleventlocation.h @@ -55,6 +55,26 @@ public: int line() const { return m_line; } int column() const { return m_column; } + friend bool operator==(const QmlEventLocation &location1, const QmlEventLocation &location2) + { + // compare filename last as it's expensive. + return location1.line() == location2.line() && location1.column() == location2.column() + && location1.filename() == location2.filename(); + } + + friend bool operator!=(const QmlEventLocation &location1, const QmlEventLocation &location2) + { + return !(location1 == location2); + } + + friend auto qHash(const QmlEventLocation &location) + { + return qHash(location.filename()) + ^ ((location.line() & 0xfff) // 12 bits of line number + | ((location.column() << 16) & 0xff0000)); // 8 bits of column + + } + private: friend QDataStream &operator>>(QDataStream &stream, QmlEventLocation &location); friend QDataStream &operator<<(QDataStream &stream, const QmlEventLocation &location); @@ -64,29 +84,6 @@ private: int m_column = -1; }; -inline bool operator==(const QmlEventLocation &location1, const QmlEventLocation &location2) -{ - // compare filename last as it's expensive. - return location1.line() == location2.line() && location1.column() == location2.column() - && location1.filename() == location2.filename(); -} - -inline bool operator!=(const QmlEventLocation &location1, const QmlEventLocation &location2) -{ - return !(location1 == location2); -} - -inline auto 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); - } // namespace QmlProfiler QT_BEGIN_NAMESPACE diff --git a/src/plugins/qmlprofiler/qmleventtype.h b/src/plugins/qmlprofiler/qmleventtype.h index ee87dc94d2..9eb9954075 100644 --- a/src/plugins/qmlprofiler/qmleventtype.h +++ b/src/plugins/qmlprofiler/qmleventtype.h @@ -63,9 +63,6 @@ private: int m_detailType; // can be EventType, BindingType, PixmapEventType or SceneGraphFrameType }; -QDataStream &operator>>(QDataStream &stream, QmlEventType &type); -QDataStream &operator<<(QDataStream &stream, const QmlEventType &type); - } // namespace QmlProfiler Q_DECLARE_METATYPE(QmlProfiler::QmlEventType) diff --git a/src/plugins/qmlprofiler/qmlnote.h b/src/plugins/qmlprofiler/qmlnote.h index 1178ccaca6..919d215faf 100644 --- a/src/plugins/qmlprofiler/qmlnote.h +++ b/src/plugins/qmlprofiler/qmlnote.h @@ -48,10 +48,13 @@ public: void setText(const QString &text) { m_text = text; } void setLoaded(bool loaded) { m_loaded = loaded; } -private: + friend bool operator==(const QmlNote ¬e1, const QmlNote ¬e2); + friend bool operator!=(const QmlNote ¬e1, const QmlNote ¬e2); + friend QDataStream &operator>>(QDataStream &stream, QmlNote ¬e); friend QDataStream &operator<<(QDataStream &stream, const QmlNote ¬e); +private: int m_typeIndex; int m_collapsedRow; qint64 m_startTime; @@ -60,12 +63,6 @@ private: bool m_loaded; }; -bool operator==(const QmlNote ¬e1, const QmlNote ¬e2); -bool operator!=(const QmlNote ¬e1, const QmlNote ¬e2); - -QDataStream &operator>>(QDataStream &stream, QmlNote ¬e); -QDataStream &operator<<(QDataStream &stream, const QmlNote ¬e); - } // namespace QmlProfiler Q_DECLARE_METATYPE(QmlProfiler::QmlNote) |