1 /* bidirmapiterator.c generated by valac 0.18.0, the Vala compiler
2 * generated from bidirmapiterator.vala, do not modify */
6 * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka
7 * Copyright (C) 2011 Maciej Piechotka
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * Maciej Piechotka <uzytkownik2@gmail.com>
28 #include <glib-object.h>
31 #define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ())
32 #define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator))
33 #define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR))
34 #define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface))
36 typedef struct _GeeMapIterator GeeMapIterator;
37 typedef struct _GeeMapIteratorIface GeeMapIteratorIface;
39 #define GEE_TYPE_BIDIR_MAP_ITERATOR (gee_bidir_map_iterator_get_type ())
40 #define GEE_BIDIR_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_MAP_ITERATOR, GeeBidirMapIterator))
41 #define GEE_IS_BIDIR_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_MAP_ITERATOR))
42 #define GEE_BIDIR_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_MAP_ITERATOR, GeeBidirMapIteratorIface))
44 typedef struct _GeeBidirMapIterator GeeBidirMapIterator;
45 typedef struct _GeeBidirMapIteratorIface GeeBidirMapIteratorIface;
47 typedef gpointer (*GeeFoldMapFunc) (gconstpointer k, gconstpointer v, gpointer a, void* user_data);
48 typedef gboolean (*GeeForallMapFunc) (gconstpointer k, gconstpointer v, void* user_data);
49 struct _GeeMapIteratorIface {
50 GTypeInterface parent_iface;
51 GType (*get_k_type) (GeeMapIterator* self);
52 GBoxedCopyFunc (*get_k_dup_func) (GeeMapIterator* self);
53 GDestroyNotify (*get_k_destroy_func) (GeeMapIterator* self);
54 GType (*get_v_type) (GeeMapIterator* self);
55 GBoxedCopyFunc (*get_v_dup_func) (GeeMapIterator* self);
56 GDestroyNotify (*get_v_destroy_func) (GeeMapIterator* self);
57 gboolean (*next) (GeeMapIterator* self);
58 gboolean (*has_next) (GeeMapIterator* self);
59 gpointer (*get_key) (GeeMapIterator* self);
60 gpointer (*get_value) (GeeMapIterator* self);
61 void (*set_value) (GeeMapIterator* self, gconstpointer value);
62 void (*unset) (GeeMapIterator* self);
63 gpointer (*fold) (GeeMapIterator* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldMapFunc f, void* f_target, gpointer seed);
64 gboolean (*foreach) (GeeMapIterator* self, GeeForallMapFunc f, void* f_target);
65 gboolean (*get_valid) (GeeMapIterator* self);
66 gboolean (*get_mutable) (GeeMapIterator* self);
67 gboolean (*get_read_only) (GeeMapIterator* self);
70 struct _GeeBidirMapIteratorIface {
71 GTypeInterface parent_iface;
72 GType (*get_k_type) (GeeBidirMapIterator* self);
73 GBoxedCopyFunc (*get_k_dup_func) (GeeBidirMapIterator* self);
74 GDestroyNotify (*get_k_destroy_func) (GeeBidirMapIterator* self);
75 GType (*get_v_type) (GeeBidirMapIterator* self);
76 GBoxedCopyFunc (*get_v_dup_func) (GeeBidirMapIterator* self);
77 GDestroyNotify (*get_v_destroy_func) (GeeBidirMapIterator* self);
78 gboolean (*previous) (GeeBidirMapIterator* self);
79 gboolean (*has_previous) (GeeBidirMapIterator* self);
80 gboolean (*first) (GeeBidirMapIterator* self);
81 gboolean (*last) (GeeBidirMapIterator* self);
86 GType gee_map_iterator_get_type (void) G_GNUC_CONST;
87 GType gee_bidir_map_iterator_get_type (void) G_GNUC_CONST;
88 gboolean gee_bidir_map_iterator_previous (GeeBidirMapIterator* self);
89 gboolean gee_bidir_map_iterator_has_previous (GeeBidirMapIterator* self);
90 gboolean gee_bidir_map_iterator_first (GeeBidirMapIterator* self);
91 gboolean gee_bidir_map_iterator_last (GeeBidirMapIterator* self);
95 * Rewinds to the previous element in the iteration.
97 * @return `true` if the iterator has a previous element
99 gboolean gee_bidir_map_iterator_previous (GeeBidirMapIterator* self) {
100 g_return_val_if_fail (self != NULL, FALSE);
101 return GEE_BIDIR_MAP_ITERATOR_GET_INTERFACE (self)->previous (self);
106 * Checks whether there is a previous element in the iteration.
108 * @return `true` if the iterator has a previous element
110 gboolean gee_bidir_map_iterator_has_previous (GeeBidirMapIterator* self) {
111 g_return_val_if_fail (self != NULL, FALSE);
112 return GEE_BIDIR_MAP_ITERATOR_GET_INTERFACE (self)->has_previous (self);
117 * Goes back to the first element.
119 * @return `true` if the iterator has a first element
121 gboolean gee_bidir_map_iterator_first (GeeBidirMapIterator* self) {
122 g_return_val_if_fail (self != NULL, FALSE);
123 return GEE_BIDIR_MAP_ITERATOR_GET_INTERFACE (self)->first (self);
128 * Advances to the last element in the iteration.
130 * @return `true` if the iterator has a last element
132 gboolean gee_bidir_map_iterator_last (GeeBidirMapIterator* self) {
133 g_return_val_if_fail (self != NULL, FALSE);
134 return GEE_BIDIR_MAP_ITERATOR_GET_INTERFACE (self)->last (self);
138 static void gee_bidir_map_iterator_base_init (GeeBidirMapIteratorIface * iface) {
139 static gboolean initialized = FALSE;
147 * A bi-directional Map iterator.
149 GType gee_bidir_map_iterator_get_type (void) {
150 static volatile gsize gee_bidir_map_iterator_type_id__volatile = 0;
151 if (g_once_init_enter (&gee_bidir_map_iterator_type_id__volatile)) {
152 static const GTypeInfo g_define_type_info = { sizeof (GeeBidirMapIteratorIface), (GBaseInitFunc) gee_bidir_map_iterator_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
153 GType gee_bidir_map_iterator_type_id;
154 gee_bidir_map_iterator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeBidirMapIterator", &g_define_type_info, 0);
155 g_type_interface_add_prerequisite (gee_bidir_map_iterator_type_id, GEE_TYPE_MAP_ITERATOR);
156 g_once_init_leave (&gee_bidir_map_iterator_type_id__volatile, gee_bidir_map_iterator_type_id);
158 return gee_bidir_map_iterator_type_id__volatile;