carb::settings::getSettingOrDefault

Defined in omni/extras/SettingsHelpers.h

template<typename T>
T carb::settings::getSettingOrDefault(const char *path, T defaultValue = {})

Access a setting key if present, otherwise returning a default value.

This function does not use the carb::settings::ISettings API to set the value as a default if path does not exist. In order to do that, use setDefaultAndGetSetting().

Template Parameters

T – the type of the return value and default value

Parameters
  • path – The setting key path to check

  • defaultValue – The default value to return if the setting key does not exist

Returns

The value read from path, or defaultValue if the setting key does not exist