|
Toast Engine
|
Typed handle to a declared setting. More...
#include <settings.hpp>
Public Member Functions | |
| Setting (Entry *entry) | |
| auto | valid () const -> bool |
| auto | value () const -> T |
| operator T () const | |
| void | set (T v) |
| void | onChange (std::function< void(T)> callback) |
Runs callback whenever this setting changes, and once immediately with the current value. | |
| auto | entry () const -> Entry * |
Typed handle to a declared setting.
Cheap to copy and stable for the process - entries are never removed. Reading is value(), writing is set(), and a write persists on the next Settings::save()
|
inline |
Runs callback whenever this setting changes, and once immediately with the current value.
The immediate call is what lets a system express "apply this value" once and have both the initial state and every later change go through the same path