diff options
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/commands/captureddatacommand.h | 35 |
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 f682c035e9f..449a9a2e4b2 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: |