diff options
Diffstat (limited to 'src/plist.c')
| -rw-r--r-- | src/plist.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/plist.c b/src/plist.c index 6b604d6..1b33ec3 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -2,9 +2,9 @@ | |||
| 2 | * plist.c | 2 | * plist.c |
| 3 | * Builds plist XML structures | 3 | * Builds plist XML structures |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2009-2016 Nikias Bassen All Rights Reserved. | 5 | * Copyright (c) 2009-2019 Nikias Bassen, All Rights Reserved. |
| 6 | * Copyright (c) 2010-2015 Martin Szulecki All Rights Reserved. | 6 | * Copyright (c) 2010-2015 Martin Szulecki, All Rights Reserved. |
| 7 | * Copyright (c) 2008 Zach C. All Rights Reserved. | 7 | * Copyright (c) 2008 Zach C., All Rights Reserved. |
| 8 | * | 8 | * |
| 9 | * This library is free software; you can redistribute it and/or | 9 | * This library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Lesser General Public | 10 | * modify it under the terms of the GNU Lesser General Public |
| @@ -457,6 +457,36 @@ PLIST_API void plist_array_remove_item(plist_t node, uint32_t n) | |||
| 457 | return; | 457 | return; |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | PLIST_API void plist_array_new_iter(plist_t node, plist_array_iter *iter) | ||
| 461 | { | ||
| 462 | if (iter) | ||
| 463 | { | ||
| 464 | *iter = malloc(sizeof(node_t*)); | ||
| 465 | *((node_t**)(*iter)) = node_first_child(node); | ||
| 466 | } | ||
| 467 | return; | ||
| 468 | } | ||
| 469 | |||
| 470 | PLIST_API void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item) | ||
| 471 | { | ||
| 472 | node_t** iter_node = (node_t**)iter; | ||
| 473 | |||
| 474 | if (item) | ||
| 475 | { | ||
| 476 | *item = NULL; | ||
| 477 | } | ||
| 478 | |||
| 479 | if (node && PLIST_ARRAY == plist_get_node_type(node) && *iter_node) | ||
| 480 | { | ||
| 481 | if (item) | ||
| 482 | { | ||
| 483 | *item = (plist_t)(*iter_node); | ||
| 484 | } | ||
| 485 | *iter_node = node_next_sibling(*iter_node); | ||
| 486 | } | ||
| 487 | return; | ||
| 488 | } | ||
| 489 | |||
| 460 | PLIST_API uint32_t plist_dict_get_size(plist_t node) | 490 | PLIST_API uint32_t plist_dict_get_size(plist_t node) |
| 461 | { | 491 | { |
| 462 | uint32_t ret = 0; | 492 | uint32_t ret = 0; |
| @@ -469,7 +499,7 @@ PLIST_API uint32_t plist_dict_get_size(plist_t node) | |||
| 469 | 499 | ||
| 470 | PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) | 500 | PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) |
| 471 | { | 501 | { |
| 472 | if (iter && *iter == NULL) | 502 | if (iter) |
| 473 | { | 503 | { |
| 474 | *iter = malloc(sizeof(node_t*)); | 504 | *iter = malloc(sizeof(node_t*)); |
| 475 | *((node_t**)(*iter)) = node_first_child(node); | 505 | *((node_t**)(*iter)) = node_first_child(node); |
