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

Method setStringVar

src/OpenColorIO/Context.cpp:288–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288void Context::setStringVar(const char * name, const char * value) noexcept
289{
290 if (!name || !*name)
291 {
292 return;
293 }
294
295 AutoMutex lock(getImpl()->m_resultsCacheMutex);
296
297 // Set the value if specified.
298 if (value)
299 {
300 EnvMap::iterator iter = getImpl()->m_envMap.find(name);
301 if (iter != getImpl()->m_envMap.end())
302 {
303 if (0 != strcmp(iter->second.c_str(), value))
304 {
305 iter->second = value;
306 }
307 else
308 {
309 // Do not flush the cache because nothing changed.
310 return;
311 }
312 }
313 else
314 {
315 getImpl()->m_envMap[name] = value;
316 }
317 }
318 // If a null value is specified, erase it.
319 else
320 {
321 EnvMap::const_iterator iter = getImpl()->m_envMap.find(name);
322 if (iter != getImpl()->m_envMap.end())
323 {
324 getImpl()->m_envMap.erase(iter);
325 }
326 }
327
328 getImpl()->clearCaches();
329}
330
331const char * Context::getStringVar(const char * name) const noexcept
332{

Callers 10

test_interfaceMethod · 0.95
test_interfaceMethod · 0.95
resolveStringVarMethod · 0.45
resolveFileLocationMethod · 0.45
addEnvironmentVarMethod · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45

Calls 4

eraseMethod · 0.80
clearCachesMethod · 0.80
getImplFunction · 0.50
endMethod · 0.45

Tested by 7

test_interfaceMethod · 0.76
test_interfaceMethod · 0.76
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36