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

Method addColorSpace

src/OpenColorIO/ViewingRules.cpp:255–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255void ViewingRules::addColorSpace(size_t ruleIndex, const char * colorSpace)
256{
257 m_impl->validatePosition(ruleIndex);
258 if (!colorSpace || !*colorSpace)
259 {
260 std::ostringstream oss;
261 oss << "Viewing rules: rule '" << std::string(m_impl->m_rules[ruleIndex]->getName())
262 << "' at index '" << ruleIndex << "': colorspace should have a non-empty name.";
263 throw Exception(oss.str().c_str());
264 }
265 if (m_impl->m_rules[ruleIndex]->m_encodings.getNumTokens() != 0)
266 {
267 std::ostringstream oss;
268 oss << "Viewing rules: rule '" << std::string(m_impl->m_rules[ruleIndex]->getName())
269 << "' at index '" << ruleIndex
270 << "': colorspace can't be added if there are encodings.";
271 throw Exception(oss.str().c_str());
272 }
273 m_impl->m_rules[ruleIndex]->m_colorSpaces.addToken(colorSpace);
274}
275
276void ViewingRules::removeColorSpace(size_t ruleIndex, size_t colorSpaceIndex)
277{

Callers

nothing calls this directly

Calls 4

getNumTokensMethod · 0.80
addTokenMethod · 0.80
validatePositionMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected