| 5349 | // Config::Impl |
| 5350 | |
| 5351 | StringUtils::StringVec Config::Impl::buildInactiveNamesList(InactiveType type) const |
| 5352 | { |
| 5353 | StringUtils::StringVec inactiveNames; |
| 5354 | |
| 5355 | // An API request always supersedes the other lists. |
| 5356 | if (!m_inactiveColorSpaceNamesAPI.empty()) |
| 5357 | { |
| 5358 | inactiveNames = StringUtils::Split(m_inactiveColorSpaceNamesAPI, ','); |
| 5359 | } |
| 5360 | // The env. variable only supersedes the config list. |
| 5361 | else if (!m_inactiveColorSpaceNamesEnv.empty()) |
| 5362 | { |
| 5363 | inactiveNames = StringUtils::Split(m_inactiveColorSpaceNamesEnv, ','); |
| 5364 | } |
| 5365 | else if (!m_inactiveColorSpaceNamesConf.empty()) |
| 5366 | { |
| 5367 | inactiveNames = StringUtils::Split(m_inactiveColorSpaceNamesConf, ','); |
| 5368 | } |
| 5369 | |
| 5370 | StringUtils::StringVec res; |
| 5371 | for (auto & v : inactiveNames) |
| 5372 | { |
| 5373 | v = StringUtils::Trim(v); |
| 5374 | switch (type) |
| 5375 | { |
| 5376 | case INACTIVE_COLORSPACE: |
| 5377 | { |
| 5378 | const auto & cs = getColorSpace(v.c_str()); |
| 5379 | // Only add existing items. |
| 5380 | if (cs) |
| 5381 | { |
| 5382 | // Use the canonical name (alias or role might have been used). |
| 5383 | res.push_back(cs->getName()); |
| 5384 | } |
| 5385 | break; |
| 5386 | } |
| 5387 | case INACTIVE_NAMEDTRANSFORM: |
| 5388 | { |
| 5389 | const auto & nt = getNamedTransform(v.c_str()); |
| 5390 | // Only add existing items. |
| 5391 | if (nt) |
| 5392 | { |
| 5393 | // Use the canonical name (alias might have been used). |
| 5394 | res.push_back(nt->getName()); |
| 5395 | } |
| 5396 | break; |
| 5397 | } |
| 5398 | case INACTIVE_ALL: |
| 5399 | { |
| 5400 | // This is only used to verify that all items of the list do exists (only used by the |
| 5401 | // validate() function. |
| 5402 | res.push_back(v); |
| 5403 | break; |
| 5404 | } |
| 5405 | } |
| 5406 | } |
| 5407 | |
| 5408 | return res; |