MCPcopy Create free account
hub / github.com/OSGeo/gdal / CPLConfigOptionSetter

Method CPLConfigOptionSetter

port/cpl_conv.cpp:3708–3725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3706/************************************************************************/
3707
3708CPLConfigOptionSetter::CPLConfigOptionSetter(const char *pszKey,
3709 const char *pszValue,
3710 bool bSetOnlyIfUndefined)
3711 : m_pszKey(CPLStrdup(pszKey)), m_pszOldValue(nullptr),
3712 m_bRestoreOldValue(false)
3713{
3714 const char *pszOldValue = CPLGetThreadLocalConfigOption(pszKey, nullptr);
3715 if ((bSetOnlyIfUndefined &&
3716 CPLGetConfigOption(pszKey, nullptr) == nullptr) ||
3717 !bSetOnlyIfUndefined)
3718 {
3719 m_bRestoreOldValue = true;
3720 if (pszOldValue)
3721 m_pszOldValue = CPLStrdup(pszOldValue);
3722 CPLSetThreadLocalConfigOption(pszKey,
3723 pszValue ? pszValue : CPL_NULL_VALUE);
3724 }
3725}
3726
3727/************************************************************************/
3728/* ~CPLConfigOptionSetter() */

Callers

nothing calls this directly

Calls 2

CPLStrdupFunction · 0.85

Tested by

no test coverage detected