getStringAtOpt#

Fully qualified name: carb::settings::getStringAtOpt

Defined in carb/settings/SettingsUtils.h

inline cpp::optional<omni::string> carb::settings::getStringAtOpt(
const ISettings *settings,
cpp::string_view path,
size_t index,
)#

Retrieves a string from an array of string-type setting for simplicity.

Equivalent to:

ScopedRead lock(settings);
if (auto value = settings->getStringViewAt(path, index))
    return omni::string(*value);
return cpp::nullopt;

See also

ISettings::getStringValue, getString()

Parameters:
  • settings – The acquired ISettings interface.

  • path – The setting key path to retrieve (must be an array of strings or defaultValue will be returned).

  • index – The array index to retrieve.

Returns:

A cpp::optional object that both indicates whether the requested value could be retrieved and the string representation of the item value itself if the value could be retrieved.