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

Method validateNewRule

src/OpenColorIO/ViewingRules.cpp:178–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void ViewingRules::Impl::validateNewRule(const char * name) const
179{
180 if (!name || !*name)
181 {
182 throw Exception("Viewing rules: rule must have a non-empty name.");
183 }
184 auto existingRule = std::find_if(m_rules.begin(), m_rules.end(),
185 [name](const ViewingRuleRcPtr & rule)
186 {
187 return 0 == Platform::Strcasecmp(name, rule->getName());
188 });
189 if (existingRule != m_rules.end())
190 {
191 std::ostringstream oss;
192 oss << "Viewing rules: A rule named '" << name << "' already exists.";
193 throw Exception(oss.str().c_str());
194 }
195}
196
197void ViewingRules::Impl::validate(
198 std::function<ConstColorSpaceRcPtr(const char *)> colorSpaceAccessor,

Callers 1

insertRuleMethod · 0.45

Calls 4

StrcasecmpFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected