| 301 | } |
| 302 | |
| 303 | void ViewingRules::addEncoding(size_t ruleIndex, const char * encoding) |
| 304 | { |
| 305 | m_impl->validatePosition(ruleIndex); |
| 306 | if (!encoding || !*encoding) |
| 307 | { |
| 308 | std::ostringstream oss; |
| 309 | oss << "Viewing rules: rule '" << std::string(m_impl->m_rules[ruleIndex]->getName()) |
| 310 | << "' at index '" << ruleIndex << "': encoding should have a non-empty name."; |
| 311 | throw Exception(oss.str().c_str()); |
| 312 | } |
| 313 | if (m_impl->m_rules[ruleIndex]->m_colorSpaces.getNumTokens() != 0) |
| 314 | { |
| 315 | std::ostringstream oss; |
| 316 | oss << "Viewing rules: rule '" << std::string(m_impl->m_rules[ruleIndex]->getName()) |
| 317 | << "' at index '" << ruleIndex |
| 318 | << "': encoding can't be added if there are colorspaces."; |
| 319 | throw Exception(oss.str().c_str()); |
| 320 | } |
| 321 | m_impl->m_rules[ruleIndex]->m_encodings.addToken(encoding); |
| 322 | } |
| 323 | |
| 324 | void ViewingRules::removeEncoding(size_t ruleIndex, size_t encodingIndex) |
| 325 | { |