aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.cpp
blob: 1eb49b66ad3411106f12cd2ef9bc46b817234426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "puppettocreatorcommand.h"

namespace QmlDesigner {

// A generic command that can hold a variant data from puppet to creator

PuppetToCreatorCommand::PuppetToCreatorCommand(Type type, const QVariant &data)
    : m_type(type)
    , m_data(data)
{

}

QDataStream &operator<<(QDataStream &out, const PuppetToCreatorCommand &command)
{
    out << qint32(command.type());
    out << command.data();
    return out;
}

QDataStream &operator>>(QDataStream &in, PuppetToCreatorCommand &command)
{
    qint32 type;
    in >> type;
    command.m_type = PuppetToCreatorCommand::Type(type);
    in >> command.m_data;
    return in;
}

} // namespace QmlDesigner