carb::dictionary::getStringArray

Defined in carb/dictionary/DictionaryUtils.h

inline std::vector<std::string> carb::dictionary::getStringArray(const IDictionary *dict, const Item *baseItem, const char *path)

Attempts to retrieve an array of string values from a given dictionary path.

Thread Safety

This call in itself is thread safe, however the retrieved array may contain unexpected or incorrect values if another thread is modifying the same item in the dictionary simultaneously.

Parameters
  • dict[in] The IDictionary interface to use to access the items in the dictionary. This must not be nullptr. This must be the same interface that was originally used to create the dictionary baseItem.

  • baseItem[in] The base item to retrieve the item values relative to. This is expected to contain the child path path. This may not be nullptr.

  • path[in] The item path relative to baseItem that indicates where to find the item whose value should be retrieved. This may be nullptr to retrieve the values of baseItem itself. The value at this path is expected to be an array of strings.

Returns

A vector of string values for the array at the path path relative to baseItem. If the given path is not an array item, a vector containing a single value will be returned. If path points to an item that is an array of something other than strings, a vector of empty strings will be returned instead.