1 /* tracker-connection-mock.c generated by valac 0.18.1, the Vala compiler
2 * generated from tracker-connection-mock.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include "libtracker-sparql/tracker-sparql.h"
8 #include <stdlib.h>
9 #include <string.h>
10 #include <gio/gio.h>
11
12
13 #define TYPE_TRACKER_MOCK_RESULTS (tracker_mock_results_get_type ())
14 #define TRACKER_MOCK_RESULTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRACKER_MOCK_RESULTS, TrackerMockResults))
15 #define TRACKER_MOCK_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRACKER_MOCK_RESULTS, TrackerMockResultsClass))
16 #define IS_TRACKER_MOCK_RESULTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRACKER_MOCK_RESULTS))
17 #define IS_TRACKER_MOCK_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRACKER_MOCK_RESULTS))
18 #define TRACKER_MOCK_RESULTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRACKER_MOCK_RESULTS, TrackerMockResultsClass))
19
20 typedef struct _TrackerMockResults TrackerMockResults;
21 typedef struct _TrackerMockResultsClass TrackerMockResultsClass;
22 typedef struct _TrackerMockResultsPrivate TrackerMockResultsPrivate;
23 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
24 typedef struct _TrackerMockResultsNextAsyncData TrackerMockResultsNextAsyncData;
25
26 #define TYPE_TRACKER_MOCK_CONNECTION (tracker_mock_connection_get_type ())
27 #define TRACKER_MOCK_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRACKER_MOCK_CONNECTION, TrackerMockConnection))
28 #define TRACKER_MOCK_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRACKER_MOCK_CONNECTION, TrackerMockConnectionClass))
29 #define IS_TRACKER_MOCK_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRACKER_MOCK_CONNECTION))
30 #define IS_TRACKER_MOCK_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRACKER_MOCK_CONNECTION))
31 #define TRACKER_MOCK_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRACKER_MOCK_CONNECTION, TrackerMockConnectionClass))
32
33 typedef struct _TrackerMockConnection TrackerMockConnection;
34 typedef struct _TrackerMockConnectionClass TrackerMockConnectionClass;
35 typedef struct _TrackerMockConnectionPrivate TrackerMockConnectionPrivate;
36 #define _g_free0(var) (var = (g_free (var), NULL))
37 typedef struct _TrackerMockConnectionQueryAsyncData TrackerMockConnectionQueryAsyncData;
38
39 struct _TrackerMockResults {
40 TrackerSparqlCursor parent_instance;
41 TrackerMockResultsPrivate * priv;
42 };
43
44 struct _TrackerMockResultsClass {
45 TrackerSparqlCursorClass parent_class;
46 };
47
48 struct _TrackerMockResultsPrivate {
49 gint rows;
50 gint current_row;
51 gchar** results;
52 gint results_length1;
53 gint results_length2;
54 gchar** var_names;
55 gint var_names_length1;
56 gint _var_names_size_;
57 TrackerSparqlValueType* types;
58 gint types_length1;
59 gint _types_size_;
60 gint cols;
61 };
62
63 struct _TrackerMockResultsNextAsyncData {
64 int _state_;
65 GObject* _source_object_;
66 GAsyncResult* _res_;
67 GSimpleAsyncResult* _async_result;
68 TrackerMockResults* self;
69 GCancellable* cancellable;
70 gboolean result;
71 GCancellable* _tmp0_;
72 gboolean _tmp1_;
73 gboolean _tmp2_;
74 GError * _inner_error_;
75 };
76
77 struct _TrackerMockConnection {
78 TrackerSparqlConnection parent_instance;
79 TrackerMockConnectionPrivate * priv;
80 };
81
82 struct _TrackerMockConnectionClass {
83 TrackerSparqlConnectionClass parent_class;
84 };
85
86 struct _TrackerMockConnectionPrivate {
87 TrackerMockResults* results;
88 TrackerMockResults* hardcoded;
89 };
90
91 struct _TrackerMockConnectionQueryAsyncData {
92 int _state_;
93 GObject* _source_object_;
94 GAsyncResult* _res_;
95 GSimpleAsyncResult* _async_result;
96 TrackerMockConnection* self;
97 gchar* sparql;
98 GCancellable* cancellable;
99 TrackerSparqlCursor* result;
100 TrackerMockResults* _tmp0_;
101 TrackerMockResults* _tmp1_;
102 TrackerSparqlCursor* _tmp2_;
103 TrackerMockResults* _tmp3_;
104 TrackerSparqlCursor* _tmp4_;
105 };
106
107
108 static gpointer tracker_mock_results_parent_class = NULL;
109 static gpointer tracker_mock_connection_parent_class = NULL;
110
111 GType tracker_mock_results_get_type (void) G_GNUC_CONST;
112 #define TRACKER_MOCK_RESULTS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TRACKER_MOCK_RESULTS, TrackerMockResultsPrivate))
113 enum {
114 TRACKER_MOCK_RESULTS_DUMMY_PROPERTY,
115 TRACKER_MOCK_RESULTS_N_COLUMNS
116 };
117 TrackerMockResults* tracker_mock_results_new (gchar** results, int results_length1, int results_length2, gint rows, gint cols, gchar** var_names, int var_names_length1, TrackerSparqlValueType* types, int types_length1);
118 TrackerMockResults* tracker_mock_results_construct (GType object_type, gchar** results, int results_length1, int results_length2, gint rows, gint cols, gchar** var_names, int var_names_length1, TrackerSparqlValueType* types, int types_length1);
119 static TrackerSparqlValueType* _vala_array_dup1 (TrackerSparqlValueType* self, int length);
120 static gchar** _vala_array_dup2 (gchar** self, int length);
121 static TrackerSparqlValueType tracker_mock_results_real_get_value_type (TrackerSparqlCursor* base, gint column);
122 static const gchar* tracker_mock_results_real_get_variable_name (TrackerSparqlCursor* base, gint column);
123 static const gchar* tracker_mock_results_real_get_string (TrackerSparqlCursor* base, gint column, glong* length);
124 static gboolean tracker_mock_results_real_next (TrackerSparqlCursor* base, GCancellable* cancellable, GError** error);
125 static void tracker_mock_results_real_next_async_data_free (gpointer _data);
126 static void tracker_mock_results_real_next_async (TrackerSparqlCursor* base, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
127 static gboolean tracker_mock_results_real_next_async_co (TrackerMockResultsNextAsyncData* _data_);
128 static void tracker_mock_results_real_rewind (TrackerSparqlCursor* base);
129 static void tracker_mock_results_finalize (GObject* obj);
130 static void _vala_tracker_mock_results_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
131 GType tracker_mock_connection_get_type (void) G_GNUC_CONST;
132 #define TRACKER_MOCK_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TRACKER_MOCK_CONNECTION, TrackerMockConnectionPrivate))
133 enum {
134 TRACKER_MOCK_CONNECTION_DUMMY_PROPERTY
135 };
136 static TrackerSparqlCursor* tracker_mock_connection_real_query (TrackerSparqlConnection* base, const gchar* sparql, GCancellable* cancellable, GError** error);
137 static void tracker_mock_connection_real_query_async_data_free (gpointer _data);
138 static void tracker_mock_connection_real_query_async (TrackerSparqlConnection* base, const gchar* sparql, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
139 static gboolean tracker_mock_connection_real_query_async_co (TrackerMockConnectionQueryAsyncData* _data_);
140 void tracker_mock_connection_set_results (TrackerMockConnection* self, TrackerMockResults* results);
141 TrackerMockConnection* tracker_mock_connection_new (void);
142 TrackerMockConnection* tracker_mock_connection_construct (GType object_type);
143 static void tracker_mock_connection_finalize (GObject* obj);
144 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
145 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
146
147
148 static TrackerSparqlValueType* _vala_array_dup1 (TrackerSparqlValueType* self, int length) {
149 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
150 return g_memdup (self, length * sizeof (TrackerSparqlValueType));
151 #line 152 "tracker-connection-mock.c"
152 }
153
154
155 static gchar** _vala_array_dup2 (gchar** self, int length) {
156 gchar** result;
157 int i;
158 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
159 result = g_new0 (gchar*, length + 1);
160 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
161 for (i = 0; i < length; i++) {
162 #line 163 "tracker-connection-mock.c"
163 gchar* _tmp0_;
164 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
165 _tmp0_ = g_strdup (self[i]);
166 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
167 result[i] = _tmp0_;
168 #line 169 "tracker-connection-mock.c"
169 }
170 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
171 return result;
172 #line 173 "tracker-connection-mock.c"
173 }
174
175
176 TrackerMockResults* tracker_mock_results_construct (GType object_type, gchar** results, int results_length1, int results_length2, gint rows, gint cols, gchar** var_names, int var_names_length1, TrackerSparqlValueType* types, int types_length1) {
177 TrackerMockResults * self = NULL;
178 gint _tmp0_;
179 gint _tmp1_;
180 gchar** _tmp2_;
181 gint _tmp2__length1;
182 gint _tmp2__length2;
183 TrackerSparqlValueType* _tmp3_;
184 gint _tmp3__length1;
185 TrackerSparqlValueType* _tmp4_;
186 gint _tmp4__length1;
187 gchar** _tmp5_;
188 gint _tmp5__length1;
189 gchar** _tmp6_;
190 gint _tmp6__length1;
191 #line 13 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
192 self = (TrackerMockResults*) tracker_sparql_cursor_construct (object_type);
193 #line 14 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
194 _tmp0_ = rows;
195 #line 14 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
196 self->priv->rows = _tmp0_;
197 #line 15 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
198 _tmp1_ = cols;
199 #line 15 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
200 self->priv->cols = _tmp1_;
201 #line 16 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
202 _tmp2_ = results;
203 #line 16 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
204 _tmp2__length1 = results_length1;
205 #line 16 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
206 _tmp2__length2 = results_length2;
207 #line 16 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
208 results = NULL;
209 #line 16 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
210 self->priv->results = (_vala_array_free (self->priv->results, self->priv->results_length1 * self->priv->results_length2, (GDestroyNotify) g_free), NULL);
211 #line 16 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
212 self->priv->results = _tmp2_;
213 #line 16 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
214 self->priv->results_length1 = _tmp2__length1;
215 #line 16 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
216 self->priv->results_length2 = _tmp2__length2;
217 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
218 _tmp3_ = types;
219 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
220 _tmp3__length1 = types_length1;
221 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
222 _tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup1 (_tmp3_, _tmp3__length1) : ((gpointer) _tmp3_);
223 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
224 _tmp4__length1 = _tmp3__length1;
225 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
226 self->priv->types = (g_free (self->priv->types), NULL);
227 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
228 self->priv->types = _tmp4_;
229 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
230 self->priv->types_length1 = _tmp4__length1;
231 #line 17 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
232 self->priv->_types_size_ = self->priv->types_length1;
233 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
234 _tmp5_ = var_names;
235 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
236 _tmp5__length1 = var_names_length1;
237 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
238 _tmp6_ = (_tmp5_ != NULL) ? _vala_array_dup2 (_tmp5_, _tmp5__length1) : ((gpointer) _tmp5_);
239 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
240 _tmp6__length1 = _tmp5__length1;
241 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
242 self->priv->var_names = (_vala_array_free (self->priv->var_names, self->priv->var_names_length1, (GDestroyNotify) g_free), NULL);
243 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
244 self->priv->var_names = _tmp6_;
245 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
246 self->priv->var_names_length1 = _tmp6__length1;
247 #line 18 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
248 self->priv->_var_names_size_ = self->priv->var_names_length1;
249 #line 13 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
250 results = (_vala_array_free (results, results_length1 * results_length2, (GDestroyNotify) g_free), NULL);
251 #line 13 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
252 return self;
253 #line 254 "tracker-connection-mock.c"
254 }
255
256
257 TrackerMockResults* tracker_mock_results_new (gchar** results, int results_length1, int results_length2, gint rows, gint cols, gchar** var_names, int var_names_length1, TrackerSparqlValueType* types, int types_length1) {
258 #line 13 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
259 return tracker_mock_results_construct (TYPE_TRACKER_MOCK_RESULTS, results, results_length1, results_length2, rows, cols, var_names, var_names_length1, types, types_length1);
260 #line 261 "tracker-connection-mock.c"
261 }
262
263
264 static TrackerSparqlValueType tracker_mock_results_real_get_value_type (TrackerSparqlCursor* base, gint column) {
265 TrackerMockResults * self;
266 TrackerSparqlValueType result = 0;
267 gint _tmp0_;
268 TrackerSparqlValueType* _tmp1_;
269 gint _tmp1__length1;
variable '_tmp1__length1' set but not used
(emitted by gcc)
270 gint _tmp2_;
271 TrackerSparqlValueType _tmp3_;
272 #line 23 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
273 self = (TrackerMockResults*) base;
274 #line 23 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
275 _tmp0_ = self->priv->current_row;
276 #line 23 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
277 g_return_val_if_fail (_tmp0_ >= 0, 0);
278 #line 25 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
279 _tmp1_ = self->priv->types;
280 #line 25 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
281 _tmp1__length1 = self->priv->types_length1;
282 #line 25 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
283 _tmp2_ = column;
284 #line 25 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
285 _tmp3_ = _tmp1_[_tmp2_];
286 #line 25 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
287 result = _tmp3_;
288 #line 25 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
289 return result;
290 #line 291 "tracker-connection-mock.c"
291 }
292
293
294 static const gchar* tracker_mock_results_real_get_variable_name (TrackerSparqlCursor* base, gint column) {
295 TrackerMockResults * self;
296 const gchar* result = NULL;
297 gint _tmp0_;
298 gchar** _tmp1_;
299 gint _tmp1__length1;
variable '_tmp1__length1' set but not used
(emitted by gcc)
300 gint _tmp2_;
301 const gchar* _tmp3_;
302 #line 28 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
303 self = (TrackerMockResults*) base;
304 #line 28 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
305 _tmp0_ = self->priv->current_row;
306 #line 28 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
307 g_return_val_if_fail (_tmp0_ >= 0, NULL);
308 #line 30 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
309 _tmp1_ = self->priv->var_names;
310 #line 30 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
311 _tmp1__length1 = self->priv->var_names_length1;
312 #line 30 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
313 _tmp2_ = column;
314 #line 30 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
315 _tmp3_ = _tmp1_[_tmp2_];
316 #line 30 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
317 result = _tmp3_;
318 #line 30 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
319 return result;
320 #line 321 "tracker-connection-mock.c"
321 }
322
323
324 static const gchar* tracker_mock_results_real_get_string (TrackerSparqlCursor* base, gint column, glong* length) {
325 TrackerMockResults * self;
326 glong _vala_length = 0L;
327 const gchar* result = NULL;
328 gint _tmp0_;
329 const gchar* str = NULL;
330 gchar** _tmp1_;
331 gint _tmp1__length1;
variable '_tmp1__length1' set but not used
(emitted by gcc)
332 gint _tmp1__length2;
333 gint _tmp2_;
334 gint _tmp3_;
335 const gchar* _tmp4_;
336 gint _tmp5_;
337 gint _tmp6_;
338 #line 33 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
339 self = (TrackerMockResults*) base;
340 #line 33 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
341 _tmp0_ = self->priv->current_row;
342 #line 33 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
343 g_return_val_if_fail (_tmp0_ >= 0, NULL);
344 #line 37 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
345 _tmp1_ = self->priv->results;
346 #line 37 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
347 _tmp1__length1 = self->priv->results_length1;
348 #line 37 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
349 _tmp1__length2 = self->priv->results_length2;
350 #line 37 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
351 _tmp2_ = self->priv->current_row;
352 #line 37 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
353 _tmp3_ = column;
354 #line 37 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
355 _tmp4_ = _tmp1_[(_tmp2_ * _tmp1__length2) + _tmp3_];
356 #line 37 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
357 str = _tmp4_;
358 #line 39 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
359 _tmp5_ = strlen (str);
360 #line 39 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
361 _tmp6_ = _tmp5_;
362 #line 39 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
363 _vala_length = (glong) _tmp6_;
364 #line 41 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
365 result = str;
366 #line 41 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
367 if (length) {
368 #line 41 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
369 *length = _vala_length;
370 #line 371 "tracker-connection-mock.c"
371 }
372 #line 41 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
373 return result;
374 #line 375 "tracker-connection-mock.c"
375 }
376
377
378 static gboolean tracker_mock_results_real_next (TrackerSparqlCursor* base, GCancellable* cancellable, GError** error) {
379 TrackerMockResults * self;
380 gboolean result = FALSE;
381 gint _tmp0_;
382 gint _tmp1_;
383 gint _tmp2_;
384 #line 44 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
385 self = (TrackerMockResults*) base;
386 #line 45 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
387 _tmp0_ = self->priv->current_row;
388 #line 45 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
389 _tmp1_ = self->priv->rows;
390 #line 45 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
391 if (_tmp0_ >= (_tmp1_ - 1)) {
392 #line 46 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
393 result = FALSE;
394 #line 46 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
395 return result;
396 #line 397 "tracker-connection-mock.c"
397 }
398 #line 48 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
399 _tmp2_ = self->priv->current_row;
400 #line 48 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
401 self->priv->current_row = _tmp2_ + 1;
402 #line 49 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
403 result = TRUE;
404 #line 49 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
405 return result;
406 #line 407 "tracker-connection-mock.c"
407 }
408
409
410 static void tracker_mock_results_real_next_async_data_free (gpointer _data) {
411 TrackerMockResultsNextAsyncData* _data_;
412 _data_ = _data;
413 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
414 _g_object_unref0 (_data_->cancellable);
415 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
416 _g_object_unref0 (_data_->self);
417 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
418 g_slice_free (TrackerMockResultsNextAsyncData, _data_);
419 #line 420 "tracker-connection-mock.c"
420 }
421
422
423 static gpointer _g_object_ref0 (gpointer self) {
424 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
425 return self ? g_object_ref (self) : NULL;
426 #line 427 "tracker-connection-mock.c"
427 }
428
429
430 static void tracker_mock_results_real_next_async (TrackerSparqlCursor* base, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
431 TrackerMockResults * self;
432 TrackerMockResultsNextAsyncData* _data_;
433 TrackerMockResults* _tmp0_;
434 GCancellable* _tmp1_;
435 GCancellable* _tmp2_;
436 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
437 self = (TrackerMockResults*) base;
438 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
439 _data_ = g_slice_new0 (TrackerMockResultsNextAsyncData);
440 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
441 _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, tracker_mock_results_real_next_async);
442 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
443 g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_mock_results_real_next_async_data_free);
444 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
445 _tmp0_ = _g_object_ref0 (self);
446 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
447 _data_->self = _tmp0_;
448 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
449 _tmp1_ = cancellable;
450 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
451 _tmp2_ = _g_object_ref0 (_tmp1_);
452 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
453 _g_object_unref0 (_data_->cancellable);
454 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
455 _data_->cancellable = _tmp2_;
456 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
457 tracker_mock_results_real_next_async_co (_data_);
458 #line 459 "tracker-connection-mock.c"
459 }
460
461
462 static gboolean tracker_mock_results_real_next_finish (TrackerSparqlCursor* base, GAsyncResult* _res_, GError** error) {
463 gboolean result;
464 TrackerMockResultsNextAsyncData* _data_;
465 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
466 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
467 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
468 return FALSE;
469 #line 470 "tracker-connection-mock.c"
470 }
471 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
472 _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
473 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
474 result = _data_->result;
475 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
476 return result;
477 #line 478 "tracker-connection-mock.c"
478 }
479
480
481 static gboolean tracker_mock_results_real_next_async_co (TrackerMockResultsNextAsyncData* _data_) {
482 #line 52 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
483 switch (_data_->_state_) {
484 #line 52 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
485 case 0:
486 #line 487 "tracker-connection-mock.c"
487 goto _state_0;
488 default:
489 #line 52 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
490 g_assert_not_reached ();
491 #line 492 "tracker-connection-mock.c"
492 }
493 _state_0:
494 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
495 _data_->_tmp0_ = _data_->cancellable;
496 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
497 _data_->_tmp1_ = FALSE;
498 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
499 _data_->_tmp1_ = tracker_sparql_cursor_next ((TrackerSparqlCursor*) _data_->self, _data_->_tmp0_, &_data_->_inner_error_);
500 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
501 _data_->_tmp2_ = _data_->_tmp1_;
502 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
503 if (_data_->_inner_error_ != NULL) {
504 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
505 g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
506 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
507 g_error_free (_data_->_inner_error_);
508 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
509 if (_data_->_state_ == 0) {
510 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
511 g_simple_async_result_complete_in_idle (_data_->_async_result);
512 #line 513 "tracker-connection-mock.c"
513 } else {
514 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
515 g_simple_async_result_complete (_data_->_async_result);
516 #line 517 "tracker-connection-mock.c"
517 }
518 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
519 g_object_unref (_data_->_async_result);
520 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
521 return FALSE;
522 #line 523 "tracker-connection-mock.c"
523 }
524 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
525 _data_->result = _data_->_tmp2_;
526 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
527 if (_data_->_state_ == 0) {
528 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
529 g_simple_async_result_complete_in_idle (_data_->_async_result);
530 #line 531 "tracker-connection-mock.c"
531 } else {
532 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
533 g_simple_async_result_complete (_data_->_async_result);
534 #line 535 "tracker-connection-mock.c"
535 }
536 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
537 g_object_unref (_data_->_async_result);
538 #line 54 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
539 return FALSE;
540 #line 52 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
541 if (_data_->_state_ == 0) {
542 #line 52 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
543 g_simple_async_result_complete_in_idle (_data_->_async_result);
544 #line 545 "tracker-connection-mock.c"
545 } else {
546 #line 52 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
547 g_simple_async_result_complete (_data_->_async_result);
548 #line 549 "tracker-connection-mock.c"
549 }
550 #line 52 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
551 g_object_unref (_data_->_async_result);
552 #line 52 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
553 return FALSE;
554 #line 555 "tracker-connection-mock.c"
555 }
556
557
558 static void tracker_mock_results_real_rewind (TrackerSparqlCursor* base) {
559 TrackerMockResults * self;
560 #line 57 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
561 self = (TrackerMockResults*) base;
562 #line 58 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
563 self->priv->current_row = 0;
564 #line 565 "tracker-connection-mock.c"
565 }
566
567
568 static gint tracker_mock_results_real_get_n_columns (TrackerSparqlCursor* base) {
569 gint result;
570 TrackerMockResults* self;
571 gint _tmp0_;
572 #line 21 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
573 self = (TrackerMockResults*) base;
574 #line 21 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
575 _tmp0_ = self->priv->cols;
576 #line 21 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
577 result = _tmp0_;
578 #line 21 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
579 return result;
580 #line 581 "tracker-connection-mock.c"
581 }
582
583
584 static void tracker_mock_results_class_init (TrackerMockResultsClass * klass) {
585 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
586 tracker_mock_results_parent_class = g_type_class_peek_parent (klass);
587 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
588 g_type_class_add_private (klass, sizeof (TrackerMockResultsPrivate));
589 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
590 TRACKER_SPARQL_CURSOR_CLASS (klass)->get_value_type = tracker_mock_results_real_get_value_type;
591 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
592 TRACKER_SPARQL_CURSOR_CLASS (klass)->get_variable_name = tracker_mock_results_real_get_variable_name;
593 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
594 TRACKER_SPARQL_CURSOR_CLASS (klass)->get_string = tracker_mock_results_real_get_string;
595 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
596 TRACKER_SPARQL_CURSOR_CLASS (klass)->next = tracker_mock_results_real_next;
597 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
598 TRACKER_SPARQL_CURSOR_CLASS (klass)->next_async = tracker_mock_results_real_next_async;
599 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
600 TRACKER_SPARQL_CURSOR_CLASS (klass)->next_finish = tracker_mock_results_real_next_finish;
601 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
602 TRACKER_SPARQL_CURSOR_CLASS (klass)->rewind = tracker_mock_results_real_rewind;
603 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
604 TRACKER_SPARQL_CURSOR_CLASS (klass)->get_n_columns = tracker_mock_results_real_get_n_columns;
605 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
606 G_OBJECT_CLASS (klass)->get_property = _vala_tracker_mock_results_get_property;
607 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
608 G_OBJECT_CLASS (klass)->finalize = tracker_mock_results_finalize;
609 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
610 g_object_class_install_property (G_OBJECT_CLASS (klass), TRACKER_MOCK_RESULTS_N_COLUMNS, g_param_spec_int ("n-columns", "n-columns", "n-columns", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
611 #line 612 "tracker-connection-mock.c"
612 }
613
614
615 static void tracker_mock_results_instance_init (TrackerMockResults * self) {
616 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
617 self->priv = TRACKER_MOCK_RESULTS_GET_PRIVATE (self);
618 #line 7 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
619 self->priv->current_row = -1;
620 #line 621 "tracker-connection-mock.c"
621 }
622
623
624 static void tracker_mock_results_finalize (GObject* obj) {
625 TrackerMockResults * self;
626 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
627 self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TRACKER_MOCK_RESULTS, TrackerMockResults);
628 #line 8 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
629 self->priv->results = (_vala_array_free (self->priv->results, self->priv->results_length1 * self->priv->results_length2, (GDestroyNotify) g_free), NULL);
630 #line 9 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
631 self->priv->var_names = (_vala_array_free (self->priv->var_names, self->priv->var_names_length1, (GDestroyNotify) g_free), NULL);
632 #line 10 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
633 self->priv->types = (g_free (self->priv->types), NULL);
634 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
635 G_OBJECT_CLASS (tracker_mock_results_parent_class)->finalize (obj);
636 #line 637 "tracker-connection-mock.c"
637 }
638
639
640 GType tracker_mock_results_get_type (void) {
641 static volatile gsize tracker_mock_results_type_id__volatile = 0;
642 if (g_once_init_enter (&tracker_mock_results_type_id__volatile)) {
643 static const GTypeInfo g_define_type_info = { sizeof (TrackerMockResultsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_mock_results_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerMockResults), 0, (GInstanceInitFunc) tracker_mock_results_instance_init, NULL };
644 GType tracker_mock_results_type_id;
645 tracker_mock_results_type_id = g_type_register_static (TRACKER_SPARQL_TYPE_CURSOR, "TrackerMockResults", &g_define_type_info, 0);
646 g_once_init_leave (&tracker_mock_results_type_id__volatile, tracker_mock_results_type_id);
647 }
648 return tracker_mock_results_type_id__volatile;
649 }
650
651
652 static void _vala_tracker_mock_results_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
653 TrackerMockResults * self;
654 self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TRACKER_MOCK_RESULTS, TrackerMockResults);
655 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
656 switch (property_id) {
657 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
658 case TRACKER_MOCK_RESULTS_N_COLUMNS:
659 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
660 g_value_set_int (value, tracker_sparql_cursor_get_n_columns ((TrackerSparqlCursor*) self));
661 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
662 break;
663 #line 664 "tracker-connection-mock.c"
664 default:
665 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
666 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
667 #line 5 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
668 break;
669 #line 670 "tracker-connection-mock.c"
670 }
671 }
672
673
674 static TrackerSparqlCursor* tracker_mock_connection_real_query (TrackerSparqlConnection* base, const gchar* sparql, GCancellable* cancellable, GError** error) {
675 TrackerMockConnection * self;
676 TrackerSparqlCursor* result = NULL;
677 TrackerMockResults* _tmp0_;
678 #line 72 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
679 self = (TrackerMockConnection*) base;
680 #line 72 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
681 g_return_val_if_fail (sparql != NULL, NULL);
682 #line 75 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
683 _tmp0_ = self->priv->results;
684 #line 75 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
685 if (_tmp0_ != NULL) {
686 #line 687 "tracker-connection-mock.c"
687 TrackerMockResults* _tmp1_;
688 TrackerSparqlCursor* _tmp2_;
689 #line 76 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
690 _tmp1_ = self->priv->results;
691 #line 76 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
692 _tmp2_ = _g_object_ref0 ((TrackerSparqlCursor*) _tmp1_);
693 #line 76 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
694 result = _tmp2_;
695 #line 76 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
696 return result;
697 #line 698 "tracker-connection-mock.c"
698 } else {
699 TrackerMockResults* _tmp3_;
700 TrackerSparqlCursor* _tmp4_;
701 #line 78 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
702 _tmp3_ = self->priv->hardcoded;
703 #line 78 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
704 _tmp4_ = _g_object_ref0 ((TrackerSparqlCursor*) _tmp3_);
705 #line 78 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
706 result = _tmp4_;
707 #line 78 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
708 return result;
709 #line 710 "tracker-connection-mock.c"
710 }
711 }
712
713
714 static void tracker_mock_connection_real_query_async_data_free (gpointer _data) {
715 TrackerMockConnectionQueryAsyncData* _data_;
716 _data_ = _data;
717 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
718 _g_free0 (_data_->sparql);
719 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
720 _g_object_unref0 (_data_->cancellable);
721 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
722 _g_object_unref0 (_data_->result);
723 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
724 _g_object_unref0 (_data_->self);
725 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
726 g_slice_free (TrackerMockConnectionQueryAsyncData, _data_);
727 #line 728 "tracker-connection-mock.c"
728 }
729
730
731 static void tracker_mock_connection_real_query_async (TrackerSparqlConnection* base, const gchar* sparql, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
732 TrackerMockConnection * self;
733 TrackerMockConnectionQueryAsyncData* _data_;
734 TrackerMockConnection* _tmp0_;
735 const gchar* _tmp1_;
736 gchar* _tmp2_;
737 GCancellable* _tmp3_;
738 GCancellable* _tmp4_;
739 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
740 self = (TrackerMockConnection*) base;
741 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
742 _data_ = g_slice_new0 (TrackerMockConnectionQueryAsyncData);
743 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
744 _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, tracker_mock_connection_real_query_async);
745 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
746 g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_mock_connection_real_query_async_data_free);
747 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
748 _tmp0_ = _g_object_ref0 (self);
749 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
750 _data_->self = _tmp0_;
751 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
752 _tmp1_ = sparql;
753 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
754 _tmp2_ = g_strdup (_tmp1_);
755 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
756 _g_free0 (_data_->sparql);
757 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
758 _data_->sparql = _tmp2_;
759 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
760 _tmp3_ = cancellable;
761 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
762 _tmp4_ = _g_object_ref0 (_tmp3_);
763 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
764 _g_object_unref0 (_data_->cancellable);
765 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
766 _data_->cancellable = _tmp4_;
767 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
768 tracker_mock_connection_real_query_async_co (_data_);
769 #line 770 "tracker-connection-mock.c"
770 }
771
772
773 static TrackerSparqlCursor* tracker_mock_connection_real_query_finish (TrackerSparqlConnection* base, GAsyncResult* _res_, GError** error) {
774 TrackerSparqlCursor* result;
775 TrackerMockConnectionQueryAsyncData* _data_;
776 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
777 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
778 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
779 return NULL;
780 #line 781 "tracker-connection-mock.c"
781 }
782 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
783 _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
784 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
785 result = _data_->result;
786 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
787 _data_->result = NULL;
788 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
789 return result;
790 #line 791 "tracker-connection-mock.c"
791 }
792
793
794 static gboolean tracker_mock_connection_real_query_async_co (TrackerMockConnectionQueryAsyncData* _data_) {
795 #line 83 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
796 switch (_data_->_state_) {
797 #line 83 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
798 case 0:
799 #line 800 "tracker-connection-mock.c"
800 goto _state_0;
801 default:
802 #line 83 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
803 g_assert_not_reached ();
804 #line 805 "tracker-connection-mock.c"
805 }
806 _state_0:
807 #line 85 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
808 _data_->_tmp0_ = _data_->self->priv->results;
809 #line 85 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
810 if (_data_->_tmp0_ != NULL) {
811 #line 86 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
812 _data_->_tmp1_ = _data_->self->priv->results;
813 #line 86 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
814 _data_->_tmp2_ = _g_object_ref0 ((TrackerSparqlCursor*) _data_->_tmp1_);
815 #line 86 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
816 _data_->result = _data_->_tmp2_;
817 #line 86 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
818 if (_data_->_state_ == 0) {
819 #line 86 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
820 g_simple_async_result_complete_in_idle (_data_->_async_result);
821 #line 822 "tracker-connection-mock.c"
822 } else {
823 #line 86 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
824 g_simple_async_result_complete (_data_->_async_result);
825 #line 826 "tracker-connection-mock.c"
826 }
827 #line 86 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
828 g_object_unref (_data_->_async_result);
829 #line 86 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
830 return FALSE;
831 #line 832 "tracker-connection-mock.c"
832 } else {
833 #line 88 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
834 _data_->_tmp3_ = _data_->self->priv->hardcoded;
835 #line 88 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
836 _data_->_tmp4_ = _g_object_ref0 ((TrackerSparqlCursor*) _data_->_tmp3_);
837 #line 88 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
838 _data_->result = _data_->_tmp4_;
839 #line 88 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
840 if (_data_->_state_ == 0) {
841 #line 88 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
842 g_simple_async_result_complete_in_idle (_data_->_async_result);
843 #line 844 "tracker-connection-mock.c"
844 } else {
845 #line 88 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
846 g_simple_async_result_complete (_data_->_async_result);
847 #line 848 "tracker-connection-mock.c"
848 }
849 #line 88 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
850 g_object_unref (_data_->_async_result);
851 #line 88 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
852 return FALSE;
853 #line 854 "tracker-connection-mock.c"
854 }
855 #line 83 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
856 if (_data_->_state_ == 0) {
857 #line 83 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
858 g_simple_async_result_complete_in_idle (_data_->_async_result);
859 #line 860 "tracker-connection-mock.c"
860 } else {
861 #line 83 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
862 g_simple_async_result_complete (_data_->_async_result);
863 #line 864 "tracker-connection-mock.c"
864 }
865 #line 83 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
866 g_object_unref (_data_->_async_result);
867 #line 83 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
868 return FALSE;
869 #line 870 "tracker-connection-mock.c"
870 }
871
872
873 void tracker_mock_connection_set_results (TrackerMockConnection* self, TrackerMockResults* results) {
874 TrackerMockResults* _tmp0_;
875 TrackerMockResults* _tmp1_;
876 #line 93 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
877 g_return_if_fail (self != NULL);
878 #line 93 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
879 g_return_if_fail (results != NULL);
880 #line 94 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
881 _tmp0_ = results;
882 #line 94 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
883 _tmp1_ = _g_object_ref0 (_tmp0_);
884 #line 94 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
885 _g_object_unref0 (self->priv->results);
886 #line 94 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
887 self->priv->results = _tmp1_;
888 #line 889 "tracker-connection-mock.c"
889 }
890
891
892 TrackerMockConnection* tracker_mock_connection_construct (GType object_type) {
893 TrackerMockConnection * self = NULL;
894 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
895 self = (TrackerMockConnection*) tracker_sparql_connection_construct (object_type);
896 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
897 return self;
898 #line 899 "tracker-connection-mock.c"
899 }
900
901
902 TrackerMockConnection* tracker_mock_connection_new (void) {
903 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
904 return tracker_mock_connection_construct (TYPE_TRACKER_MOCK_CONNECTION);
905 #line 906 "tracker-connection-mock.c"
906 }
907
908
909 static void tracker_mock_connection_class_init (TrackerMockConnectionClass * klass) {
910 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
911 tracker_mock_connection_parent_class = g_type_class_peek_parent (klass);
912 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
913 g_type_class_add_private (klass, sizeof (TrackerMockConnectionPrivate));
914 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
915 TRACKER_SPARQL_CONNECTION_CLASS (klass)->query = tracker_mock_connection_real_query;
916 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
917 TRACKER_SPARQL_CONNECTION_CLASS (klass)->query_async = tracker_mock_connection_real_query_async;
918 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
919 TRACKER_SPARQL_CONNECTION_CLASS (klass)->query_finish = tracker_mock_connection_real_query_finish;
920 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
921 G_OBJECT_CLASS (klass)->finalize = tracker_mock_connection_finalize;
922 #line 923 "tracker-connection-mock.c"
923 }
924
925
926 static void tracker_mock_connection_instance_init (TrackerMockConnection * self) {
927 gchar* _tmp0_;
928 gchar* _tmp1_;
929 gchar* _tmp2_;
930 gchar* _tmp3_;
931 gchar** _tmp4_ = NULL;
932 gchar* _tmp5_;
933 gchar* _tmp6_;
934 gchar** _tmp7_ = NULL;
935 gchar** _tmp8_;
936 gint _tmp8__length1;
937 TrackerSparqlValueType* _tmp9_ = NULL;
938 TrackerSparqlValueType* _tmp10_;
939 gint _tmp10__length1;
variable '_tmp10__length1' set but not used
(emitted by gcc)
940 TrackerMockResults* _tmp11_;
941 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
942 self->priv = TRACKER_MOCK_CONNECTION_GET_PRIVATE (self);
943 #line 67 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
944 self->priv->results = NULL;
945 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
946 _tmp0_ = g_strdup ("11");
947 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
948 _tmp1_ = g_strdup ("12");
949 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
950 _tmp2_ = g_strdup ("21");
951 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
952 _tmp3_ = g_strdup ("22");
953 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
954 _tmp4_ = g_new0 (gchar*, (2 * 2) + 1);
955 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
956 _tmp4_[0] = _tmp0_;
957 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
958 _tmp4_[1] = _tmp1_;
959 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
960 _tmp4_[2] = _tmp2_;
961 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
962 _tmp4_[3] = _tmp3_;
963 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
964 _tmp5_ = g_strdup ("artist");
965 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
966 _tmp6_ = g_strdup ("album");
967 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
968 _tmp7_ = g_new0 (gchar*, 2 + 1);
969 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
970 _tmp7_[0] = _tmp5_;
971 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
972 _tmp7_[1] = _tmp6_;
973 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
974 _tmp8_ = _tmp7_;
975 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
976 _tmp8__length1 = 2;
977 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
978 _tmp9_ = g_new0 (TrackerSparqlValueType, 2);
979 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
980 _tmp9_[0] = TRACKER_SPARQL_VALUE_TYPE_STRING;
981 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
982 _tmp9_[1] = TRACKER_SPARQL_VALUE_TYPE_STRING;
983 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
984 _tmp10_ = _tmp9_;
985 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
986 _tmp10__length1 = 2;
987 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
988 _tmp11_ = tracker_mock_results_new (_tmp4_, 2, 2, 2, 2, _tmp8_, 2, _tmp10_, 2);
989 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
990 self->priv->hardcoded = _tmp11_;
991 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
992 _tmp10_ = (g_free (_tmp10_), NULL);
993 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
994 _tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL);
995 #line 996 "tracker-connection-mock.c"
996 }
997
998
999 static void tracker_mock_connection_finalize (GObject* obj) {
1000 TrackerMockConnection * self;
1001 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
1002 self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TRACKER_MOCK_CONNECTION, TrackerMockConnection);
1003 #line 67 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
1004 _g_object_unref0 (self->priv->results);
1005 #line 68 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
1006 _g_object_unref0 (self->priv->hardcoded);
1007 #line 65 "/home/martyn/Source/tracker/tests/libtracker-miner/tracker-connection-mock.vala"
1008 G_OBJECT_CLASS (tracker_mock_connection_parent_class)->finalize (obj);
1009 #line 1010 "tracker-connection-mock.c"
1010 }
1011
1012
1013 GType tracker_mock_connection_get_type (void) {
1014 static volatile gsize tracker_mock_connection_type_id__volatile = 0;
1015 if (g_once_init_enter (&tracker_mock_connection_type_id__volatile)) {
1016 static const GTypeInfo g_define_type_info = { sizeof (TrackerMockConnectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_mock_connection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerMockConnection), 0, (GInstanceInitFunc) tracker_mock_connection_instance_init, NULL };
1017 GType tracker_mock_connection_type_id;
1018 tracker_mock_connection_type_id = g_type_register_static (TRACKER_SPARQL_TYPE_CONNECTION, "TrackerMockConnection", &g_define_type_info, 0);
1019 g_once_init_leave (&tracker_mock_connection_type_id__volatile, tracker_mock_connection_type_id);
1020 }
1021 return tracker_mock_connection_type_id__volatile;
1022 }
1023
1024
1025 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
1026 if ((array != NULL) && (destroy_func != NULL)) {
1027 int i;
1028 for (i = 0; i < array_length; i = i + 1) {
1029 if (((gpointer*) array)[i] != NULL) {
1030 destroy_func (((gpointer*) array)[i]);
1031 }
1032 }
1033 }
1034 }
1035
1036
1037 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
1038 _vala_array_destroy (array, array_length, destroy_func);
1039 g_free (array);
1040 }