ScopedSubscription#
Fully qualified name: carb::settings::ScopedSubscription
Defined in carb/settings/SettingsUtils.h
-
class ScopedSubscription#
Helper class to add a setting node or tree change subscription that will be automatically unregistered when the object goes out of scope.
Public Functions
- inline ScopedSubscription(
- const char *path,
- carb::dictionary::OnNodeChangeEventFn fn,
- void *userData,
Constructor: creates a new scoped subscription for a settings node change.
- Parameters:
path – [in] The path to the setting node or branch to watch. This may not be
nullptr
.fn – [in] The callback handler function to call when the watched setting
path
is created, modified, or destroyed. This may not benullptr
.userData – [in] Caller provided data that will be passed unmodified to the callback function.
- inline ScopedSubscription(
- const char *path,
- carb::dictionary::OnTreeChangeEventFn fn,
- void *userData,
Constructor: creates a new scoped subscription for a settings tree change.
- Parameters:
path – [in] The path to the setting tree to watch. This may not be
nullptr
.fn – [in] The callback handler function to call when the watched setting
path
is created, modified, or destroyed. This may not benullptr
.userData – [in] Caller provided data that will be passed unmodified to the callback function.
-
inline ScopedSubscription(ScopedSubscription &&other)#
Move Constructor: moves another object into this one.
- Parameters:
other – [inout] Another object to move its values from into this one.
-
inline ~ScopedSubscription()#
Destructor: unsubscribes from this change watch.
-
inline ScopedSubscription &operator=(ScopedSubscription &&other)#
Move-assigns another object into this one.
- Parameters:
other – [inout] Another object to move its values from into this one.
- Returns:
A reference to this object.
-
inline explicit operator bool() const noexcept#
Operator to test whether the contained change subscription is valid.
- Returns:
true
if the contained subscription object is valid. Returnsfalse
otherwise.