libplist  2.8.0
API Documentation - Return to Homepage

◆ plist_dict_set_item()

PLIST_API plist_err_t plist_dict_set_item ( plist_t node,
const char * key,
plist_t item )

Set item identified by key in a PLIST_DICT node.

The previous item identified by key will be freed using plist_free. If there is no item for the given key a new item will be inserted.

Parameters
nodethe node of type PLIST_DICT
itemthe new item associated to key
keythe identifier of the item to set.
Returns
  • PLIST_ERR_SUCCESS on success.
  • PLIST_ERR_INVALID_ARG if node is not a dictionary, key is NULL, item is NULL, or item is already attached to a parent.
  • PLIST_ERR_NO_MEM if memory allocation failed while creating or inserting the key/value pair.
  • PLIST_ERR_UNKNOWN if an unexpected internal error occurred.