carb::dictionary::setDictionaryElementAutoType

Defined in carb/dictionary/DictionaryUtils.h

inline void carb::dictionary::setDictionaryElementAutoType(IDictionary *id, Item *dict, const std::string &path, const std::string &value)

Attempts to set a value in a dictionary with an attempt to detect the value type.

Thread Safety

This call is thread safe.

Parameters
  • id[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 dict.

  • dict[in] The base item to act as the root of where to set the value relative to. This may not be nullptr.

  • path[in] The path to the item to set the value in. This path does not need to exist yet in the dictionary. This may be nullptr to create the new value in the dict item itself.

  • value[in] The new value to set expressed as a string. An attempt will be made to detect the type of the data from the contents of the string. If there are surrounding quotation marks, it will be treated as a string. If the value is a case insensitive variant on FALSE or TRUE, it will be treated as a boolean value. If the value fully converts to an integer or floating point value, it will be treated as those types. Otherwise the value is stored unmodified as a string.

Returns

No return value.