Files
PowerToys/src/modules/fancyzones/FancyZonesLib/SettingsObserver.h
sosssego 78f5b4c3a4 [Analyzers][CPP] turn on Warning 4100 (#21449)
* Analyzers CPP

Changing the warning level from 3 to 4.
change some project files to make them use the warning config in cpp props file.

* Analyzers C++ turn on warning 4706

Change Cpp.Build.props file to enable 4706
fix BugReportTool code to get rid of 4706

* Turn on warning 4100 and fix the code

* Follow c++ core guidelines

* Adapting to PR comments
2022-11-09 14:41:14 +00:00

31 lines
705 B
C++

#pragma once
#include <unordered_set>
#include <FancyZonesLib/Settings.h>
#include <FancyZonesLib/SettingsConstants.h>
class SettingsObserver
{
public:
SettingsObserver(std::unordered_set<SettingId> observedSettings) :
m_observedSettings(std::move(observedSettings))
{
FancyZonesSettings::instance().AddObserver(*this);
}
virtual ~SettingsObserver()
{
FancyZonesSettings::instance().RemoveObserver(*this);
}
virtual void SettingsUpdate(SettingId /*type*/) {}
bool WantsToBeNotified(SettingId type) const noexcept
{
return m_observedSettings.contains(type);
}
protected:
std::unordered_set<SettingId> m_observedSettings;
};