|
OpenCPN Partial API docs
|
Wrapper for configuration variables which lives in a wxBaseConfig object. More...
#include <configvar.h>
Public Member Functions | |
| ConfigVar (const std::string §ion_, const std::string &key_, wxConfigBase *cb) | |
| void | Set (const T &arg) |
| T | Get (const T &default_val) |
Public Member Functions inherited from obs::Observable | |
| Observable (const std::string &_key) | |
| Initiate an object which can apply Notify() and Listen() to given key. | |
| Observable (const KeyProvider &kp) | |
| Initiate an object which can apply Notify() and Listen() to given key. | |
| virtual void | Notify () |
| Notify all listeners to configured key about variable change. | |
| virtual void | Notify (const std::shared_ptr< const void > &p) |
| Notify all listeners to configured key about variable change. | |
| bool | Unlisten (wxEvtHandler *listener, wxEventType ev) |
| Remove window listening to ev from list of listeners. | |
| std::string | GetKey () const override |
| Return the key given to the constructor. | |
Additional Inherited Members | |
Public Attributes inherited from obs::Observable | |
| const std::string | key |
| The key used to create and clone. | |
Protected Member Functions inherited from obs::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(), GetClientData(), GetInt() and/or GetSharedPtr() | |
| void | Notify (const std::string &s, 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(). | |
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 68 of file configvar.h.
| obs::ConfigVar< T >::ConfigVar | ( | const std::string & | section_, |
| const std::string & | key_, | ||
| wxConfigBase * | cb | ||
| ) |
Definition at line 48 of file observable_confvar.cpp.
| T obs::ConfigVar< T >::Get | ( | const T & | default_val | ) |
Definition at line 56 of file observable_confvar.cpp.
| void obs::ConfigVar< T >::Set | ( | const T & | arg | ) |
Definition at line 67 of file observable_confvar.cpp.