Toast Engine
Loading...
Searching...
No Matches
toast::settings::Setting< T > Class Template Reference

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 *

Detailed Description

template<typename T>
class toast::settings::Setting< T >

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()

Member Function Documentation

◆ onChange()

template<typename T>
void toast::settings::Setting< T >::onChange ( std::function< void(T)> callback)
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


The documentation for this class was generated from the following file: