@@ -133,45 +133,33 @@ bool RuleWithOperator::executeOperatorAt(Transaction *trans, const std::string &
133
133
134
134
void RuleWithOperator::getVariablesExceptions(Transaction *t,
135
135
variables::Variables *exclusion, variables::Variables *addition) {
136
- for (const auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_tag) { // cppcheck-suppress ctunullpointer
137
- if (containsTag(*a.first.get(), t) == false) {
138
- continue;
139
- }
140
- Variable *b = a.second.get();
141
- if (dynamic_cast<variables::VariableModificatorExclusion*>(b)) {
142
- exclusion->push_back(
143
- dynamic_cast<variables::VariableModificatorExclusion*>(
144
- b)->m_base.get());
145
- } else {
146
- addition->push_back(b);
136
+ for (const auto &[tag, v] : t->m_rules->m_exceptions.m_variable_update_target_by_tag) { // cppcheck-suppress ctunullpointer
137
+ if (containsTag(*tag.get(), t)) {
138
+ if (Variable *b{v.get()};dynamic_cast<variables::VariableModificatorExclusion*>(b)) {
139
+ exclusion->push_back(dynamic_cast<variables::VariableModificatorExclusion*>(b)->m_base.get());
140
+ } else {
141
+ addition->push_back(b);
142
+ }
147
143
}
148
144
}
149
145
150
- for (const auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_msg) {
151
- if (containsMsg(*a.first.get(), t) == false) {
152
- continue;
153
- }
154
- Variable *b = a.second.get();
155
- if (dynamic_cast<variables::VariableModificatorExclusion*>(b)) {
156
- exclusion->push_back(
157
- dynamic_cast<variables::VariableModificatorExclusion*>(
158
- b)->m_base.get());
159
- } else {
160
- addition->push_back(b);
146
+ for (const auto &[msg, v] : t->m_rules->m_exceptions.m_variable_update_target_by_msg) {
147
+ if (containsMsg(*msg.get(), t)) {
148
+ if (Variable *b{v.get()}; dynamic_cast<variables::VariableModificatorExclusion *>(b)) {
149
+ exclusion->push_back(dynamic_cast<variables::VariableModificatorExclusion *>(b)->m_base.get());
150
+ } else {
151
+ addition->push_back(b);
152
+ }
161
153
}
162
154
}
163
155
164
- for (const auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_id) {
165
- if (m_ruleId != a.first) {
166
- continue;
167
- }
168
- Variable *b = a.second.get();
169
- if (dynamic_cast<variables::VariableModificatorExclusion*>(b)) {
170
- exclusion->push_back(
171
- dynamic_cast<variables::VariableModificatorExclusion*>(
172
- b)->m_base.get());
173
- } else {
174
- addition->push_back(b);
156
+ for (const auto &[id, v] : t->m_rules->m_exceptions.m_variable_update_target_by_id) { // cppcheck-suppress unassignedVariable
157
+ if (m_ruleId == id) {
158
+ if (Variable *b{v.get()};dynamic_cast<variables::VariableModificatorExclusion *>(b)) {
159
+ exclusion->push_back(dynamic_cast<variables::VariableModificatorExclusion *>(b)->m_base.get());
160
+ } else {
161
+ addition->push_back(b);
162
+ }
175
163
}
176
164
}
177
165
}
0 commit comments