carb::dictionary::getStringFromItemValue
Defined in carb/dictionary/DictionaryUtils.h
-
inline std::string carb::dictionary::getStringFromItemValue(const IDictionary *dict, const Item *baseItem, const char *path = nullptr)
Attempts to retrieve the value of an item from a given path in a dictionary.
- Thread Safety
This call is thread safe.
- 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 dictionarybaseItem
.baseItem – [in] The base item to retrieve the item value relative to. This is expected to contain the child path
path
. This may not benullptr
.path – [in] The item path relative to
baseItem
that indicates where to find the item whose value should be retrieved. This may benullptr
to retrieve the value ofbaseItem
itself.
- Returns
A string containing the value of the item at the given path relative to
baseItem
if it exists. If the requested item was not of type ItemType::eString, the value will be converted to a string as best it can. Returns an empty string if no item could be found at the requested path or a string buffer could not be allocated for its name.