Remove.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 // TODO split this command.
18 class Remove final : public score::Command
19 {
20  SCORE_COMMAND_DECL(
21  DeviceExplorerCommandFactoryName(), Remove, "Remove an Explorer node")
22 public:
23  // For addresses
24  Remove(const DeviceDocumentPlugin& devplug, Device::NodePath&& path);
25 
26  // For devices
27  Remove(const DeviceDocumentPlugin& devplug, const Device::Node& node);
28 
29  ~Remove();
30 
31  void undo(const score::DocumentContext& ctx) const override;
32  void redo(const score::DocumentContext& ctx) const override;
33 
34 protected:
35  void serializeImpl(DataStreamInput&) const override;
36  void deserializeImpl(DataStreamOutput&) override;
37 
38 protected:
39  bool m_device{};
40  score::Command* m_cmd{};
41 };
42 }
43 }
Definition: Remove.hpp:19
Path in a tree of QAbstractItemModel objects.
Definition: TreePath.hpp:34
The Command class.
Definition: Command.hpp:34
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: DocumentContext.hpp:18