carb::settings::getStringArray

Defined in carb/settings/SettingsUtils.h

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

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

See also

getStringArrayFromItemValues() for a function that handles values of mixed or non-string types.

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 is not a string value.

Returns

a std::vector<std::string> of all string array elements. 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 are not string types will instead be defaultValue.