iterator: make private stuff public, cleanup private.h further

There is no good reason to keep them private
This commit is contained in:
George Kiagiadakis
2020-11-15 20:23:48 +02:00
parent 91472c51e9
commit 37134df7c8
13 changed files with 53 additions and 29 deletions

View File

@@ -46,6 +46,18 @@ WP_API
GType wp_iterator_get_type (void);
typedef struct _WpIterator WpIterator;
typedef struct _WpIteratorMethods WpIteratorMethods;
struct _WpIteratorMethods
{
void (*reset) (WpIterator *self);
gboolean (*next) (WpIterator *self, GValue *item);
gboolean (*fold) (WpIterator *self, WpIteratorFoldFunc func,
GValue *ret, gpointer data);
gboolean (*foreach) (WpIterator *self, WpIteratorForeachFunc func,
gpointer data);
void (*finalize) (WpIterator *self);
};
/* ref count */
@@ -76,6 +88,15 @@ gboolean wp_iterator_foreach (WpIterator *self, WpIteratorForeachFunc func,
WP_API
WpIterator * wp_iterator_new_ptr_array (GPtrArray * items, GType item_type);
WP_API
WpIterator * wp_iterator_new (const WpIteratorMethods * methods,
size_t user_size);
/* private */
WP_API
gpointer wp_iterator_get_user_data (WpIterator * self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WpIterator, wp_iterator_unref)
G_END_DECLS