mirror of
https://github.com/libimobiledevice/libplist
synced 2026-06-08 15:29:34 +00:00
Add function to get parent node in API and python bindings.
This commit is contained in:
@@ -147,6 +147,13 @@ extern "C" {
|
||||
*/
|
||||
PLIST_API plist_t plist_get_prev_sibling(plist_t node);
|
||||
|
||||
/**
|
||||
* Get the parent of a node
|
||||
*
|
||||
* @param node the parent (NULL if node is root)
|
||||
*/
|
||||
PLIST_API plist_t plist_get_parent(plist_t node);
|
||||
|
||||
/**
|
||||
* Get the nth child of a #PLIST_ARRAY node.
|
||||
*
|
||||
|
||||
@@ -195,6 +195,11 @@ plist_t plist_get_prev_sibling(plist_t node)
|
||||
return (plist_t) g_node_prev_sibling((GNode *) node);
|
||||
}
|
||||
|
||||
plist_t plist_get_parent(plist_t node)
|
||||
{
|
||||
return node ? (plist_t) ((GNode *) node)->parent : NULL;
|
||||
}
|
||||
|
||||
plist_t plist_get_array_nth_el(plist_t node, uint32_t n)
|
||||
{
|
||||
plist_t ret = NULL;
|
||||
|
||||
@@ -141,6 +141,14 @@ typedef struct {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PListNode* get_parent() {
|
||||
plist_t node = plist_get_parent( $self->node );
|
||||
if (node) {
|
||||
return allocate_wrapper(node, 1);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
%newobject as_key;
|
||||
char* as_key() {
|
||||
char* k = NULL;
|
||||
|
||||
Reference in New Issue
Block a user