48 stack().disableActions();
51 cmd->redo(stack().context());
53 m_cmds.push_back(cmd);
58 stack().disableActions();
59 m_cmds.push_back(cmd);
62 template <
typename TheCommand,
typename... Args>
63 void submit(Args&&... args)
68 stack().disableActions();
69 auto cmd =
new TheCommand(std::forward<Args>(args)...);
70 cmd->redo(stack().context());
71 m_cmds.push_back(cmd);
76 if(last->key() == TheCommand::static_key())
78 auto cmd = safe_cast<TheCommand*>(last);
79 if constexpr(
requires { bool(cmd->compatible(std::forward<Args>(args)...)); })
81 if(cmd->compatible(std::forward<Args>(args)...))
83 cmd->update(std::forward<Args>(args)...);
84 cmd->redo(stack().context());
88 auto cmd =
new TheCommand(std::forward<Args>(args)...);
89 cmd->redo(stack().context());
90 m_cmds.push_back(cmd);
95 cmd->update(std::forward<Args>(args)...);
96 cmd->redo(stack().context());
101 auto cmd =
new TheCommand(std::forward<Args>(args)...);
102 cmd->redo(stack().context());
103 m_cmds.push_back(cmd);
109 template <
typename CommitCommand>
114 auto theCmd =
new CommitCommand;
115 for(
auto& cmd : m_cmds)
117 theCmd->addCommand(cmd);
120 SendStrategy::Quiet::send(stack(), theCmd);
123 stack().enableActions();
127 template <
typename RollbackStrategy = RollbackStrategy::Simple>
132 RollbackStrategy::rollback(stack().context(), m_cmds);
138 stack().enableActions();
144 std::for_each(m_cmds.rbegin(), m_cmds.rend(), [](
auto cmd) { delete cmd; });
147 std::vector<score::Command*> m_cmds;
Definition DocumentContext.hpp:18