From b9f5dbd3b526385720343f3c0fa596465413aafa Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 2 Apr 2013 13:57:04 +0200 Subject: [PATCH] add an OptionManagerWatcher_AutoRegister class --- src/option_manager.hh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/option_manager.hh b/src/option_manager.hh index e82cb010..895f431d 100644 --- a/src/option_manager.hh +++ b/src/option_manager.hh @@ -162,6 +162,29 @@ public: } }; +struct OptionManagerRegisterFuncs +{ + static void insert(OptionManager& options, OptionManagerWatcher& watcher) + { + options.register_watcher(watcher); + } + static void remove(OptionManager& options, OptionManagerWatcher& watcher) + { + options.unregister_watcher(watcher); + } +}; + +class OptionManagerWatcher_AutoRegister + : public OptionManagerWatcher, + public AutoRegister +{ +public: + OptionManagerWatcher_AutoRegister(OptionManager& options) + : AutoRegister(options) {} +}; + + } #endif // option_manager_hh_INCLUDED