MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / moveRule

Method moveRule

src/OpenColorIO/FileRules.cpp:648–662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646}
647
648void 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
665void FileRules::Impl::validate(const Config & cfg) const

Callers 2

increaseRulePriorityMethod · 0.80
decreaseRulePriorityMethod · 0.80

Calls 4

eraseMethod · 0.80
insertMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected