Dont consider OptionManager watcher list as part of the state of the option manager

This commit is contained in:
Maxime Coste 2016-08-21 20:24:18 +01:00
parent c7876c9b4b
commit 0de4fc75d0
2 changed files with 5 additions and 5 deletions

View File

@ -26,13 +26,13 @@ OptionManager::~OptionManager()
kak_assert(m_watchers.empty()); kak_assert(m_watchers.empty());
} }
void OptionManager::register_watcher(OptionManagerWatcher& watcher) void OptionManager::register_watcher(OptionManagerWatcher& watcher) const
{ {
kak_assert(not contains(m_watchers, &watcher)); kak_assert(not contains(m_watchers, &watcher));
m_watchers.push_back(&watcher); m_watchers.push_back(&watcher);
} }
void OptionManager::unregister_watcher(OptionManagerWatcher& watcher) void OptionManager::unregister_watcher(OptionManagerWatcher& watcher) const
{ {
auto it = find(m_watchers.begin(), m_watchers.end(), &watcher); auto it = find(m_watchers.begin(), m_watchers.end(), &watcher);
kak_assert(it != m_watchers.end()); kak_assert(it != m_watchers.end());

View File

@ -91,8 +91,8 @@ public:
using OptionList = Vector<const Option*>; using OptionList = Vector<const Option*>;
OptionList flatten_options() const; OptionList flatten_options() const;
void register_watcher(OptionManagerWatcher& watcher); void register_watcher(OptionManagerWatcher& watcher) const;
void unregister_watcher(OptionManagerWatcher& watcher); void unregister_watcher(OptionManagerWatcher& watcher) const;
void on_option_changed(const Option& option) override; void on_option_changed(const Option& option) override;
private: private:
@ -105,7 +105,7 @@ private:
Vector<std::unique_ptr<Option>, MemoryDomain::Options> m_options; Vector<std::unique_ptr<Option>, MemoryDomain::Options> m_options;
OptionManager* m_parent; OptionManager* m_parent;
Vector<OptionManagerWatcher*, MemoryDomain::Options> m_watchers; mutable Vector<OptionManagerWatcher*, MemoryDomain::Options> m_watchers;
}; };
template<typename T> template<typename T>