summaryrefslogtreecommitdiff
path: root/src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.cpp
blob: 0b35807c9b9c654b5be679413216f2ff0433d8eb (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-only 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