diff options
author | Jonathan Beck | 2009-04-15 22:35:56 +0200 |
---|---|---|
committer | Jonathan Beck | 2009-04-15 22:35:56 +0200 |
commit | 21e389bca01794aeca1e79c92a86fc060549b835 (patch) | |
tree | a116561eb9c682b31e1d560d5b1eb75f28ff6d8e /swig | |
parent | 2abf518f8e92957df0dd74c06c49a5eb17845865 (diff) | |
download | libplist-21e389bca01794aeca1e79c92a86fc060549b835.tar.gz libplist-21e389bca01794aeca1e79c92a86fc060549b835.tar.bz2 |
Add special accessor for structured types in API.
Diffstat (limited to 'swig')
-rw-r--r-- | swig/plist.i | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/swig/plist.i b/swig/plist.i index 41ff7cc..a56592e 100644 --- a/swig/plist.i +++ b/swig/plist.i @@ -180,21 +180,55 @@ typedef struct { } PListNode* find_node_by_key(char *s) { - PListNode* plist = allocate_wrapper(); - if (plist) { - plist->node = plist_find_node_by_key($self->node, s); - plist->should_keep_plist = 1; + plist_t node = plist_find_node_by_key($self->node, s); + if (node) { + PListNode* plist = allocate_wrapper(); + if (plist) { + plist->node = node; + plist->should_keep_plist = 1; + } + return plist; } - return plist; + return NULL; } PListNode* find_node_by_string(char* s) { - PListNode* plist = allocate_wrapper(); - if (plist) { - plist->node = plist_find_node_by_string($self->node, s); - plist->should_keep_plist = 1; + plist_t node = plist_find_node_by_string($self->node, s); + if (node) { + PListNode* plist = allocate_wrapper(); + if (plist) { + plist->node = node; + plist->should_keep_plist = 1; + } + return plist; + } + return NULL; + } + + PListNode* get_array_nth_el(unsigned int n) { + plist_t node = plist_get_array_nth_el($self->node, n); + if (node) { + PListNode* plist = allocate_wrapper(); + if (plist) { + plist->node = node; + plist->should_keep_plist = 1; + } + return plist; } - return plist; + return NULL; + } + + PListNode* get_dict_el_from_key(char *key) { + plist_t node = plist_get_dict_el_from_key($self->node, key); + if (node) { + PListNode* plist = allocate_wrapper(); + if (plist) { + plist->node = node; + plist->should_keep_plist = 1; + } + return plist; + } + return NULL; } char* to_xml () { |