diff options
| author | 2014-04-22 10:05:56 -0400 | |
|---|---|---|
| committer | 2014-05-20 03:02:46 +0200 | |
| commit | 7b59a04d9406fde0847d1ce68c3bf2fde018c198 (patch) | |
| tree | d0dc635c838c47ca674f372fc8dafc7d59ca6994 /include/plist/plist.h | |
| parent | b3cbcc256ab1f034dc3122517aab1be2a9d932e6 (diff) | |
| download | libplist-7b59a04d9406fde0847d1ce68c3bf2fde018c198.tar.gz libplist-7b59a04d9406fde0847d1ce68c3bf2fde018c198.tar.bz2 | |
Added Doxygen comments to explicitly describe memory buffer ownership/responsibility.
Diffstat (limited to 'include/plist/plist.h')
| -rw-r--r-- | include/plist/plist.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index 4dd76a6..b855043 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -235,7 +235,7 @@ extern "C" | |||
| 235 | * The previous item at index n will be freed using #plist_free | 235 | * The previous item at index n will be freed using #plist_free |
| 236 | * | 236 | * |
| 237 | * @param node the node of type #PLIST_ARRAY | 237 | * @param node the node of type #PLIST_ARRAY |
| 238 | * @param item the new item at index n | 238 | * @param item the new item at index n. The array is responsible for freeing item when it is no longer needed. |
| 239 | * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range. | 239 | * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range. |
| 240 | */ | 240 | */ |
| 241 | PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n); | 241 | PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n); |
| @@ -244,7 +244,7 @@ extern "C" | |||
| 244 | * Append a new item at the end of a #PLIST_ARRAY node. | 244 | * Append a new item at the end of a #PLIST_ARRAY node. |
| 245 | * | 245 | * |
| 246 | * @param node the node of type #PLIST_ARRAY | 246 | * @param node the node of type #PLIST_ARRAY |
| 247 | * @param item the new item | 247 | * @param item the new item. The array is responsible for freeing item when it is no longer needed. |
| 248 | */ | 248 | */ |
| 249 | PLIST_API void plist_array_append_item(plist_t node, plist_t item); | 249 | PLIST_API void plist_array_append_item(plist_t node, plist_t item); |
| 250 | 250 | ||
| @@ -252,14 +252,14 @@ extern "C" | |||
| 252 | * Insert a new item at position n in a #PLIST_ARRAY node. | 252 | * Insert a new item at position n in a #PLIST_ARRAY node. |
| 253 | * | 253 | * |
| 254 | * @param node the node of type #PLIST_ARRAY | 254 | * @param node the node of type #PLIST_ARRAY |
| 255 | * @param item the new item to insert | 255 | * @param item the new item to insert. The array is responsible for freeing item when it is no longer needed. |
| 256 | * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range. | 256 | * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range. |
| 257 | */ | 257 | */ |
| 258 | PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n); | 258 | PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n); |
| 259 | 259 | ||
| 260 | /** | 260 | /** |
| 261 | * Remove an existing position in a #PLIST_ARRAY node. | 261 | * Remove an existing position in a #PLIST_ARRAY node. |
| 262 | * Removed position will be freed using #plist_free | 262 | * Removed position will be freed using #plist_free. |
| 263 | * | 263 | * |
| 264 | * @param node the node of type #PLIST_ARRAY | 264 | * @param node the node of type #PLIST_ARRAY |
| 265 | * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range. | 265 | * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range. |
| @@ -281,8 +281,8 @@ extern "C" | |||
| 281 | PLIST_API uint32_t plist_dict_get_size(plist_t node); | 281 | PLIST_API uint32_t plist_dict_get_size(plist_t node); |
| 282 | 282 | ||
| 283 | /** | 283 | /** |
| 284 | * Create iterator of a #PLIST_DICT node. | 284 | * Create an iterator of a #PLIST_DICT node. |
| 285 | * The allocated iterator shoult be freed with tandard free function | 285 | * The allocated iterator should be freed with the standard free function. |
| 286 | * | 286 | * |
| 287 | * @param node the node of type #PLIST_DICT | 287 | * @param node the node of type #PLIST_DICT |
| 288 | * @param iter iterator of the #PLIST_DICT node | 288 | * @param iter iterator of the #PLIST_DICT node |
| @@ -294,8 +294,10 @@ extern "C" | |||
| 294 | * | 294 | * |
| 295 | * @param node the node of type #PLIST_DICT | 295 | * @param node the node of type #PLIST_DICT |
| 296 | * @param iter iterator of the dictionary | 296 | * @param iter iterator of the dictionary |
| 297 | * @param key a location to store the key, or NULL. | 297 | * @param key a location to store the key, or NULL. The caller is responsible |
| 298 | * @param val a location to store the value, or NULL. | 298 | * for freeing the the returned string. |
| 299 | * @param val a location to store the value, or NULL. The caller should *not* | ||
| 300 | * free the returned value. | ||
| 299 | */ | 301 | */ |
| 300 | PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); | 302 | PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); |
| 301 | 303 | ||
| @@ -303,7 +305,7 @@ extern "C" | |||
| 303 | * Get key associated to an item. Item must be member of a dictionary | 305 | * Get key associated to an item. Item must be member of a dictionary |
| 304 | * | 306 | * |
| 305 | * @param node the node | 307 | * @param node the node |
| 306 | * @param key a location to store the key. | 308 | * @param key a location to store the key. The caller is responsible for freeing the returned string. |
| 307 | */ | 309 | */ |
| 308 | PLIST_API void plist_dict_get_item_key(plist_t node, char **key); | 310 | PLIST_API void plist_dict_get_item_key(plist_t node, char **key); |
| 309 | 311 | ||
| @@ -312,7 +314,8 @@ extern "C" | |||
| 312 | * | 314 | * |
| 313 | * @param node the node of type #PLIST_DICT | 315 | * @param node the node of type #PLIST_DICT |
| 314 | * @param key the identifier of the item to get. | 316 | * @param key the identifier of the item to get. |
| 315 | * @return the item or NULL if node is not of type #PLIST_DICT | 317 | * @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free |
| 318 | * the returned node. | ||
| 316 | */ | 319 | */ |
| 317 | PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key); | 320 | PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key); |
| 318 | 321 | ||
| @@ -485,7 +488,8 @@ extern "C" | |||
| 485 | * Forces type of node to #PLIST_STRING | 488 | * Forces type of node to #PLIST_STRING |
| 486 | * | 489 | * |
| 487 | * @param node the node | 490 | * @param node the node |
| 488 | * @param val the string value | 491 | * @param val the string value. The string is copied when set and will be |
| 492 | * freed by the node. | ||
| 489 | */ | 493 | */ |
| 490 | PLIST_API void plist_set_string_val(plist_t node, const char *val); | 494 | PLIST_API void plist_set_string_val(plist_t node, const char *val); |
| 491 | 495 | ||
| @@ -521,7 +525,8 @@ extern "C" | |||
| 521 | * Forces type of node to #PLIST_DATA | 525 | * Forces type of node to #PLIST_DATA |
| 522 | * | 526 | * |
| 523 | * @param node the node | 527 | * @param node the node |
| 524 | * @param val the binary buffer | 528 | * @param val the binary buffer. The buffer is copied when set and will |
| 529 | * be freed by the node. | ||
| 525 | * @param length the length of the buffer | 530 | * @param length the length of the buffer |
| 526 | */ | 531 | */ |
| 527 | PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length); | 532 | PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length); |
