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

Method addEnvironmentVar

src/OpenColorIO/Config.cpp:2166–2189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2164}
2165
2166void Config::addEnvironmentVar(const char * name, const char * defaultValue)
2167{
2168 if (!name || !*name)
2169 {
2170 return;
2171 }
2172
2173 // Note: Only a null default value removes the entry.
2174
2175 if (defaultValue)
2176 {
2177 getImpl()->m_env[std::string(name)] = std::string(defaultValue);
2178 getImpl()->m_context->setStringVar(name, defaultValue);
2179 }
2180 else
2181 {
2182 StringMap::const_iterator iter = getImpl()->m_env.find(std::string(name));
2183 if(iter != getImpl()->m_env.end()) getImpl()->m_env.erase(iter);
2184 getImpl()->m_context->setStringVar(name, nullptr);
2185 }
2186
2187 AutoMutex lock(getImpl()->m_cacheidMutex);
2188 getImpl()->resetCacheIDs();
2189}
2190
2191int Config::getNumEnvironmentVars() const
2192{

Callers 6

test_interfaceMethod · 0.95
_set_valueMethod · 0.45
loadFunction · 0.45
OCIO_ADD_TESTFunction · 0.45
OCIO_ADD_TESTFunction · 0.45

Calls 5

eraseMethod · 0.80
resetCacheIDsMethod · 0.80
getImplFunction · 0.50
setStringVarMethod · 0.45
endMethod · 0.45

Tested by 4

test_interfaceMethod · 0.76
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36