aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/qmlevent.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-06-06 16:54:22 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-06-08 08:54:37 +0000
commit85b5810f9c660051a0f554735afe7f67143d4c62 (patch)
tree02eb92e207e952b76981ddfb275a5298e7ab3420 /src/plugins/qmlprofiler/qmlevent.cpp
parent8bdc612b3ae07507d82e6747c5c8ec022c7a71c2 (diff)
QmlProfiler: Add some missing bits to QmlEvent
We want move constructor, move assignment, ==, and !=. Also, drop some unreachable code. Change-Id: I65f24d7ba0f146ad37ec4b7c438b47d4abc3d688 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlevent.cpp')
-rw-r--r--src/plugins/qmlprofiler/qmlevent.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/qmlprofiler/qmlevent.cpp b/src/plugins/qmlprofiler/qmlevent.cpp
index 4c848ef0ce6..225186df25f 100644
--- a/src/plugins/qmlprofiler/qmlevent.cpp
+++ b/src/plugins/qmlprofiler/qmlevent.cpp
@@ -29,6 +29,20 @@
namespace QmlProfiler {
+bool operator==(const QmlEvent &event1, const QmlEvent &event2)
+{
+ if (event1.timestamp() != event2.timestamp() || event1.typeIndex() != event2.typeIndex())
+ return false;
+
+ // This is not particularly efficient, but we also don't need to do this very often.
+ return event1.numbers<QVarLengthArray<qint64>>() == event2.numbers<QVarLengthArray<qint64>>();
+}
+
+bool operator!=(const QmlEvent &event1, const QmlEvent &event2)
+{
+ return !(event1 == event2);
+}
+
enum SerializationType {
OneByte = 0,
TwoByte = 1,
@@ -153,10 +167,8 @@ static qint8 minimumType(const QmlEvent &event, quint16 length, quint16 origBits
case FourByte:
ok = (event.number<qint32>(i) == event.number<qint64>(i));
break;
- case EightByte:
- ok = true;
- break;
default:
+ // EightByte isn't possible, as (1 << type) == origBitsPerNumber / 8 then.
Q_UNREACHABLE();
break;
}