summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-05-20 01:10:48 +0200
committerGravatar Nikias Bassen2019-05-20 01:10:48 +0200
commitea37ed01b8c7e05078620ed039899ddff48eac1c (patch)
tree00934c62f94a023cc2a18bf4feb601210c3f20f4 /src
parent9555e71d9887d0d5caf87341dc47d9ad313bb609 (diff)
downloadlibplist-ea37ed01b8c7e05078620ed039899ddff48eac1c.tar.gz
libplist-ea37ed01b8c7e05078620ed039899ddff48eac1c.tar.bz2
Add plist_dict_item_get_key() to allow retrieving the key node for a given item of a #PLIST_DICT
Diffstat (limited to 'src')
-rw-r--r--src/plist.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plist.c b/src/plist.c
index dd659b8..29dbfb7 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -618,6 +618,17 @@ PLIST_API void plist_dict_get_item_key(plist_t node, char **key)
}
}
+PLIST_API plist_t plist_dict_item_get_key(plist_t node)
+{
+ plist_t ret = NULL;
+ plist_t father = plist_get_parent(node);
+ if (PLIST_DICT == plist_get_node_type(father))
+ {
+ ret = (plist_t)node_prev_sibling(node);
+ }
+ return ret;
+}
+
PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key)
{
plist_t ret = NULL;