Common/Config: Add a utility class to suppress config change callbacks.

This commit is contained in:
Jordan Woyak
2019-03-03 10:58:37 -06:00
parent 2a3c075330
commit bbc6bf5294
8 changed files with 42 additions and 1 deletions

View File

@ -96,4 +96,15 @@ void SetBaseOrCurrent(const ConfigInfo<T>& info, const std::common_type_t<T>& va
else
Set<T>(LayerType::CurrentRun, info, value);
}
}
// Used to defer InvokeConfigChangedCallbacks until after the completion of many config changes.
class ConfigChangeCallbackGuard
{
public:
ConfigChangeCallbackGuard();
~ConfigChangeCallbackGuard();
ConfigChangeCallbackGuard(const ConfigChangeCallbackGuard&) = delete;
ConfigChangeCallbackGuard& operator=(const ConfigChangeCallbackGuard&) = delete;
};
} // namespace Config