getStringAtOpt#

Fully qualified name: carb::settings::getStringAtOpt

Defined in carb/settings/SettingsUtils.h

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

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

Equivalent to:

auto p = settings->getStringBufferAt(path, index); return p ? std::string(p) : defaultValue;

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 std::string representation of the item value itself if the value could be retrieved.