getStringOpt#

Fully qualified name: carb::settings::getStringOpt

Defined in carb/settings/SettingsUtils.h

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

Retrieves a string from a string-type setting for simplicity.

Equivalent to:

ScopedLock lock(settings);
if (auto value = settings->getStringView(path))
    return omni::string(*value);
return cpp::nullopt;

See also

ISettings::getStringBufferS, getStringAt()

Parameters:
  • settings – The acquired ISettings interface.

  • path – The setting key path to retrieve (must be a string or defaultValue will be returned).

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.