Update Changelog
[profile/ivi/libgee.git] / gee / bidirlistiterator.c
1 /* bidirlistiterator.c generated by valac 0.18.0, the Vala compiler
2  * generated from bidirlistiterator.vala, do not modify */
3
4 /* bidirlistiterator.vala
5  *
6  * Copyright (C) 2011  Maciej Piechotka
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  *      Maciej Piechotka <uzytkownik2@gmail.com>
24  */
25
26 #include <glib.h>
27 #include <glib-object.h>
28
29
30 #define GEE_TYPE_TRAVERSABLE (gee_traversable_get_type ())
31 #define GEE_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversable))
32 #define GEE_IS_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TRAVERSABLE))
33 #define GEE_TRAVERSABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversableIface))
34
35 typedef struct _GeeTraversable GeeTraversable;
36 typedef struct _GeeTraversableIface GeeTraversableIface;
37
38 #define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())
39
40 #define GEE_TYPE_LAZY (gee_lazy_get_type ())
41 #define GEE_LAZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LAZY, GeeLazy))
42 #define GEE_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LAZY, GeeLazyClass))
43 #define GEE_IS_LAZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LAZY))
44 #define GEE_IS_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LAZY))
45 #define GEE_LAZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LAZY, GeeLazyClass))
46
47 typedef struct _GeeLazy GeeLazy;
48 typedef struct _GeeLazyClass GeeLazyClass;
49
50 #define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
51 #define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
52 #define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
53 #define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))
54
55 typedef struct _GeeIterator GeeIterator;
56 typedef struct _GeeIteratorIface GeeIteratorIface;
57
58 #define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ())
59 #define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator))
60 #define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR))
61 #define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface))
62
63 typedef struct _GeeBidirIterator GeeBidirIterator;
64 typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface;
65
66 #define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ())
67 #define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator))
68 #define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR))
69 #define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface))
70
71 typedef struct _GeeListIterator GeeListIterator;
72 typedef struct _GeeListIteratorIface GeeListIteratorIface;
73
74 #define GEE_TYPE_BIDIR_LIST_ITERATOR (gee_bidir_list_iterator_get_type ())
75 #define GEE_BIDIR_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_LIST_ITERATOR, GeeBidirListIterator))
76 #define GEE_IS_BIDIR_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_LIST_ITERATOR))
77 #define GEE_BIDIR_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_LIST_ITERATOR, GeeBidirListIteratorIface))
78
79 typedef struct _GeeBidirListIterator GeeBidirListIterator;
80 typedef struct _GeeBidirListIteratorIface GeeBidirListIteratorIface;
81
82 typedef gboolean (*GeeForallFunc) (gpointer g, void* user_data);
83 typedef enum  {
84         GEE_TRAVERSABLE_STREAM_YIELD,
85         GEE_TRAVERSABLE_STREAM_CONTINUE,
86         GEE_TRAVERSABLE_STREAM_END
87 } GeeTraversableStream;
88
89 typedef GeeTraversableStream (*GeeStreamFunc) (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, void* user_data);
90 typedef gpointer (*GeeFoldFunc) (gpointer g, gpointer a, void* user_data);
91 typedef gpointer (*GeeMapFunc) (gpointer g, void* user_data);
92 typedef gboolean (*GeePredicate) (gconstpointer g, void* user_data);
93 struct _GeeTraversableIface {
94         GTypeInterface parent_iface;
95         GType (*get_g_type) (GeeTraversable* self);
96         GBoxedCopyFunc (*get_g_dup_func) (GeeTraversable* self);
97         GDestroyNotify (*get_g_destroy_func) (GeeTraversable* self);
98         gboolean (*foreach) (GeeTraversable* self, GeeForallFunc f, void* f_target);
99         GeeIterator* (*stream) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
100         gpointer (*fold) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
101         GeeIterator* (*map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target);
102         GeeIterator* (*scan) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
103         GeeIterator* (*filter) (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
104         GeeIterator* (*chop) (GeeTraversable* self, gint offset, gint length);
105         GType (*get_element_type) (GeeTraversable* self);
106 };
107
108 struct _GeeIteratorIface {
109         GTypeInterface parent_iface;
110         gboolean (*next) (GeeIterator* self);
111         gboolean (*has_next) (GeeIterator* self);
112         gpointer (*get) (GeeIterator* self);
113         void (*remove) (GeeIterator* self);
114         gboolean (*get_valid) (GeeIterator* self);
115         gboolean (*get_read_only) (GeeIterator* self);
116 };
117
118 struct _GeeBidirIteratorIface {
119         GTypeInterface parent_iface;
120         GType (*get_g_type) (GeeBidirIterator* self);
121         GBoxedCopyFunc (*get_g_dup_func) (GeeBidirIterator* self);
122         GDestroyNotify (*get_g_destroy_func) (GeeBidirIterator* self);
123         gboolean (*previous) (GeeBidirIterator* self);
124         gboolean (*has_previous) (GeeBidirIterator* self);
125         gboolean (*first) (GeeBidirIterator* self);
126         gboolean (*last) (GeeBidirIterator* self);
127 };
128
129 struct _GeeListIteratorIface {
130         GTypeInterface parent_iface;
131         void (*set) (GeeListIterator* self, gconstpointer item);
132         void (*add) (GeeListIterator* self, gconstpointer item);
133         gint (*index) (GeeListIterator* self);
134 };
135
136 struct _GeeBidirListIteratorIface {
137         GTypeInterface parent_iface;
138         GType (*get_g_type) (GeeBidirListIterator* self);
139         GBoxedCopyFunc (*get_g_dup_func) (GeeBidirListIterator* self);
140         GDestroyNotify (*get_g_destroy_func) (GeeBidirListIterator* self);
141         void (*insert) (GeeBidirListIterator* self, gconstpointer item);
142 };
143
144
145
146 GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
147 gpointer gee_lazy_ref (gpointer instance);
148 void gee_lazy_unref (gpointer instance);
149 GParamSpec* gee_param_spec_lazy (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
150 void gee_value_set_lazy (GValue* value, gpointer v_object);
151 void gee_value_take_lazy (GValue* value, gpointer v_object);
152 gpointer gee_value_get_lazy (const GValue* value);
153 GType gee_lazy_get_type (void) G_GNUC_CONST;
154 GType gee_traversable_get_type (void) G_GNUC_CONST;
155 GType gee_iterator_get_type (void) G_GNUC_CONST;
156 GType gee_bidir_iterator_get_type (void) G_GNUC_CONST;
157 GType gee_list_iterator_get_type (void) G_GNUC_CONST;
158 GType gee_bidir_list_iterator_get_type (void) G_GNUC_CONST;
159 void gee_bidir_list_iterator_insert (GeeBidirListIterator* self, gconstpointer item);
160
161
162 /**
163  * Inserts the specified item before the current item in the iteration. The
164  * cursor is let to point to the current item.
165  */
166 void gee_bidir_list_iterator_insert (GeeBidirListIterator* self, gconstpointer item) {
167         g_return_if_fail (self != NULL);
168         GEE_BIDIR_LIST_ITERATOR_GET_INTERFACE (self)->insert (self, item);
169 }
170
171
172 static void gee_bidir_list_iterator_base_init (GeeBidirListIteratorIface * iface) {
173         static gboolean initialized = FALSE;
174         if (!initialized) {
175                 initialized = TRUE;
176         }
177 }
178
179
180 GType gee_bidir_list_iterator_get_type (void) {
181         static volatile gsize gee_bidir_list_iterator_type_id__volatile = 0;
182         if (g_once_init_enter (&gee_bidir_list_iterator_type_id__volatile)) {
183                 static const GTypeInfo g_define_type_info = { sizeof (GeeBidirListIteratorIface), (GBaseInitFunc) gee_bidir_list_iterator_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
184                 GType gee_bidir_list_iterator_type_id;
185                 gee_bidir_list_iterator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeBidirListIterator", &g_define_type_info, 0);
186                 g_type_interface_add_prerequisite (gee_bidir_list_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR);
187                 g_type_interface_add_prerequisite (gee_bidir_list_iterator_type_id, GEE_TYPE_LIST_ITERATOR);
188                 g_once_init_leave (&gee_bidir_list_iterator_type_id__volatile, gee_bidir_list_iterator_type_id);
189         }
190         return gee_bidir_list_iterator_type_id__volatile;
191 }
192
193
194