Files
BionxControl/nodes/services/ntxicommand.h

52 lines
1.1 KiB
C
Raw Permalink Normal View History

2026-04-02 15:15:28 +02:00
#ifndef NTX_ICOMMAND_H
#define NTX_ICOMMAND_H
#include <ntxinode.h>
#include <memory>
namespace ntx
{
// Einfache Struct für Clipboard-Eintrag
struct NtxNodeEntry
{
NtxNodePtr clone; // Elternloser Deep-Clone
NtxNodeWeakPtr originalParent; // Schwache Referenz für Undo
size_t originalPosition; // Position im Original-Parent
};
using NtxNodeEntryList = std::vector<NtxNodeEntry>;
class NtxICommand
{
public:
virtual ~NtxICommand() = default;
virtual bool execute() = 0;
virtual bool undo() = 0;
virtual bool canExecute() const = 0;
virtual bool canUndo() const;
virtual NtxString getDescription() const;
protected:
NtxICommand() = default;
NtxICommand(const NtxICommand&) = default;
NtxICommand& operator=(const NtxICommand&) = default;
void setDescription(const NtxString& description);
private:
NtxString m_description;
};
using NtxCommandPtr = std::shared_ptr<NtxICommand>;
using NtxCommandUPtr = std::unique_ptr<NtxICommand>;
} // namespace ntx
#endif // NTX_ICOMMAND_H