aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2020-08-31 09:24:17 +0200
committerMarco Bubke <marco.bubke@qt.io>2020-09-01 09:10:19 +0000
commitb0c47267d812b378042ae1262b987368569e4419 (patch)
tree5fbc843f48a8926fdff1c77b7ce0f6ccacc2df0e /share
parent1bc03df197ad67d4942dc924037e97d14baef733 (diff)
QmlDesigner: Inline vector stream operators
Task-number: QTCREATORBUG-24548 Change-Id: I01d1b6e12c04c4ea47279e3a5046a0d3e34a5c09 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h b/share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h
index f682c035e9..449a9a2e4b 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h
@@ -29,10 +29,43 @@
#include "imagecontainer.h"
-#include <utils/smallstringio.h>
+#include <vector>
namespace QmlDesigner {
+template<typename Type>
+QDataStream &operator<<(QDataStream &out, const std::vector<Type> &vector)
+{
+ out << quint64(vector.size());
+
+ for (auto &&entry : vector)
+ out << entry;
+
+ return out;
+}
+
+template<typename Type>
+QDataStream &operator>>(QDataStream &in, std::vector<Type> &vector)
+{
+ vector.clear();
+
+ quint64 size;
+
+ in >> size;
+
+ vector.reserve(size);
+
+ for (quint64 i = 0; i < size; ++i) {
+ Type entry;
+
+ in >> entry;
+
+ vector.push_back(std::move(entry));
+ }
+
+ return in;
+}
+
class CapturedDataCommand
{
public: