carb::settings::getStringArrayFromItemValues

Defined in carb/settings/SettingsUtils.h

inline std::vector<std::string> carb::settings::getStringArrayFromItemValues(ISettings *settings, const char *path, const std::string &defaultValue = "")

A helper function for reading a setting value that is an array of mixed values as std::vector<std::string>.

Parameters
  • settings – The acquired ISettings interface.

  • path – The setting key path. If this path does not exist or is not an array, an empty vector will be returned.

  • defaultValue – The value that is returned for each array item if the array item cannot be converted to a string value.

Returns

a std::vector<std::string> of all array elements converted to a string. If the value at path does not exist or is not an array type, an empty vector is returned. Otherwise, a vector is returned with the number of elements matching the number of elements in the value at path (as determined via ISettings::getArrayLength). Any array elements that cannot be converted to a string will instead be defaultValue.