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>
This commit is contained in:
Ulf Hermann
2016-06-06 16:54:22 +02:00
parent 8bdc612b3a
commit 85b5810f9c
2 changed files with 33 additions and 3 deletions

View File

@@ -66,6 +66,12 @@ struct QmlEvent {
assignData(other);
}
QmlEvent(QmlEvent &&other)
{
memcpy(this, &other, sizeof(QmlEvent));
other.m_dataType = Inline8Bit; // prevent dtor from deleting the pointer
}
QmlEvent &operator=(const QmlEvent &other)
{
if (this != &other) {
@@ -79,6 +85,15 @@ struct QmlEvent {
return *this;
}
QmlEvent &operator=(QmlEvent &&other)
{
if (this != &other) {
memcpy(this, &other, sizeof(QmlEvent));
other.m_dataType = Inline8Bit;
}
return *this;
}
~QmlEvent()
{
clearPointer();
@@ -290,6 +305,9 @@ private:
friend QDataStream &operator<<(QDataStream &stream, const QmlEvent &event);
};
bool operator==(const QmlEvent &event1, const QmlEvent &event2);
bool operator!=(const QmlEvent &event1, const QmlEvent &event2);
QDataStream &operator>>(QDataStream &stream, QmlEvent &event);
QDataStream &operator<<(QDataStream &stream, const QmlEvent &event);