47 stack().disableActions();
48 cmd->redo(stack().context());
49 m_cmds.push_back(cmd);
54 stack().disableActions();
55 m_cmds.push_back(cmd);
58 template <
typename TheCommand,
typename... Args>
59 void submit(Args&&... args)
63 stack().disableActions();
64 auto cmd =
new TheCommand(std::forward<Args>(args)...);
65 cmd->redo(stack().context());
66 m_cmds.push_back(cmd);
71 if(last->key() == TheCommand::static_key())
73 auto cmd = safe_cast<TheCommand*>(last);
74 if constexpr(
requires { bool(cmd->compatible(std::forward<Args>(args)...)); })
76 if(cmd->compatible(std::forward<Args>(args)...))
78 cmd->update(std::forward<Args>(args)...);
79 cmd->redo(stack().context());
83 auto cmd =
new TheCommand(std::forward<Args>(args)...);
84 cmd->redo(stack().context());
85 m_cmds.push_back(cmd);
90 cmd->update(std::forward<Args>(args)...);
91 cmd->redo(stack().context());
96 auto cmd =
new TheCommand(std::forward<Args>(args)...);
97 cmd->redo(stack().context());
98 m_cmds.push_back(cmd);
104 template <
typename CommitCommand>
109 auto theCmd =
new CommitCommand;
110 for(
auto& cmd : m_cmds)
112 theCmd->addCommand(cmd);
115 SendStrategy::Quiet::send(stack(), theCmd);
118 stack().enableActions();
122 template <
typename RollbackStrategy = RollbackStrategy::Simple>
125 RollbackStrategy::rollback(stack().context(), m_cmds);
130 stack().enableActions();
136 std::for_each(m_cmds.rbegin(), m_cmds.rend(), [](
auto cmd) { delete cmd; });
139 std::vector<score::Command*> m_cmds;
Definition DocumentContext.hpp:18