| 3706 | /************************************************************************/ |
| 3707 | |
| 3708 | CPLConfigOptionSetter::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() */ |
nothing calls this directly
no test coverage detected