| 176 | } |
| 177 | |
| 178 | void 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 | |
| 197 | void ViewingRules::Impl::validate( |
| 198 | std::function<ConstColorSpaceRcPtr(const char *)> colorSpaceAccessor, |
no test coverage detected