Loading...
Searching...
No Matches
AddAddress.hpp
1#pragma once
2#include <Device/Address/AddressSettings.hpp>
3#include <Device/Node/DeviceNode.hpp>
4
5#include <Explorer/Commands/DeviceExplorerCommandFactory.hpp>
6
7#include <score/command/AggregateCommand.hpp>
8#include <score/command/Command.hpp>
9#include <score/model/path/Path.hpp>
10#include <score/model/tree/TreePath.hpp>
11
12#include <score_plugin_deviceexplorer_export.h>
13
14namespace Explorer
15{
16class DeviceDocumentPlugin;
17namespace Command
18{
19
20class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT AddAddress final : public score::Command
21{
22 SCORE_COMMAND_DECL(DeviceExplorerCommandFactoryName(), AddAddress, "Add an address")
23public:
25 const DeviceDocumentPlugin& devplug, const Device::NodePath& nodePath,
26 InsertMode insert, const Device::AddressSettings& addressSettings);
27
28 void undo(const score::DocumentContext& ctx) const override;
29 void redo(const score::DocumentContext& ctx) const override;
30
31 int createdNodeIndex() const;
32
33protected:
34 void serializeImpl(DataStreamInput&) const override;
35 void deserializeImpl(DataStreamOutput&) override;
36
37private:
38 Device::NodePath m_parentNodePath;
39 Device::AddressSettings m_addressSettings;
40 int m_createdLevels{};
41};
42
43class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT AddWholeAddress final : public score::Command
44{
45 SCORE_COMMAND_DECL(
46 DeviceExplorerCommandFactoryName(), AddWholeAddress, "Add an address")
47public:
49 const DeviceDocumentPlugin& devplug, const Device::FullAddressSettings& addr);
50
51 void undo(const score::DocumentContext& ctx) const override;
52 void redo(const score::DocumentContext& ctx) const override;
53
54protected:
55 void serializeImpl(DataStreamInput&) const override;
56 void deserializeImpl(DataStreamOutput&) override;
57
58private:
59 Device::FullAddressSettings m_addressSettings;
60 int m_existsUpTo{};
61};
62
63class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT AddAddresses final
65{
66 SCORE_COMMAND_DECL(DeviceExplorerCommandFactoryName(), AddAddresses, "Add addresses")
67};
68}
69}
Definition AddAddress.hpp:21
Definition AddAddress.hpp:65
Definition AddAddress.hpp:44
Path in a tree of QAbstractItemModel objects.
Definition TreePath.hpp:34
Allows for grouping of multiple commands in a single one.
Definition AggregateCommand.hpp:15
The Command class.
Definition Command.hpp:34
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition AddressSettings.hpp:49
Definition AddressSettings.hpp:62
Definition DocumentContext.hpp:18