Stores a value and observes it's changes, notifying observers.
More...
#include <AUI/Util/AFieldObservable.h>
|
using | Observer = std::function<void()> |
|
using | ObserverHandle = Observer* |
|
|
| AFieldObservable (T initial=T()) |
|
void | setValue (T t, ObserverHandle exceptObserver=nullptr) |
|
void | notifyObservers (ObserverHandle exceptObserver=nullptr) |
|
AFieldObservable & | operator= (T t) |
|
T & | operator+= (T t) |
|
T & | operator-= (T t) |
|
T & | operator*= (T t) |
|
T & | operator/= (T t) |
|
| operator const T & () const noexcept |
|
const T & | value () const noexcept |
|
T * | operator-> () noexcept |
|
T const * | operator-> () const noexcept |
|
template<typename Observer_t> |
ObserverHandle | addObserver (Observer_t &&observer) |
| Adds an observer, immediately feeding the observer with the current value.
|
|
template<typename Observer_t> |
ObserverHandle | operator<< (Observer_t observer) |
| Adds an observer, immediately feeding the observer with the current value.
|
|
void | operator>> (ObserverHandle h) |
| Removes an observer.
|
|
void | removeObserver (ObserverHandle h) |
| Removes an observer.
|
|
template<aui::invocable< const T & > AdapterCallable> |
AFieldObservableAdapter< T, std::decay_t< AdapterCallable > > | operator() (AdapterCallable &&callable) noexcept |
|
template<typename T>
class AFieldObservable< T >
Stores a value and observes it's changes, notifying observers.
◆ addObserver()
template<typename T>
template<typename Observer_t>
Adds an observer, immediately feeding the observer with the current value.
- Parameters
-
observer | observer. Optionally can accept the AFieldObservable's stored type as the first argument. |
◆ operator<<()
template<typename T>
template<typename Observer_t>
Adds an observer, immediately feeding the observer with the current value.
- Parameters
-
observer | observer. Optionally can accept the AFieldObservable's stored type as the first argument. |
The documentation for this class was generated from the following file: