44 stack().disableActions();
45 cmd->redo(stack().context());
46 m_cmds.push_back(cmd);
51 stack().disableActions();
52 m_cmds.push_back(cmd);
55 template <
typename TheCommand,
typename... Args>
56 void submit(Args&&... args)
60 stack().disableActions();
61 auto cmd =
new TheCommand(std::forward<Args>(args)...);
62 cmd->redo(stack().context());
63 m_cmds.push_back(cmd);
68 if(last->key() == TheCommand::static_key())
70 safe_cast<TheCommand*>(last)->update(std::forward<Args>(args)...);
71 safe_cast<TheCommand*>(last)->redo(stack().context());
75 auto cmd =
new TheCommand(std::forward<Args>(args)...);
76 cmd->redo(stack().context());
77 m_cmds.push_back(cmd);
83 template <
typename CommitCommand>
88 auto theCmd =
new CommitCommand;
89 for(
auto& cmd : m_cmds)
91 theCmd->addCommand(cmd);
94 SendStrategy::Quiet::send(stack(), theCmd);
97 stack().enableActions();
101 template <
typename RollbackStrategy>
104 RollbackStrategy::rollback(stack().context(), m_cmds);
109 stack().enableActions();
115 std::for_each(m_cmds.rbegin(), m_cmds.rend(), [](
auto cmd) { delete cmd; });
118 std::vector<score::Command*> m_cmds;
Definition DocumentContext.hpp:18