score
Home
Classes
Namespaces
Files
ReplaceDevice.hpp
1
#pragma once
2
#include <Device/Node/DeviceNode.hpp>
3
4
#include <Explorer/Commands/DeviceExplorerCommandFactory.hpp>
5
6
#include <score/command/Command.hpp>
7
#include <score/model/path/Path.hpp>
8
9
struct
DataStreamInput
;
10
struct
DataStreamOutput
;
11
12
namespace
Explorer
13
{
14
class
DeviceDocumentPlugin;
15
namespace
Command
16
{
17
// Replaces all the nodes of a device by new nodes.
18
class
ReplaceDevice
final :
public
score::Command
19
{
20
SCORE_COMMAND_DECL(
21
DeviceExplorerCommandFactoryName(),
ReplaceDevice
,
"Replace a device"
)
22
public
:
23
ReplaceDevice
(
24
const
DeviceDocumentPlugin& device_tree,
int
deviceIndex,
Device::Node
&& rootNode);
25
ReplaceDevice
(
26
const
DeviceDocumentPlugin& device_tree,
int
deviceIndex,
Device::Node
&& oldDevice,
27
Device::Node
&& newDevice);
28
29
void
undo(
const
score::DocumentContext
& ctx)
const override
;
30
void
redo(
const
score::DocumentContext
& ctx)
const override
;
31
32
protected
:
33
void
serializeImpl(
DataStreamInput
&)
const override
;
34
void
deserializeImpl(
DataStreamOutput
&)
override
;
35
36
private
:
37
int
m_deviceIndex{};
38
Device::Node
m_deviceNode;
39
Device::Node
m_savedNode;
40
};
41
}
42
}
Explorer::Command::ReplaceDevice
Definition:
ReplaceDevice.hpp:19
TreeNode< DeviceExplorerNode >
score::Command
The Command class.
Definition:
Command.hpp:34
DataStreamInput
Definition:
DataStreamHelpers.hpp:99
DataStreamOutput
Definition:
DataStreamHelpers.hpp:103
score::DocumentContext
Definition:
DocumentContext.hpp:18