comparison base/Command.cpp @ 1450:a12fd0456f0c streaming-csv-writer

Merge from default branch
author Chris Cannam
date Tue, 17 Apr 2018 10:35:42 +0100
parents 48e9f538e6e9
children
comparison
equal deleted inserted replaced
1449:deabf9fd3d28 1450:a12fd0456f0c
22 } 22 }
23 23
24 MacroCommand::~MacroCommand() 24 MacroCommand::~MacroCommand()
25 { 25 {
26 for (size_t i = 0; i < m_commands.size(); ++i) { 26 for (size_t i = 0; i < m_commands.size(); ++i) {
27 delete m_commands[i]; 27 delete m_commands[i];
28 } 28 }
29 } 29 }
30 30
31 void 31 void
32 MacroCommand::addCommand(Command *command) 32 MacroCommand::addCommand(Command *command)
36 36
37 void 37 void
38 MacroCommand::deleteCommand(Command *command) 38 MacroCommand::deleteCommand(Command *command)
39 { 39 {
40 for (std::vector<Command *>::iterator i = m_commands.begin(); 40 for (std::vector<Command *>::iterator i = m_commands.begin();
41 i != m_commands.end(); ++i) { 41 i != m_commands.end(); ++i) {
42 42
43 if (*i == command) { 43 if (*i == command) {
44 m_commands.erase(i); 44 m_commands.erase(i);
45 delete command; 45 delete command;
46 return; 46 return;
47 } 47 }
48 } 48 }
49 } 49 }
50 50
51 bool 51 bool
52 MacroCommand::haveCommands() const 52 MacroCommand::haveCommands() const
56 56
57 void 57 void
58 MacroCommand::execute() 58 MacroCommand::execute()
59 { 59 {
60 for (size_t i = 0; i < m_commands.size(); ++i) { 60 for (size_t i = 0; i < m_commands.size(); ++i) {
61 m_commands[i]->execute(); 61 m_commands[i]->execute();
62 } 62 }
63 } 63 }
64 64
65 void 65 void
66 MacroCommand::unexecute() 66 MacroCommand::unexecute()
67 { 67 {
68 for (size_t i = 0; i < m_commands.size(); ++i) { 68 for (size_t i = 0; i < m_commands.size(); ++i) {
69 m_commands[m_commands.size() - i - 1]->unexecute(); 69 m_commands[m_commands.size() - i - 1]->unexecute();
70 } 70 }
71 } 71 }
72 72
73 QString 73 QString
74 MacroCommand::getName() const 74 MacroCommand::getName() const