Debian Codegraph @

BambooTracker/command/instrument/remove_instrument_command.cpp

raw
1 /*
2 * SPDX-FileCopyrightText: 2018 Rerrah
3 * SPDX-License-Identifier: MIT
4 */
5
6 #include "remove_instrument_command.hpp"
7 #include <utility>
8
9 RemoveInstrumentCommand::RemoveInstrumentCommand(std::weak_ptr<InstrumentsManager> manager,
10 int number)
11 : AbstractCommand(CommandId::RemoveInstrument), manager_(manager), number_(number)
12 {
13 }
14
15 bool RemoveInstrumentCommand::redo()
16 {
17 inst_ = manager_.lock()->removeInstrument(number_);
18 return true;
19 }
20
21 bool RemoveInstrumentCommand::undo()
22 {
23 manager_.lock()->addInstrument(inst_.release());
24 return true;
25 }