getStringFromItemValueAt#

Fully qualified name: carb::settings::getStringFromItemValueAt

Defined in carb/settings/SettingsUtils.h

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

Retrieves a std::string from an array setting key for simplicity.

Typically to retrieve a string value from an array of carb::dictionary::Item objects, ISettings::createStringBufferFromItemValueAt() must be called, but this means that ISettings::destroyStringBuffer() must be called when finished. This function instead returns a std::string.

Parameters:
  • settings – The acquired ISettings interface.

  • path – The setting key path to retrieve (must be an array 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, or the index does not exist.

Returns:

A std::string representation of the item value.