carb::settings::getStringAt

Defined in carb/settings/SettingsUtils.h

inline std::string carb::settings::getStringAt(const ISettings *settings, const char *path, size_t index, const std::string &defaultValue = "")

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;

See also

ISettings::getStringBuffer, 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.

  • defaultValue – The value that is returned if path is not a valid path, not an array of strings, or the index does not exist.

Returns

A std::string representation of the item value.