walkSettings#
Fully qualified name: carb::settings::walkSettings
Defined in carb/settings/SettingsUtils.h
-
template<typename ElementData, typename OnItemFnType>
inline void carb::settings::walkSettings( - carb::dictionary::IDictionary *idict,
- carb::settings::ISettings *settings,
- dictionary::WalkerMode walkerMode,
- const char *rootPath,
- ElementData rootElementData,
- OnItemFnType onItemFn,
- void *userData,
A function for walking all of the settings from a given root.
Similar to dictionary::walkDictionary().
Note
The callback is fired with a ScopedRead held to ensure that the dictionary can be walked safely. If your callback writes to settings, you must hold a ScopedWrite while calling walkSettings() to ensure the operation is thread safe.
- Template Parameters:
ElementData – Type of the second parameter passed to
onItemFn
.OnItemFnType – Type of the invocable
onItemFn
.
- Parameters:
idict – The acquired dictionary::IDictionary interface.
settings – The acquired ISettings interface.
walkerMode – See dictionary::WalkerMode.
rootPath – The settings root to begin the walk at. An empty string or “/” is considered the root of the settings tree.
rootElementData – A value of type
ElementData
that is passed as the second parameter toonItemFn
. This value is not used bywalkSettings()
and is intended to be used only by the caller and theonItemFn
invocable.onItemFn – An invocable that is invoked for each setting value encountered. The type of this invocable should be
ElementData(const char*, ElementData, void*)
: the encountered item path is the first parameter, followed by the parent’sElementData
, followed byuserData
. The return value is only used for dictionary and array settings: the returnedElementData
will be passed toonItemFn
invocations for child settings; the return value is otherwise ignored.userData – A caller-specific value that is not used but is passed to every
onItemFn
invocation.