| 646 | } |
| 647 | |
| 648 | void FileRules::Impl::moveRule(size_t ruleIndex, int offset) |
| 649 | { |
| 650 | validatePosition(ruleIndex, DEFAULT_NOT_ALLOWED); |
| 651 | int newIndex = (int)ruleIndex + offset; |
| 652 | if (newIndex < 0 || newIndex >= (int)m_rules.size() - 1) |
| 653 | { |
| 654 | std::ostringstream oss; |
| 655 | oss << "File rules: rule at index '" << ruleIndex << "' may not be moved to index '" |
| 656 | << newIndex << "'."; |
| 657 | throw Exception(oss.str().c_str()); |
| 658 | } |
| 659 | auto rule = m_rules[ruleIndex]; |
| 660 | m_rules.erase(m_rules.begin() + ruleIndex); |
| 661 | m_rules.insert(m_rules.begin() + newIndex, rule); |
| 662 | } |
| 663 | |
| 664 | |
| 665 | void FileRules::Impl::validate(const Config & cfg) const |
no test coverage detected