aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qml/qmlpuppet/commands/changenodesourcecommand.cpp
blob: 338de4507a32037f24fc7dcbd4f2f92ddd759f2e (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "changenodesourcecommand.h"

#include <QDataStream>
#include <QDebug>

namespace QmlDesigner {

ChangeNodeSourceCommand::ChangeNodeSourceCommand() = default;

ChangeNodeSourceCommand::ChangeNodeSourceCommand(qint32 newInstanceId, const QString &newNodeSource)
    : m_instanceId(newInstanceId), m_nodeSource(newNodeSource)
{
}

qint32 ChangeNodeSourceCommand::instanceId() const
{
    return m_instanceId;
}

QString ChangeNodeSourceCommand::nodeSource() const
{
    return m_nodeSource;
}

QDataStream &operator<<(QDataStream &out, const ChangeNodeSourceCommand &command)
{
    out << command.instanceId();
    out << command.nodeSource();

    return out;
}

QDataStream &operator>>(QDataStream &in, ChangeNodeSourceCommand &command)
{
    in >> command.m_instanceId;
    in >> command.m_nodeSource;

    return in;
}

QDebug operator <<(QDebug debug, const ChangeNodeSourceCommand &command)
{
    return debug.nospace() << "ReparentInstancesCommand("
                           << "instanceId: " << command.m_instanceId
                           << "nodeSource: " << command.m_nodeSource << ")";
}

} // namespace QmlDesigner