diff options
| author | 2009-10-13 20:03:38 +0200 | |
|---|---|---|
| committer | 2009-10-13 20:03:38 +0200 | |
| commit | e492ef675c404cc6c0d1cfa26e47a1c16c850d5f (patch) | |
| tree | 57cdc453f9d29e465ff83622c8b43d89e46dca00 /include | |
| parent | 3cff5a16030168cdc45102a770b54b973170cd7f (diff) | |
| download | libplist-e492ef675c404cc6c0d1cfa26e47a1c16c850d5f.tar.gz libplist-e492ef675c404cc6c0d1cfa26e47a1c16c850d5f.tar.bz2 | |
Add path accessor util function.
Diffstat (limited to 'include')
| -rw-r--r-- | include/plist/plist.h | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index e12d6fa..699a0d6 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -48,6 +48,7 @@ extern "C" { | |||
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | #include <sys/types.h> | 50 | #include <sys/types.h> |
| 51 | #include <stdarg.h> | ||
| 51 | 52 | ||
| 52 | /** | 53 | /** |
| 53 | * \mainpage libplist : A library to handle Apple Property Lists | 54 | * \mainpage libplist : A library to handle Apple Property Lists |
| @@ -544,22 +545,25 @@ extern "C" { | |||
| 544 | ********************************************/ | 545 | ********************************************/ |
| 545 | 546 | ||
| 546 | /** | 547 | /** |
| 547 | * Find the first encountered #PLIST_KEY node mathing that key. | 548 | * Get a node from its path. Each path element depends on the associated father node type. |
| 549 | * For Dictionaries, var args are casted to const char*, for arrays, var args are caster to uint32_t | ||
| 548 | * Search is breath first order. | 550 | * Search is breath first order. |
| 549 | * | 551 | * |
| 550 | * @param plist the root node of the plist structure. | 552 | * @param plist the node to access result from. |
| 551 | * @param value the ASCII Key to match. | 553 | * @param length length of the path to access |
| 554 | * @return the value to access. | ||
| 552 | */ | 555 | */ |
| 553 | PLIST_API plist_t plist_find_node_by_key(plist_t plist, const char *value); | 556 | PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...); |
| 554 | 557 | ||
| 555 | /** | 558 | /** |
| 556 | * Find the first encountered #PLIST_STRING node mathing that string. | 559 | * Variadic version of #plist_access_path. |
| 557 | * Search is breath first order. | ||
| 558 | * | 560 | * |
| 559 | * @param plist the root node of the plist structure. | 561 | * @param plist the node to access result from. |
| 560 | * @param value the ASCII String to match. | 562 | * @param length length of the path to access |
| 563 | * @param v list of array's index and dic'st key | ||
| 564 | * @return the value to access. | ||
| 561 | */ | 565 | */ |
| 562 | PLIST_API plist_t plist_find_node_by_string(plist_t plist, const char *value); | 566 | PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v); |
| 563 | 567 | ||
| 564 | /** | 568 | /** |
| 565 | * Compare two node values | 569 | * Compare two node values |
| @@ -706,6 +710,31 @@ extern "C" { | |||
| 706 | */ | 710 | */ |
| 707 | PLIST_API void plist_add_sub_date_el(plist_t node, int32_t sec, int32_t usec); | 711 | PLIST_API void plist_add_sub_date_el(plist_t node, int32_t sec, int32_t usec); |
| 708 | 712 | ||
| 713 | |||
| 714 | /******************************************** | ||
| 715 | * * | ||
| 716 | * Utils * | ||
| 717 | * * | ||
| 718 | ********************************************/ | ||
| 719 | |||
| 720 | /** | ||
| 721 | * Find the first encountered #PLIST_KEY node mathing that key. | ||
| 722 | * Search is breath first order. | ||
| 723 | * | ||
| 724 | * @param plist the root node of the plist structure. | ||
| 725 | * @param value the ASCII Key to match. | ||
| 726 | */ | ||
| 727 | PLIST_API plist_t plist_find_node_by_key(plist_t plist, const char *value); | ||
| 728 | |||
| 729 | /** | ||
| 730 | * Find the first encountered #PLIST_STRING node mathing that string. | ||
| 731 | * Search is breath first order. | ||
| 732 | * | ||
| 733 | * @param plist the root node of the plist structure. | ||
| 734 | * @param value the ASCII String to match. | ||
| 735 | */ | ||
| 736 | PLIST_API plist_t plist_find_node_by_string(plist_t plist, const char *value); | ||
| 737 | |||
| 709 | /*@}*/ | 738 | /*@}*/ |
| 710 | 739 | ||
| 711 | 740 | ||
