gisi: Add convenience API for structs
authorAki Niemi <aki.niemi@nokia.com>
Sun, 14 Nov 2010 16:20:38 +0000 (18:20 +0200)
committerAki Niemi <aki.niemi@nokia.com>
Wed, 22 Dec 2010 15:13:46 +0000 (17:13 +0200)
gisi/iter.c
gisi/iter.h

index a0a9b3a..d0e534b 100644 (file)
@@ -223,3 +223,12 @@ gboolean g_isi_sb_iter_next(GIsiSubBlockIter *iter)
 
        return TRUE;
 }
+
+gboolean g_isi_sb_iter_get_struct(const GIsiSubBlockIter *restrict iter,
+                                       void **type, size_t len, unsigned pos)
+{
+       if (iter->start + pos + len > iter->end)
+               return FALSE;
+
+       return g_isi_sb_iter_get_data(iter, type, pos);
+}
index 74ec593..43814a0 100644 (file)
@@ -64,6 +64,8 @@ gboolean g_isi_sb_iter_get_alpha_tag(const GIsiSubBlockIter *restrict iter,
                                        char **utf8, size_t len, unsigned pos);
 gboolean g_isi_sb_iter_get_latin_tag(const GIsiSubBlockIter *restrict iter,
                                        char **ascii, size_t len, unsigned pos);
+gboolean g_isi_sb_iter_get_struct(const GIsiSubBlockIter *restrict iter,
+                                       void **ptr, size_t len, unsigned pos);
 
 #ifdef __cplusplus
 }