diff options
Diffstat (limited to 'include/plist')
| -rw-r--r-- | include/plist/plist.h | 198 |
1 files changed, 107 insertions, 91 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index 953ecad..7605975 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -75,6 +75,22 @@ extern "C" | |||
| 75 | #endif | 75 | #endif |
| 76 | /*}}}*/ | 76 | /*}}}*/ |
| 77 | 77 | ||
| 78 | #ifdef LIBPLIST_STATIC | ||
| 79 | #define PLIST_API | ||
| 80 | #elif defined(_WIN32) | ||
| 81 | #ifdef DLL_EXPORT | ||
| 82 | #define PLIST_API __declspec(dllexport) | ||
| 83 | #else | ||
| 84 | #define PLIST_API __declspec(dllimport) | ||
| 85 | #endif | ||
| 86 | #else | ||
| 87 | #if __GNUC__ >= 4 | ||
| 88 | #define PLIST_API __attribute__((visibility("default"))) | ||
| 89 | #else | ||
| 90 | #define PLIST_API | ||
| 91 | #endif | ||
| 92 | #endif | ||
| 93 | |||
| 78 | #include <sys/types.h> | 94 | #include <sys/types.h> |
| 79 | #include <stdarg.h> | 95 | #include <stdarg.h> |
| 80 | #include <stdio.h> | 96 | #include <stdio.h> |
| @@ -180,7 +196,7 @@ extern "C" | |||
| 180 | * @return the created plist | 196 | * @return the created plist |
| 181 | * @sa #plist_type | 197 | * @sa #plist_type |
| 182 | */ | 198 | */ |
| 183 | plist_t plist_new_dict(void); | 199 | PLIST_API plist_t plist_new_dict(void); |
| 184 | 200 | ||
| 185 | /** | 201 | /** |
| 186 | * Create a new root plist_t type #PLIST_ARRAY | 202 | * Create a new root plist_t type #PLIST_ARRAY |
| @@ -188,7 +204,7 @@ extern "C" | |||
| 188 | * @return the created plist | 204 | * @return the created plist |
| 189 | * @sa #plist_type | 205 | * @sa #plist_type |
| 190 | */ | 206 | */ |
| 191 | plist_t plist_new_array(void); | 207 | PLIST_API plist_t plist_new_array(void); |
| 192 | 208 | ||
| 193 | /** | 209 | /** |
| 194 | * Create a new plist_t type #PLIST_STRING | 210 | * Create a new plist_t type #PLIST_STRING |
| @@ -197,7 +213,7 @@ extern "C" | |||
| 197 | * @return the created item | 213 | * @return the created item |
| 198 | * @sa #plist_type | 214 | * @sa #plist_type |
| 199 | */ | 215 | */ |
| 200 | plist_t plist_new_string(const char *val); | 216 | PLIST_API plist_t plist_new_string(const char *val); |
| 201 | 217 | ||
| 202 | /** | 218 | /** |
| 203 | * Create a new plist_t type #PLIST_BOOLEAN | 219 | * Create a new plist_t type #PLIST_BOOLEAN |
| @@ -206,7 +222,7 @@ extern "C" | |||
| 206 | * @return the created item | 222 | * @return the created item |
| 207 | * @sa #plist_type | 223 | * @sa #plist_type |
| 208 | */ | 224 | */ |
| 209 | plist_t plist_new_bool(uint8_t val); | 225 | PLIST_API plist_t plist_new_bool(uint8_t val); |
| 210 | 226 | ||
| 211 | /** | 227 | /** |
| 212 | * Create a new plist_t type #PLIST_INT with an unsigned integer value | 228 | * Create a new plist_t type #PLIST_INT with an unsigned integer value |
| @@ -217,7 +233,7 @@ extern "C" | |||
| 217 | * @note The value is always stored as uint64_t internally. | 233 | * @note The value is always stored as uint64_t internally. |
| 218 | * Use #plist_get_uint_val or #plist_get_int_val to get the unsigned or signed value. | 234 | * Use #plist_get_uint_val or #plist_get_int_val to get the unsigned or signed value. |
| 219 | */ | 235 | */ |
| 220 | plist_t plist_new_uint(uint64_t val); | 236 | PLIST_API plist_t plist_new_uint(uint64_t val); |
| 221 | 237 | ||
| 222 | /** | 238 | /** |
| 223 | * Create a new plist_t type #PLIST_INT with a signed integer value | 239 | * Create a new plist_t type #PLIST_INT with a signed integer value |
| @@ -228,7 +244,7 @@ extern "C" | |||
| 228 | * @note The value is always stored as uint64_t internally. | 244 | * @note The value is always stored as uint64_t internally. |
| 229 | * Use #plist_get_uint_val or #plist_get_int_val to get the unsigned or signed value. | 245 | * Use #plist_get_uint_val or #plist_get_int_val to get the unsigned or signed value. |
| 230 | */ | 246 | */ |
| 231 | plist_t plist_new_int(int64_t val); | 247 | PLIST_API plist_t plist_new_int(int64_t val); |
| 232 | 248 | ||
| 233 | /** | 249 | /** |
| 234 | * Create a new plist_t type #PLIST_REAL | 250 | * Create a new plist_t type #PLIST_REAL |
| @@ -237,7 +253,7 @@ extern "C" | |||
| 237 | * @return the created item | 253 | * @return the created item |
| 238 | * @sa #plist_type | 254 | * @sa #plist_type |
| 239 | */ | 255 | */ |
| 240 | plist_t plist_new_real(double val); | 256 | PLIST_API plist_t plist_new_real(double val); |
| 241 | 257 | ||
| 242 | /** | 258 | /** |
| 243 | * Create a new plist_t type #PLIST_DATA | 259 | * Create a new plist_t type #PLIST_DATA |
| @@ -247,7 +263,7 @@ extern "C" | |||
| 247 | * @return the created item | 263 | * @return the created item |
| 248 | * @sa #plist_type | 264 | * @sa #plist_type |
| 249 | */ | 265 | */ |
| 250 | plist_t plist_new_data(const char *val, uint64_t length); | 266 | PLIST_API plist_t plist_new_data(const char *val, uint64_t length); |
| 251 | 267 | ||
| 252 | /** | 268 | /** |
| 253 | * Create a new plist_t type #PLIST_DATE | 269 | * Create a new plist_t type #PLIST_DATE |
| @@ -257,7 +273,7 @@ extern "C" | |||
| 257 | * @return the created item | 273 | * @return the created item |
| 258 | * @sa #plist_type | 274 | * @sa #plist_type |
| 259 | */ | 275 | */ |
| 260 | plist_t plist_new_date(int32_t sec, int32_t usec); | 276 | PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec); |
| 261 | 277 | ||
| 262 | /** | 278 | /** |
| 263 | * Create a new plist_t type #PLIST_UID | 279 | * Create a new plist_t type #PLIST_UID |
| @@ -266,7 +282,7 @@ extern "C" | |||
| 266 | * @return the created item | 282 | * @return the created item |
| 267 | * @sa #plist_type | 283 | * @sa #plist_type |
| 268 | */ | 284 | */ |
| 269 | plist_t plist_new_uid(uint64_t val); | 285 | PLIST_API plist_t plist_new_uid(uint64_t val); |
| 270 | 286 | ||
| 271 | /** | 287 | /** |
| 272 | * Create a new plist_t type #PLIST_NULL | 288 | * Create a new plist_t type #PLIST_NULL |
| @@ -275,14 +291,14 @@ extern "C" | |||
| 275 | * @note This type is not valid for all formats, e.g. the XML format | 291 | * @note This type is not valid for all formats, e.g. the XML format |
| 276 | * does not support it. | 292 | * does not support it. |
| 277 | */ | 293 | */ |
| 278 | plist_t plist_new_null(void); | 294 | PLIST_API plist_t plist_new_null(void); |
| 279 | 295 | ||
| 280 | /** | 296 | /** |
| 281 | * Destruct a plist_t node and all its children recursively | 297 | * Destruct a plist_t node and all its children recursively |
| 282 | * | 298 | * |
| 283 | * @param plist the plist to free | 299 | * @param plist the plist to free |
| 284 | */ | 300 | */ |
| 285 | void plist_free(plist_t plist); | 301 | PLIST_API void plist_free(plist_t plist); |
| 286 | 302 | ||
| 287 | /** | 303 | /** |
| 288 | * Return a copy of passed node and it's children | 304 | * Return a copy of passed node and it's children |
| @@ -290,7 +306,7 @@ extern "C" | |||
| 290 | * @param node the plist to copy | 306 | * @param node the plist to copy |
| 291 | * @return copied plist | 307 | * @return copied plist |
| 292 | */ | 308 | */ |
| 293 | plist_t plist_copy(plist_t node); | 309 | PLIST_API plist_t plist_copy(plist_t node); |
| 294 | 310 | ||
| 295 | 311 | ||
| 296 | /******************************************** | 312 | /******************************************** |
| @@ -305,7 +321,7 @@ extern "C" | |||
| 305 | * @param node the node of type #PLIST_ARRAY | 321 | * @param node the node of type #PLIST_ARRAY |
| 306 | * @return size of the #PLIST_ARRAY node | 322 | * @return size of the #PLIST_ARRAY node |
| 307 | */ | 323 | */ |
| 308 | uint32_t plist_array_get_size(plist_t node); | 324 | PLIST_API uint32_t plist_array_get_size(plist_t node); |
| 309 | 325 | ||
| 310 | /** | 326 | /** |
| 311 | * Get the nth item in a #PLIST_ARRAY node. | 327 | * Get the nth item in a #PLIST_ARRAY node. |
| @@ -314,7 +330,7 @@ extern "C" | |||
| 314 | * @param n the index of the item to get. Range is [0, array_size[ | 330 | * @param n the index of the item to get. Range is [0, array_size[ |
| 315 | * @return the nth item or NULL if node is not of type #PLIST_ARRAY | 331 | * @return the nth item or NULL if node is not of type #PLIST_ARRAY |
| 316 | */ | 332 | */ |
| 317 | plist_t plist_array_get_item(plist_t node, uint32_t n); | 333 | PLIST_API plist_t plist_array_get_item(plist_t node, uint32_t n); |
| 318 | 334 | ||
| 319 | /** | 335 | /** |
| 320 | * Get the index of an item. item must be a member of a #PLIST_ARRAY node. | 336 | * Get the index of an item. item must be a member of a #PLIST_ARRAY node. |
| @@ -322,7 +338,7 @@ extern "C" | |||
| 322 | * @param node the node | 338 | * @param node the node |
| 323 | * @return the node index or UINT_MAX if node index can't be determined | 339 | * @return the node index or UINT_MAX if node index can't be determined |
| 324 | */ | 340 | */ |
| 325 | uint32_t plist_array_get_item_index(plist_t node); | 341 | PLIST_API uint32_t plist_array_get_item_index(plist_t node); |
| 326 | 342 | ||
| 327 | /** | 343 | /** |
| 328 | * Set the nth item in a #PLIST_ARRAY node. | 344 | * Set the nth item in a #PLIST_ARRAY node. |
| @@ -332,7 +348,7 @@ extern "C" | |||
| 332 | * @param item the new item at index n. The array is responsible for freeing item when it is no longer needed. | 348 | * @param item the new item at index n. The array is responsible for freeing item when it is no longer needed. |
| 333 | * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range. | 349 | * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range. |
| 334 | */ | 350 | */ |
| 335 | void plist_array_set_item(plist_t node, plist_t item, uint32_t n); | 351 | PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n); |
| 336 | 352 | ||
| 337 | /** | 353 | /** |
| 338 | * Append a new item at the end of a #PLIST_ARRAY node. | 354 | * Append a new item at the end of a #PLIST_ARRAY node. |
| @@ -340,7 +356,7 @@ extern "C" | |||
| 340 | * @param node the node of type #PLIST_ARRAY | 356 | * @param node the node of type #PLIST_ARRAY |
| 341 | * @param item the new item. The array is responsible for freeing item when it is no longer needed. | 357 | * @param item the new item. The array is responsible for freeing item when it is no longer needed. |
| 342 | */ | 358 | */ |
| 343 | void plist_array_append_item(plist_t node, plist_t item); | 359 | PLIST_API void plist_array_append_item(plist_t node, plist_t item); |
| 344 | 360 | ||
| 345 | /** | 361 | /** |
| 346 | * Insert a new item at position n in a #PLIST_ARRAY node. | 362 | * Insert a new item at position n in a #PLIST_ARRAY node. |
| @@ -349,7 +365,7 @@ extern "C" | |||
| 349 | * @param item the new item to insert. The array is responsible for freeing item when it is no longer needed. | 365 | * @param item the new item to insert. The array is responsible for freeing item when it is no longer needed. |
| 350 | * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range. | 366 | * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range. |
| 351 | */ | 367 | */ |
| 352 | void plist_array_insert_item(plist_t node, plist_t item, uint32_t n); | 368 | PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n); |
| 353 | 369 | ||
| 354 | /** | 370 | /** |
| 355 | * Remove an existing position in a #PLIST_ARRAY node. | 371 | * Remove an existing position in a #PLIST_ARRAY node. |
| @@ -358,7 +374,7 @@ extern "C" | |||
| 358 | * @param node the node of type #PLIST_ARRAY | 374 | * @param node the node of type #PLIST_ARRAY |
| 359 | * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range. | 375 | * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range. |
| 360 | */ | 376 | */ |
| 361 | void plist_array_remove_item(plist_t node, uint32_t n); | 377 | PLIST_API void plist_array_remove_item(plist_t node, uint32_t n); |
| 362 | 378 | ||
| 363 | /** | 379 | /** |
| 364 | * Remove a node that is a child node of a #PLIST_ARRAY node. | 380 | * Remove a node that is a child node of a #PLIST_ARRAY node. |
| @@ -366,7 +382,7 @@ extern "C" | |||
| 366 | * | 382 | * |
| 367 | * @param node The node to be removed from its #PLIST_ARRAY parent. | 383 | * @param node The node to be removed from its #PLIST_ARRAY parent. |
| 368 | */ | 384 | */ |
| 369 | void plist_array_item_remove(plist_t node); | 385 | PLIST_API void plist_array_item_remove(plist_t node); |
| 370 | 386 | ||
| 371 | /** | 387 | /** |
| 372 | * Create an iterator of a #PLIST_ARRAY node. | 388 | * Create an iterator of a #PLIST_ARRAY node. |
| @@ -375,7 +391,7 @@ extern "C" | |||
| 375 | * @param node The node of type #PLIST_ARRAY | 391 | * @param node The node of type #PLIST_ARRAY |
| 376 | * @param iter Location to store the iterator for the array. | 392 | * @param iter Location to store the iterator for the array. |
| 377 | */ | 393 | */ |
| 378 | void plist_array_new_iter(plist_t node, plist_array_iter *iter); | 394 | PLIST_API void plist_array_new_iter(plist_t node, plist_array_iter *iter); |
| 379 | 395 | ||
| 380 | /** | 396 | /** |
| 381 | * Increment iterator of a #PLIST_ARRAY node. | 397 | * Increment iterator of a #PLIST_ARRAY node. |
| @@ -386,7 +402,7 @@ extern "C" | |||
| 386 | * returned item. Will be set to NULL when no more items are left | 402 | * returned item. Will be set to NULL when no more items are left |
| 387 | * to iterate. | 403 | * to iterate. |
| 388 | */ | 404 | */ |
| 389 | void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item); | 405 | PLIST_API void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item); |
| 390 | 406 | ||
| 391 | 407 | ||
| 392 | /******************************************** | 408 | /******************************************** |
| @@ -401,7 +417,7 @@ extern "C" | |||
| 401 | * @param node the node of type #PLIST_DICT | 417 | * @param node the node of type #PLIST_DICT |
| 402 | * @return size of the #PLIST_DICT node | 418 | * @return size of the #PLIST_DICT node |
| 403 | */ | 419 | */ |
| 404 | uint32_t plist_dict_get_size(plist_t node); | 420 | PLIST_API uint32_t plist_dict_get_size(plist_t node); |
| 405 | 421 | ||
| 406 | /** | 422 | /** |
| 407 | * Create an iterator of a #PLIST_DICT node. | 423 | * Create an iterator of a #PLIST_DICT node. |
| @@ -410,7 +426,7 @@ extern "C" | |||
| 410 | * @param node The node of type #PLIST_DICT. | 426 | * @param node The node of type #PLIST_DICT. |
| 411 | * @param iter Location to store the iterator for the dictionary. | 427 | * @param iter Location to store the iterator for the dictionary. |
| 412 | */ | 428 | */ |
| 413 | void plist_dict_new_iter(plist_t node, plist_dict_iter *iter); | 429 | PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter); |
| 414 | 430 | ||
| 415 | /** | 431 | /** |
| 416 | * Increment iterator of a #PLIST_DICT node. | 432 | * Increment iterator of a #PLIST_DICT node. |
| @@ -423,7 +439,7 @@ extern "C" | |||
| 423 | * free the returned value. Will be set to NULL when no more | 439 | * free the returned value. Will be set to NULL when no more |
| 424 | * key/value pairs are left to iterate. | 440 | * key/value pairs are left to iterate. |
| 425 | */ | 441 | */ |
| 426 | void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); | 442 | PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); |
| 427 | 443 | ||
| 428 | /** | 444 | /** |
| 429 | * Get key associated key to an item. Item must be member of a dictionary. | 445 | * Get key associated key to an item. Item must be member of a dictionary. |
| @@ -431,7 +447,7 @@ extern "C" | |||
| 431 | * @param node the item | 447 | * @param node the item |
| 432 | * @param key a location to store the key. The caller is responsible for freeing the returned string. | 448 | * @param key a location to store the key. The caller is responsible for freeing the returned string. |
| 433 | */ | 449 | */ |
| 434 | void plist_dict_get_item_key(plist_t node, char **key); | 450 | PLIST_API void plist_dict_get_item_key(plist_t node, char **key); |
| 435 | 451 | ||
| 436 | /** | 452 | /** |
| 437 | * Get the nth item in a #PLIST_DICT node. | 453 | * Get the nth item in a #PLIST_DICT node. |
| @@ -441,7 +457,7 @@ extern "C" | |||
| 441 | * @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free | 457 | * @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free |
| 442 | * the returned node. | 458 | * the returned node. |
| 443 | */ | 459 | */ |
| 444 | plist_t plist_dict_get_item(plist_t node, const char* key); | 460 | PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key); |
| 445 | 461 | ||
| 446 | /** | 462 | /** |
| 447 | * Get key node associated to an item. Item must be member of a dictionary. | 463 | * Get key node associated to an item. Item must be member of a dictionary. |
| @@ -449,7 +465,7 @@ extern "C" | |||
| 449 | * @param node the item | 465 | * @param node the item |
| 450 | * @return the key node of the given item, or NULL. | 466 | * @return the key node of the given item, or NULL. |
| 451 | */ | 467 | */ |
| 452 | plist_t plist_dict_item_get_key(plist_t node); | 468 | PLIST_API plist_t plist_dict_item_get_key(plist_t node); |
| 453 | 469 | ||
| 454 | /** | 470 | /** |
| 455 | * Set item identified by key in a #PLIST_DICT node. | 471 | * Set item identified by key in a #PLIST_DICT node. |
| @@ -460,7 +476,7 @@ extern "C" | |||
| 460 | * @param item the new item associated to key | 476 | * @param item the new item associated to key |
| 461 | * @param key the identifier of the item to set. | 477 | * @param key the identifier of the item to set. |
| 462 | */ | 478 | */ |
| 463 | void plist_dict_set_item(plist_t node, const char* key, plist_t item); | 479 | PLIST_API void plist_dict_set_item(plist_t node, const char* key, plist_t item); |
| 464 | 480 | ||
| 465 | /** | 481 | /** |
| 466 | * Remove an existing position in a #PLIST_DICT node. | 482 | * Remove an existing position in a #PLIST_DICT node. |
| @@ -469,7 +485,7 @@ extern "C" | |||
| 469 | * @param node the node of type #PLIST_DICT | 485 | * @param node the node of type #PLIST_DICT |
| 470 | * @param key The identifier of the item to remove. Assert if identifier is not present. | 486 | * @param key The identifier of the item to remove. Assert if identifier is not present. |
| 471 | */ | 487 | */ |
| 472 | void plist_dict_remove_item(plist_t node, const char* key); | 488 | PLIST_API void plist_dict_remove_item(plist_t node, const char* key); |
| 473 | 489 | ||
| 474 | /** | 490 | /** |
| 475 | * Merge a dictionary into another. This will add all key/value pairs | 491 | * Merge a dictionary into another. This will add all key/value pairs |
| @@ -479,7 +495,7 @@ extern "C" | |||
| 479 | * @param target pointer to an existing node of type #PLIST_DICT | 495 | * @param target pointer to an existing node of type #PLIST_DICT |
| 480 | * @param source node of type #PLIST_DICT that should be merged into target | 496 | * @param source node of type #PLIST_DICT that should be merged into target |
| 481 | */ | 497 | */ |
| 482 | void plist_dict_merge(plist_t *target, plist_t source); | 498 | PLIST_API void plist_dict_merge(plist_t *target, plist_t source); |
| 483 | 499 | ||
| 484 | 500 | ||
| 485 | /******************************************** | 501 | /******************************************** |
| @@ -493,7 +509,7 @@ extern "C" | |||
| 493 | * | 509 | * |
| 494 | * @param node the parent (NULL if node is root) | 510 | * @param node the parent (NULL if node is root) |
| 495 | */ | 511 | */ |
| 496 | plist_t plist_get_parent(plist_t node); | 512 | PLIST_API plist_t plist_get_parent(plist_t node); |
| 497 | 513 | ||
| 498 | /** | 514 | /** |
| 499 | * Get the #plist_type of a node. | 515 | * Get the #plist_type of a node. |
| @@ -501,7 +517,7 @@ extern "C" | |||
| 501 | * @param node the node | 517 | * @param node the node |
| 502 | * @return the type of the node | 518 | * @return the type of the node |
| 503 | */ | 519 | */ |
| 504 | plist_type plist_get_node_type(plist_t node); | 520 | PLIST_API plist_type plist_get_node_type(plist_t node); |
| 505 | 521 | ||
| 506 | /** | 522 | /** |
| 507 | * Get the value of a #PLIST_KEY node. | 523 | * Get the value of a #PLIST_KEY node. |
| @@ -512,7 +528,7 @@ extern "C" | |||
| 512 | * caller is responsible for freeing it. | 528 | * caller is responsible for freeing it. |
| 513 | * @note Use plist_mem_free() to free the allocated memory. | 529 | * @note Use plist_mem_free() to free the allocated memory. |
| 514 | */ | 530 | */ |
| 515 | void plist_get_key_val(plist_t node, char **val); | 531 | PLIST_API void plist_get_key_val(plist_t node, char **val); |
| 516 | 532 | ||
| 517 | /** | 533 | /** |
| 518 | * Get the value of a #PLIST_STRING node. | 534 | * Get the value of a #PLIST_STRING node. |
| @@ -523,7 +539,7 @@ extern "C" | |||
| 523 | * caller is responsible for freeing it. Data is UTF-8 encoded. | 539 | * caller is responsible for freeing it. Data is UTF-8 encoded. |
| 524 | * @note Use plist_mem_free() to free the allocated memory. | 540 | * @note Use plist_mem_free() to free the allocated memory. |
| 525 | */ | 541 | */ |
| 526 | void plist_get_string_val(plist_t node, char **val); | 542 | PLIST_API void plist_get_string_val(plist_t node, char **val); |
| 527 | 543 | ||
| 528 | /** | 544 | /** |
| 529 | * Get a pointer to the buffer of a #PLIST_STRING node. | 545 | * Get a pointer to the buffer of a #PLIST_STRING node. |
| @@ -536,7 +552,7 @@ extern "C" | |||
| 536 | * | 552 | * |
| 537 | * @return Pointer to the NULL-terminated buffer. | 553 | * @return Pointer to the NULL-terminated buffer. |
| 538 | */ | 554 | */ |
| 539 | const char* plist_get_string_ptr(plist_t node, uint64_t* length); | 555 | PLIST_API const char* plist_get_string_ptr(plist_t node, uint64_t* length); |
| 540 | 556 | ||
| 541 | /** | 557 | /** |
| 542 | * Get the value of a #PLIST_BOOLEAN node. | 558 | * Get the value of a #PLIST_BOOLEAN node. |
| @@ -545,7 +561,7 @@ extern "C" | |||
| 545 | * @param node the node | 561 | * @param node the node |
| 546 | * @param val a pointer to a uint8_t variable. | 562 | * @param val a pointer to a uint8_t variable. |
| 547 | */ | 563 | */ |
| 548 | void plist_get_bool_val(plist_t node, uint8_t * val); | 564 | PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val); |
| 549 | 565 | ||
| 550 | /** | 566 | /** |
| 551 | * Get the unsigned integer value of a #PLIST_INT node. | 567 | * Get the unsigned integer value of a #PLIST_INT node. |
| @@ -554,7 +570,7 @@ extern "C" | |||
| 554 | * @param node the node | 570 | * @param node the node |
| 555 | * @param val a pointer to a uint64_t variable. | 571 | * @param val a pointer to a uint64_t variable. |
| 556 | */ | 572 | */ |
| 557 | void plist_get_uint_val(plist_t node, uint64_t * val); | 573 | PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val); |
| 558 | 574 | ||
| 559 | /** | 575 | /** |
| 560 | * Get the signed integer value of a #PLIST_INT node. | 576 | * Get the signed integer value of a #PLIST_INT node. |
| @@ -563,7 +579,7 @@ extern "C" | |||
| 563 | * @param node the node | 579 | * @param node the node |
| 564 | * @param val a pointer to a int64_t variable. | 580 | * @param val a pointer to a int64_t variable. |
| 565 | */ | 581 | */ |
| 566 | void plist_get_int_val(plist_t node, int64_t * val); | 582 | PLIST_API void plist_get_int_val(plist_t node, int64_t * val); |
| 567 | 583 | ||
| 568 | /** | 584 | /** |
| 569 | * Get the value of a #PLIST_REAL node. | 585 | * Get the value of a #PLIST_REAL node. |
| @@ -572,7 +588,7 @@ extern "C" | |||
| 572 | * @param node the node | 588 | * @param node the node |
| 573 | * @param val a pointer to a double variable. | 589 | * @param val a pointer to a double variable. |
| 574 | */ | 590 | */ |
| 575 | void plist_get_real_val(plist_t node, double *val); | 591 | PLIST_API void plist_get_real_val(plist_t node, double *val); |
| 576 | 592 | ||
| 577 | /** | 593 | /** |
| 578 | * Get the value of a #PLIST_DATA node. | 594 | * Get the value of a #PLIST_DATA node. |
| @@ -584,7 +600,7 @@ extern "C" | |||
| 584 | * @param length the length of the buffer | 600 | * @param length the length of the buffer |
| 585 | * @note Use plist_mem_free() to free the allocated memory. | 601 | * @note Use plist_mem_free() to free the allocated memory. |
| 586 | */ | 602 | */ |
| 587 | void plist_get_data_val(plist_t node, char **val, uint64_t * length); | 603 | PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length); |
| 588 | 604 | ||
| 589 | /** | 605 | /** |
| 590 | * Get a pointer to the data buffer of a #PLIST_DATA node. | 606 | * Get a pointer to the data buffer of a #PLIST_DATA node. |
| @@ -597,7 +613,7 @@ extern "C" | |||
| 597 | * | 613 | * |
| 598 | * @return Pointer to the buffer | 614 | * @return Pointer to the buffer |
| 599 | */ | 615 | */ |
| 600 | const char* plist_get_data_ptr(plist_t node, uint64_t* length); | 616 | PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length); |
| 601 | 617 | ||
| 602 | /** | 618 | /** |
| 603 | * Get the value of a #PLIST_DATE node. | 619 | * Get the value of a #PLIST_DATE node. |
| @@ -607,7 +623,7 @@ extern "C" | |||
| 607 | * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001. | 623 | * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001. |
| 608 | * @param usec a pointer to an int32_t variable. Represents the number of microseconds | 624 | * @param usec a pointer to an int32_t variable. Represents the number of microseconds |
| 609 | */ | 625 | */ |
| 610 | void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec); | 626 | PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec); |
| 611 | 627 | ||
| 612 | /** | 628 | /** |
| 613 | * Get the value of a #PLIST_UID node. | 629 | * Get the value of a #PLIST_UID node. |
| @@ -616,7 +632,7 @@ extern "C" | |||
| 616 | * @param node the node | 632 | * @param node the node |
| 617 | * @param val a pointer to a uint64_t variable. | 633 | * @param val a pointer to a uint64_t variable. |
| 618 | */ | 634 | */ |
| 619 | void plist_get_uid_val(plist_t node, uint64_t * val); | 635 | PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val); |
| 620 | 636 | ||
| 621 | 637 | ||
| 622 | /******************************************** | 638 | /******************************************** |
| @@ -632,7 +648,7 @@ extern "C" | |||
| 632 | * @param node the node | 648 | * @param node the node |
| 633 | * @param val the key value | 649 | * @param val the key value |
| 634 | */ | 650 | */ |
| 635 | void plist_set_key_val(plist_t node, const char *val); | 651 | PLIST_API void plist_set_key_val(plist_t node, const char *val); |
| 636 | 652 | ||
| 637 | /** | 653 | /** |
| 638 | * Set the value of a node. | 654 | * Set the value of a node. |
| @@ -642,7 +658,7 @@ extern "C" | |||
| 642 | * @param val the string value. The string is copied when set and will be | 658 | * @param val the string value. The string is copied when set and will be |
| 643 | * freed by the node. | 659 | * freed by the node. |
| 644 | */ | 660 | */ |
| 645 | void plist_set_string_val(plist_t node, const char *val); | 661 | PLIST_API void plist_set_string_val(plist_t node, const char *val); |
| 646 | 662 | ||
| 647 | /** | 663 | /** |
| 648 | * Set the value of a node. | 664 | * Set the value of a node. |
| @@ -651,7 +667,7 @@ extern "C" | |||
| 651 | * @param node the node | 667 | * @param node the node |
| 652 | * @param val the boolean value | 668 | * @param val the boolean value |
| 653 | */ | 669 | */ |
| 654 | void plist_set_bool_val(plist_t node, uint8_t val); | 670 | PLIST_API void plist_set_bool_val(plist_t node, uint8_t val); |
| 655 | 671 | ||
| 656 | /** | 672 | /** |
| 657 | * Set the value of a node. | 673 | * Set the value of a node. |
| @@ -660,7 +676,7 @@ extern "C" | |||
| 660 | * @param node the node | 676 | * @param node the node |
| 661 | * @param val the unsigned integer value | 677 | * @param val the unsigned integer value |
| 662 | */ | 678 | */ |
| 663 | void plist_set_uint_val(plist_t node, uint64_t val); | 679 | PLIST_API void plist_set_uint_val(plist_t node, uint64_t val); |
| 664 | 680 | ||
| 665 | /** | 681 | /** |
| 666 | * Set the value of a node. | 682 | * Set the value of a node. |
| @@ -669,7 +685,7 @@ extern "C" | |||
| 669 | * @param node the node | 685 | * @param node the node |
| 670 | * @param val the signed integer value | 686 | * @param val the signed integer value |
| 671 | */ | 687 | */ |
| 672 | void plist_set_int_val(plist_t node, int64_t val); | 688 | PLIST_API void plist_set_int_val(plist_t node, int64_t val); |
| 673 | 689 | ||
| 674 | /** | 690 | /** |
| 675 | * Set the value of a node. | 691 | * Set the value of a node. |
| @@ -678,7 +694,7 @@ extern "C" | |||
| 678 | * @param node the node | 694 | * @param node the node |
| 679 | * @param val the real value | 695 | * @param val the real value |
| 680 | */ | 696 | */ |
| 681 | void plist_set_real_val(plist_t node, double val); | 697 | PLIST_API void plist_set_real_val(plist_t node, double val); |
| 682 | 698 | ||
| 683 | /** | 699 | /** |
| 684 | * Set the value of a node. | 700 | * Set the value of a node. |
| @@ -689,7 +705,7 @@ extern "C" | |||
| 689 | * be freed by the node. | 705 | * be freed by the node. |
| 690 | * @param length the length of the buffer | 706 | * @param length the length of the buffer |
| 691 | */ | 707 | */ |
| 692 | void plist_set_data_val(plist_t node, const char *val, uint64_t length); | 708 | PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length); |
| 693 | 709 | ||
| 694 | /** | 710 | /** |
| 695 | * Set the value of a node. | 711 | * Set the value of a node. |
| @@ -699,7 +715,7 @@ extern "C" | |||
| 699 | * @param sec the number of seconds since 01/01/2001 | 715 | * @param sec the number of seconds since 01/01/2001 |
| 700 | * @param usec the number of microseconds | 716 | * @param usec the number of microseconds |
| 701 | */ | 717 | */ |
| 702 | void plist_set_date_val(plist_t node, int32_t sec, int32_t usec); | 718 | PLIST_API void plist_set_date_val(plist_t node, int32_t sec, int32_t usec); |
| 703 | 719 | ||
| 704 | /** | 720 | /** |
| 705 | * Set the value of a node. | 721 | * Set the value of a node. |
| @@ -708,7 +724,7 @@ extern "C" | |||
| 708 | * @param node the node | 724 | * @param node the node |
| 709 | * @param val the unsigned integer value | 725 | * @param val the unsigned integer value |
| 710 | */ | 726 | */ |
| 711 | void plist_set_uid_val(plist_t node, uint64_t val); | 727 | PLIST_API void plist_set_uid_val(plist_t node, uint64_t val); |
| 712 | 728 | ||
| 713 | 729 | ||
| 714 | /******************************************** | 730 | /******************************************** |
| @@ -727,7 +743,7 @@ extern "C" | |||
| 727 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 743 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 728 | * @note Use plist_mem_free() to free the allocated memory. | 744 | * @note Use plist_mem_free() to free the allocated memory. |
| 729 | */ | 745 | */ |
| 730 | plist_err_t plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); | 746 | PLIST_API plist_err_t plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); |
| 731 | 747 | ||
| 732 | /** | 748 | /** |
| 733 | * Export the #plist_t structure to binary format. | 749 | * Export the #plist_t structure to binary format. |
| @@ -739,7 +755,7 @@ extern "C" | |||
| 739 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 755 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 740 | * @note Use plist_mem_free() to free the allocated memory. | 756 | * @note Use plist_mem_free() to free the allocated memory. |
| 741 | */ | 757 | */ |
| 742 | plist_err_t plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); | 758 | PLIST_API plist_err_t plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); |
| 743 | 759 | ||
| 744 | /** | 760 | /** |
| 745 | * Export the #plist_t structure to JSON format. | 761 | * Export the #plist_t structure to JSON format. |
| @@ -752,7 +768,7 @@ extern "C" | |||
| 752 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 768 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 753 | * @note Use plist_mem_free() to free the allocated memory. | 769 | * @note Use plist_mem_free() to free the allocated memory. |
| 754 | */ | 770 | */ |
| 755 | plist_err_t plist_to_json(plist_t plist, char **plist_json, uint32_t* length, int prettify); | 771 | PLIST_API plist_err_t plist_to_json(plist_t plist, char **plist_json, uint32_t* length, int prettify); |
| 756 | 772 | ||
| 757 | /** | 773 | /** |
| 758 | * Export the #plist_t structure to OpenStep format. | 774 | * Export the #plist_t structure to OpenStep format. |
| @@ -765,7 +781,7 @@ extern "C" | |||
| 765 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 781 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 766 | * @note Use plist_mem_free() to free the allocated memory. | 782 | * @note Use plist_mem_free() to free the allocated memory. |
| 767 | */ | 783 | */ |
| 768 | plist_err_t plist_to_openstep(plist_t plist, char **plist_openstep, uint32_t* length, int prettify); | 784 | PLIST_API plist_err_t plist_to_openstep(plist_t plist, char **plist_openstep, uint32_t* length, int prettify); |
| 769 | 785 | ||
| 770 | 786 | ||
| 771 | /** | 787 | /** |
| @@ -776,7 +792,7 @@ extern "C" | |||
| 776 | * @param plist a pointer to the imported plist. | 792 | * @param plist a pointer to the imported plist. |
| 777 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 793 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 778 | */ | 794 | */ |
| 779 | plist_err_t plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); | 795 | PLIST_API plist_err_t plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); |
| 780 | 796 | ||
| 781 | /** | 797 | /** |
| 782 | * Import the #plist_t structure from binary format. | 798 | * Import the #plist_t structure from binary format. |
| @@ -786,7 +802,7 @@ extern "C" | |||
| 786 | * @param plist a pointer to the imported plist. | 802 | * @param plist a pointer to the imported plist. |
| 787 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 803 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 788 | */ | 804 | */ |
| 789 | plist_err_t plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); | 805 | PLIST_API plist_err_t plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); |
| 790 | 806 | ||
| 791 | /** | 807 | /** |
| 792 | * Import the #plist_t structure from JSON format. | 808 | * Import the #plist_t structure from JSON format. |
| @@ -796,7 +812,7 @@ extern "C" | |||
| 796 | * @param plist a pointer to the imported plist. | 812 | * @param plist a pointer to the imported plist. |
| 797 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 813 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 798 | */ | 814 | */ |
| 799 | plist_err_t plist_from_json(const char *json, uint32_t length, plist_t * plist); | 815 | PLIST_API plist_err_t plist_from_json(const char *json, uint32_t length, plist_t * plist); |
| 800 | 816 | ||
| 801 | /** | 817 | /** |
| 802 | * Import the #plist_t structure from OpenStep plist format. | 818 | * Import the #plist_t structure from OpenStep plist format. |
| @@ -806,7 +822,7 @@ extern "C" | |||
| 806 | * @param plist a pointer to the imported plist. | 822 | * @param plist a pointer to the imported plist. |
| 807 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 823 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 808 | */ | 824 | */ |
| 809 | plist_err_t plist_from_openstep(const char *openstep, uint32_t length, plist_t * plist); | 825 | PLIST_API plist_err_t plist_from_openstep(const char *openstep, uint32_t length, plist_t * plist); |
| 810 | 826 | ||
| 811 | /** | 827 | /** |
| 812 | * Import the #plist_t structure from memory data. | 828 | * Import the #plist_t structure from memory data. |
| @@ -826,7 +842,7 @@ extern "C" | |||
| 826 | * @param format If non-NULL, the #plist_format_t value pointed to will be set to the parsed format. | 842 | * @param format If non-NULL, the #plist_format_t value pointed to will be set to the parsed format. |
| 827 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 843 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 828 | */ | 844 | */ |
| 829 | plist_err_t plist_from_memory(const char *plist_data, uint32_t length, plist_t *plist, plist_format_t *format); | 845 | PLIST_API plist_err_t plist_from_memory(const char *plist_data, uint32_t length, plist_t *plist, plist_format_t *format); |
| 830 | 846 | ||
| 831 | /** | 847 | /** |
| 832 | * Import the #plist_t structure directly from file. | 848 | * Import the #plist_t structure directly from file. |
| @@ -841,7 +857,7 @@ extern "C" | |||
| 841 | * @param format If non-NULL, the #plist_format_t value pointed to will be set to the parsed format. | 857 | * @param format If non-NULL, the #plist_format_t value pointed to will be set to the parsed format. |
| 842 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure | 858 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure |
| 843 | */ | 859 | */ |
| 844 | plist_err_t plist_read_from_file(const char *filename, plist_t *plist, plist_format_t *format); | 860 | PLIST_API plist_err_t plist_read_from_file(const char *filename, plist_t *plist, plist_format_t *format); |
| 845 | 861 | ||
| 846 | /** | 862 | /** |
| 847 | * Write the #plist_t structure to a NULL-terminated string using the given format and options. | 863 | * Write the #plist_t structure to a NULL-terminated string using the given format and options. |
| @@ -856,7 +872,7 @@ extern "C" | |||
| 856 | * @note Use plist_mem_free() to free the allocated memory. | 872 | * @note Use plist_mem_free() to free the allocated memory. |
| 857 | * @note #PLIST_FORMAT_BINARY is not supported by this function. | 873 | * @note #PLIST_FORMAT_BINARY is not supported by this function. |
| 858 | */ | 874 | */ |
| 859 | plist_err_t plist_write_to_string(plist_t plist, char **output, uint32_t* length, plist_format_t format, plist_write_options_t options); | 875 | PLIST_API plist_err_t plist_write_to_string(plist_t plist, char **output, uint32_t* length, plist_format_t format, plist_write_options_t options); |
| 860 | 876 | ||
| 861 | /** | 877 | /** |
| 862 | * Write the #plist_t structure to a FILE* stream using the given format and options. | 878 | * Write the #plist_t structure to a FILE* stream using the given format and options. |
| @@ -871,7 +887,7 @@ extern "C" | |||
| 871 | * (basically all output-only formats) are directly and efficiently written to the stream; | 887 | * (basically all output-only formats) are directly and efficiently written to the stream; |
| 872 | * the other formats are written to a memory buffer first. | 888 | * the other formats are written to a memory buffer first. |
| 873 | */ | 889 | */ |
| 874 | plist_err_t plist_write_to_stream(plist_t plist, FILE* stream, plist_format_t format, plist_write_options_t options); | 890 | PLIST_API plist_err_t plist_write_to_stream(plist_t plist, FILE* stream, plist_format_t format, plist_write_options_t options); |
| 875 | 891 | ||
| 876 | /** | 892 | /** |
| 877 | * Write the #plist_t structure to a file at given path using the given format and options. | 893 | * Write the #plist_t structure to a file at given path using the given format and options. |
| @@ -883,7 +899,7 @@ extern "C" | |||
| 883 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure. | 899 | * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure. |
| 884 | * @note Use plist_mem_free() to free the allocated memory. | 900 | * @note Use plist_mem_free() to free the allocated memory. |
| 885 | */ | 901 | */ |
| 886 | plist_err_t plist_write_to_file(plist_t plist, const char *filename, plist_format_t format, plist_write_options_t options); | 902 | PLIST_API plist_err_t plist_write_to_file(plist_t plist, const char *filename, plist_format_t format, plist_write_options_t options); |
| 887 | 903 | ||
| 888 | /** | 904 | /** |
| 889 | * Print the given plist in human-readable format to standard output. | 905 | * Print the given plist in human-readable format to standard output. |
| @@ -892,7 +908,7 @@ extern "C" | |||
| 892 | * @param plist The #plist_t structure to print | 908 | * @param plist The #plist_t structure to print |
| 893 | * @note For #PLIST_DATA nodes, only a maximum of 24 bytes (first 16 and last 8) are written. | 909 | * @note For #PLIST_DATA nodes, only a maximum of 24 bytes (first 16 and last 8) are written. |
| 894 | */ | 910 | */ |
| 895 | void plist_print(plist_t plist); | 911 | PLIST_API void plist_print(plist_t plist); |
| 896 | 912 | ||
| 897 | /** | 913 | /** |
| 898 | * Test if in-memory plist data is in binary format. | 914 | * Test if in-memory plist data is in binary format. |
| @@ -906,7 +922,7 @@ extern "C" | |||
| 906 | * @param length length of the buffer to read. | 922 | * @param length length of the buffer to read. |
| 907 | * @return 1 if the buffer is a binary plist, 0 otherwise. | 923 | * @return 1 if the buffer is a binary plist, 0 otherwise. |
| 908 | */ | 924 | */ |
| 909 | int plist_is_binary(const char *plist_data, uint32_t length); | 925 | PLIST_API int plist_is_binary(const char *plist_data, uint32_t length); |
| 910 | 926 | ||
| 911 | /******************************************** | 927 | /******************************************** |
| 912 | * * | 928 | * * |
| @@ -923,7 +939,7 @@ extern "C" | |||
| 923 | * @param length length of the path to access | 939 | * @param length length of the path to access |
| 924 | * @return the value to access. | 940 | * @return the value to access. |
| 925 | */ | 941 | */ |
| 926 | plist_t plist_access_path(plist_t plist, uint32_t length, ...); | 942 | PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...); |
| 927 | 943 | ||
| 928 | /** | 944 | /** |
| 929 | * Variadic version of #plist_access_path. | 945 | * Variadic version of #plist_access_path. |
| @@ -933,7 +949,7 @@ extern "C" | |||
| 933 | * @param v list of array's index and dic'st key | 949 | * @param v list of array's index and dic'st key |
| 934 | * @return the value to access. | 950 | * @return the value to access. |
| 935 | */ | 951 | */ |
| 936 | plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v); | 952 | PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v); |
| 937 | 953 | ||
| 938 | /** | 954 | /** |
| 939 | * Compare two node values | 955 | * Compare two node values |
| @@ -942,7 +958,7 @@ extern "C" | |||
| 942 | * @param node_r rigth node to compare | 958 | * @param node_r rigth node to compare |
| 943 | * @return TRUE is type and value match, FALSE otherwise. | 959 | * @return TRUE is type and value match, FALSE otherwise. |
| 944 | */ | 960 | */ |
| 945 | char plist_compare_node_value(plist_t node_l, plist_t node_r); | 961 | PLIST_API char plist_compare_node_value(plist_t node_l, plist_t node_r); |
| 946 | 962 | ||
| 947 | /** Helper macro used by PLIST_IS_* macros that will evaluate the type of a plist node. */ | 963 | /** Helper macro used by PLIST_IS_* macros that will evaluate the type of a plist node. */ |
| 948 | #define _PLIST_IS_TYPE(__plist, __plist_type) (__plist && (plist_get_node_type(__plist) == PLIST_##__plist_type)) | 964 | #define _PLIST_IS_TYPE(__plist, __plist_type) (__plist && (plist_get_node_type(__plist) == PLIST_##__plist_type)) |
| @@ -977,7 +993,7 @@ extern "C" | |||
| 977 | * @param boolnode node of type PLIST_BOOL | 993 | * @param boolnode node of type PLIST_BOOL |
| 978 | * @return 1 if the boolean node has a value of TRUE or 0 if FALSE. | 994 | * @return 1 if the boolean node has a value of TRUE or 0 if FALSE. |
| 979 | */ | 995 | */ |
| 980 | int plist_bool_val_is_true(plist_t boolnode); | 996 | PLIST_API int plist_bool_val_is_true(plist_t boolnode); |
| 981 | 997 | ||
| 982 | /** | 998 | /** |
| 983 | * Helper function to test if a given #PLIST_INT node's value is negative | 999 | * Helper function to test if a given #PLIST_INT node's value is negative |
| @@ -985,7 +1001,7 @@ extern "C" | |||
| 985 | * @param intnode node of type PLIST_INT | 1001 | * @param intnode node of type PLIST_INT |
| 986 | * @return 1 if the node's value is negative, or 0 if positive. | 1002 | * @return 1 if the node's value is negative, or 0 if positive. |
| 987 | */ | 1003 | */ |
| 988 | int plist_int_val_is_negative(plist_t intnode); | 1004 | PLIST_API int plist_int_val_is_negative(plist_t intnode); |
| 989 | 1005 | ||
| 990 | /** | 1006 | /** |
| 991 | * Helper function to compare the value of a PLIST_INT node against | 1007 | * Helper function to compare the value of a PLIST_INT node against |
| @@ -997,7 +1013,7 @@ extern "C" | |||
| 997 | * 1 if the node's value is greater than cmpval, | 1013 | * 1 if the node's value is greater than cmpval, |
| 998 | * or -1 if the node's value is less than cmpval. | 1014 | * or -1 if the node's value is less than cmpval. |
| 999 | */ | 1015 | */ |
| 1000 | int plist_int_val_compare(plist_t uintnode, int64_t cmpval); | 1016 | PLIST_API int plist_int_val_compare(plist_t uintnode, int64_t cmpval); |
| 1001 | 1017 | ||
| 1002 | /** | 1018 | /** |
| 1003 | * Helper function to compare the value of a PLIST_INT node against | 1019 | * Helper function to compare the value of a PLIST_INT node against |
| @@ -1009,7 +1025,7 @@ extern "C" | |||
| 1009 | * 1 if the node's value is greater than cmpval, | 1025 | * 1 if the node's value is greater than cmpval, |
| 1010 | * or -1 if the node's value is less than cmpval. | 1026 | * or -1 if the node's value is less than cmpval. |
| 1011 | */ | 1027 | */ |
| 1012 | int plist_uint_val_compare(plist_t uintnode, uint64_t cmpval); | 1028 | PLIST_API int plist_uint_val_compare(plist_t uintnode, uint64_t cmpval); |
| 1013 | 1029 | ||
| 1014 | /** | 1030 | /** |
| 1015 | * Helper function to compare the value of a PLIST_UID node against | 1031 | * Helper function to compare the value of a PLIST_UID node against |
| @@ -1021,7 +1037,7 @@ extern "C" | |||
| 1021 | * 1 if the node's value is greater than cmpval, | 1037 | * 1 if the node's value is greater than cmpval, |
| 1022 | * or -1 if the node's value is less than cmpval. | 1038 | * or -1 if the node's value is less than cmpval. |
| 1023 | */ | 1039 | */ |
| 1024 | int plist_uid_val_compare(plist_t uidnode, uint64_t cmpval); | 1040 | PLIST_API int plist_uid_val_compare(plist_t uidnode, uint64_t cmpval); |
| 1025 | 1041 | ||
| 1026 | /** | 1042 | /** |
| 1027 | * Helper function to compare the value of a PLIST_REAL node against | 1043 | * Helper function to compare the value of a PLIST_REAL node against |
| @@ -1038,7 +1054,7 @@ extern "C" | |||
| 1038 | * 1 if the node's value is greater than cmpval, | 1054 | * 1 if the node's value is greater than cmpval, |
| 1039 | * or -1 if the node's value is less than cmpval. | 1055 | * or -1 if the node's value is less than cmpval. |
| 1040 | */ | 1056 | */ |
| 1041 | int plist_real_val_compare(plist_t realnode, double cmpval); | 1057 | PLIST_API int plist_real_val_compare(plist_t realnode, double cmpval); |
| 1042 | 1058 | ||
| 1043 | /** | 1059 | /** |
| 1044 | * Helper function to compare the value of a PLIST_DATE node against | 1060 | * Helper function to compare the value of a PLIST_DATE node against |
| @@ -1051,7 +1067,7 @@ extern "C" | |||
| 1051 | * 1 if the node's date is greater than the supplied values, | 1067 | * 1 if the node's date is greater than the supplied values, |
| 1052 | * or -1 if the node's date is less than the supplied values. | 1068 | * or -1 if the node's date is less than the supplied values. |
| 1053 | */ | 1069 | */ |
| 1054 | int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t cmpusec); | 1070 | PLIST_API int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t cmpusec); |
| 1055 | 1071 | ||
| 1056 | /** | 1072 | /** |
| 1057 | * Helper function to compare the value of a PLIST_STRING node against | 1073 | * Helper function to compare the value of a PLIST_STRING node against |
| @@ -1064,7 +1080,7 @@ extern "C" | |||
| 1064 | * > 0 if the node's value is lexicographically greater than cmpval, | 1080 | * > 0 if the node's value is lexicographically greater than cmpval, |
| 1065 | * or < 0 if the node's value is lexicographically less than cmpval. | 1081 | * or < 0 if the node's value is lexicographically less than cmpval. |
| 1066 | */ | 1082 | */ |
| 1067 | int plist_string_val_compare(plist_t strnode, const char* cmpval); | 1083 | PLIST_API int plist_string_val_compare(plist_t strnode, const char* cmpval); |
| 1068 | 1084 | ||
| 1069 | /** | 1085 | /** |
| 1070 | * Helper function to compare the value of a PLIST_STRING node against | 1086 | * Helper function to compare the value of a PLIST_STRING node against |
| @@ -1078,7 +1094,7 @@ extern "C" | |||
| 1078 | * > 0 if the node's value is lexicographically greater than cmpval, | 1094 | * > 0 if the node's value is lexicographically greater than cmpval, |
| 1079 | * or < 0 if the node's value is lexicographically less than cmpval. | 1095 | * or < 0 if the node's value is lexicographically less than cmpval. |
| 1080 | */ | 1096 | */ |
| 1081 | int plist_string_val_compare_with_size(plist_t strnode, const char* cmpval, size_t n); | 1097 | PLIST_API int plist_string_val_compare_with_size(plist_t strnode, const char* cmpval, size_t n); |
| 1082 | 1098 | ||
| 1083 | /** | 1099 | /** |
| 1084 | * Helper function to match a given substring in the value of a | 1100 | * Helper function to match a given substring in the value of a |
| @@ -1089,7 +1105,7 @@ extern "C" | |||
| 1089 | * @return 1 if the node's value contains the given substring, | 1105 | * @return 1 if the node's value contains the given substring, |
| 1090 | * or 0 if not. | 1106 | * or 0 if not. |
| 1091 | */ | 1107 | */ |
| 1092 | int plist_string_val_contains(plist_t strnode, const char* substr); | 1108 | PLIST_API int plist_string_val_contains(plist_t strnode, const char* substr); |
| 1093 | 1109 | ||
| 1094 | /** | 1110 | /** |
| 1095 | * Helper function to compare the value of a PLIST_KEY node against | 1111 | * Helper function to compare the value of a PLIST_KEY node against |
| @@ -1102,7 +1118,7 @@ extern "C" | |||
| 1102 | * > 0 if the node's value is lexicographically greater than cmpval, | 1118 | * > 0 if the node's value is lexicographically greater than cmpval, |
| 1103 | * or < 0 if the node's value is lexicographically less than cmpval. | 1119 | * or < 0 if the node's value is lexicographically less than cmpval. |
| 1104 | */ | 1120 | */ |
| 1105 | int plist_key_val_compare(plist_t keynode, const char* cmpval); | 1121 | PLIST_API int plist_key_val_compare(plist_t keynode, const char* cmpval); |
| 1106 | 1122 | ||
| 1107 | /** | 1123 | /** |
| 1108 | * Helper function to compare the value of a PLIST_KEY node against | 1124 | * Helper function to compare the value of a PLIST_KEY node against |
| @@ -1116,7 +1132,7 @@ extern "C" | |||
| 1116 | * > 0 if the node's value is lexicographically greater than cmpval, | 1132 | * > 0 if the node's value is lexicographically greater than cmpval, |
| 1117 | * or < 0 if the node's value is lexicographically less than cmpval. | 1133 | * or < 0 if the node's value is lexicographically less than cmpval. |
| 1118 | */ | 1134 | */ |
| 1119 | int plist_key_val_compare_with_size(plist_t keynode, const char* cmpval, size_t n); | 1135 | PLIST_API int plist_key_val_compare_with_size(plist_t keynode, const char* cmpval, size_t n); |
| 1120 | 1136 | ||
| 1121 | /** | 1137 | /** |
| 1122 | * Helper function to match a given substring in the value of a | 1138 | * Helper function to match a given substring in the value of a |
| @@ -1127,7 +1143,7 @@ extern "C" | |||
| 1127 | * @return 1 if the node's value contains the given substring, | 1143 | * @return 1 if the node's value contains the given substring, |
| 1128 | * or 0 if not. | 1144 | * or 0 if not. |
| 1129 | */ | 1145 | */ |
| 1130 | int plist_key_val_contains(plist_t keynode, const char* substr); | 1146 | PLIST_API int plist_key_val_contains(plist_t keynode, const char* substr); |
| 1131 | 1147 | ||
| 1132 | /** | 1148 | /** |
| 1133 | * Helper function to compare the data of a PLIST_DATA node against | 1149 | * Helper function to compare the data of a PLIST_DATA node against |
| @@ -1143,7 +1159,7 @@ extern "C" | |||
| 1143 | * > 0 if the node's value is lexicographically greater than cmpval, | 1159 | * > 0 if the node's value is lexicographically greater than cmpval, |
| 1144 | * or < 0 if the node's value is lexicographically less than cmpval. | 1160 | * or < 0 if the node's value is lexicographically less than cmpval. |
| 1145 | */ | 1161 | */ |
| 1146 | int plist_data_val_compare(plist_t datanode, const uint8_t* cmpval, size_t n); | 1162 | PLIST_API int plist_data_val_compare(plist_t datanode, const uint8_t* cmpval, size_t n); |
| 1147 | 1163 | ||
| 1148 | /** | 1164 | /** |
| 1149 | * Helper function to compare the data of a PLIST_DATA node against | 1165 | * Helper function to compare the data of a PLIST_DATA node against |
| @@ -1159,7 +1175,7 @@ extern "C" | |||
| 1159 | * > 0 if the node's value is lexicographically greater than cmpval, | 1175 | * > 0 if the node's value is lexicographically greater than cmpval, |
| 1160 | * or < 0 if the node's value is lexicographically less than cmpval. | 1176 | * or < 0 if the node's value is lexicographically less than cmpval. |
| 1161 | */ | 1177 | */ |
| 1162 | int plist_data_val_compare_with_size(plist_t datanode, const uint8_t* cmpval, size_t n); | 1178 | PLIST_API int plist_data_val_compare_with_size(plist_t datanode, const uint8_t* cmpval, size_t n); |
| 1163 | 1179 | ||
| 1164 | /** | 1180 | /** |
| 1165 | * Helper function to match a given data blob within the value of a | 1181 | * Helper function to match a given data blob within the value of a |
| @@ -1171,7 +1187,7 @@ extern "C" | |||
| 1171 | * @return 1 if the node's value contains the given data blob | 1187 | * @return 1 if the node's value contains the given data blob |
| 1172 | * or 0 if not. | 1188 | * or 0 if not. |
| 1173 | */ | 1189 | */ |
| 1174 | int plist_data_val_contains(plist_t datanode, const uint8_t* cmpval, size_t n); | 1190 | PLIST_API int plist_data_val_contains(plist_t datanode, const uint8_t* cmpval, size_t n); |
| 1175 | 1191 | ||
| 1176 | /** | 1192 | /** |
| 1177 | * Sort all PLIST_DICT key/value pairs in a property list lexicographically | 1193 | * Sort all PLIST_DICT key/value pairs in a property list lexicographically |
| @@ -1179,7 +1195,7 @@ extern "C" | |||
| 1179 | * | 1195 | * |
| 1180 | * @param plist The property list to perform the sorting operation on. | 1196 | * @param plist The property list to perform the sorting operation on. |
| 1181 | */ | 1197 | */ |
| 1182 | void plist_sort(plist_t plist); | 1198 | PLIST_API void plist_sort(plist_t plist); |
| 1183 | 1199 | ||
| 1184 | /** | 1200 | /** |
| 1185 | * Free memory allocated by relevant libplist API calls: | 1201 | * Free memory allocated by relevant libplist API calls: |
| @@ -1194,7 +1210,7 @@ extern "C" | |||
| 1194 | * @note Do not use this function to free plist_t nodes, use plist_free() | 1210 | * @note Do not use this function to free plist_t nodes, use plist_free() |
| 1195 | * instead. | 1211 | * instead. |
| 1196 | */ | 1212 | */ |
| 1197 | void plist_mem_free(void* ptr); | 1213 | PLIST_API void plist_mem_free(void* ptr); |
| 1198 | 1214 | ||
| 1199 | /** | 1215 | /** |
| 1200 | * Set debug level for the format parsers. | 1216 | * Set debug level for the format parsers. |
| @@ -1202,7 +1218,7 @@ extern "C" | |||
| 1202 | * | 1218 | * |
| 1203 | * @param debug Debug level. Currently, only 0 (off) and 1 (enabled) are supported. | 1219 | * @param debug Debug level. Currently, only 0 (off) and 1 (enabled) are supported. |
| 1204 | */ | 1220 | */ |
| 1205 | void plist_set_debug(int debug); | 1221 | PLIST_API void plist_set_debug(int debug); |
| 1206 | 1222 | ||
| 1207 | /*@}*/ | 1223 | /*@}*/ |
| 1208 | 1224 | ||
