|
OpenCPN Partial API docs
|
Wrapper for configuration variables which lives in a wxBaseConfig object. More...
#include <observable_confvar.h>
Public Member Functions | |
| ConfigVar (const std::string §ion_, const std::string &key_, wxConfigBase *cb) | |
| void | Set (const T &arg) |
| const T | Get (const T &default_val) |
Public Member Functions inherited from Observable | |
| Observable (const std::string &_key) | |
| Observable (const KeyProvider &kp) | |
| ~Observable () override=default | |
| Destroy the Observable object. | |
| virtual void | Notify () |
| Notify all listeners about variable change. | |
| void | Notify (const std::shared_ptr< const void > &p) |
| bool | Unlisten (wxEvtHandler *listener, wxEventType ev) |
| Remove window listening to ev from list of listeners. | |
| std::string | GetKey () const override |
| Get the Key object from the Key Provider. | |
Public Member Functions inherited from KeyProvider | |
| virtual | ~KeyProvider ()=default |
| Destroy the Key Provider object. | |
Additional Inherited Members | |
Public Attributes inherited from Observable | |
| const std::string | key |
| The key used to create and clone. | |
Protected Member Functions inherited from Observable | |
| void | Notify (const std::shared_ptr< const void > &ptr, const std::string &s, int num, void *client_data) |
| Notify all listeners: send them a 'type' ObservedEvt message as defined by listen() with optional data available using GetString() and/or GetClientData(). | |
| void | Notify (const std::string &s, void *client_data) |
Wrapper for configuration variables which lives in a wxBaseConfig object.
Supports int, bool, double, std::string and wxString. Besides basic set()/get() also provides notification events when value changes.
Client usage when reading, setting a value and notifying listeners:
Client usage, listening to value changes.
Definition at line 69 of file observable_confvar.h.
| ConfigVar< T >::ConfigVar | ( | const std::string & | section_, |
| const std::string & | key_, | ||
| wxConfigBase * | cb | ||
| ) |
Definition at line 47 of file observable_confvar.cpp.
| const T ConfigVar< T >::Get | ( | const T & | default_val | ) |
Definition at line 55 of file observable_confvar.cpp.
| void ConfigVar< T >::Set | ( | const T & | arg | ) |
Definition at line 66 of file observable_confvar.cpp.