This file is indexed.

/usr/share/gtk-doc/html/geocode-glib/geocode-glib-geocode-mock-backend.html is in libgeocode-glib-doc 3.25.4.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>geocode-mock-backend: geocode-glib Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="geocode-glib Reference Manual">
<link rel="up" href="ch01.html" title="Geocode-glib">
<link rel="prev" href="GeocodeLocation.html" title="GeocodeLocation">
<link rel="next" href="GeocodeNominatim.html" title="GeocodeNominatim">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#geocode-glib-geocode-mock-backend.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#geocode-glib-geocode-mock-backend.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
                  <a href="#geocode-glib-geocode-mock-backend.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GeocodeLocation.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GeocodeNominatim.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="geocode-glib-geocode-mock-backend"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="geocode-glib-geocode-mock-backend.top_of_page"></a>geocode-mock-backend</span></h2>
<p>geocode-mock-backend — Geocode mock backend implementation</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="geocode-glib-geocode-mock-backend.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="returnvalue">GeocodeMockBackend</span></a> *
</td>
<td class="function_name">
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-new" title="geocode_mock_backend_new ()">geocode_mock_backend_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-add-forward-result" title="geocode_mock_backend_add_forward_result ()">geocode_mock_backend_add_forward_result</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-add-reverse-result" title="geocode_mock_backend_add_reverse_result ()">geocode_mock_backend_add_reverse_result</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-clear" title="geocode_mock_backend_clear ()">geocode_mock_backend_clear</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GPtrArray</span> *
</td>
<td class="function_name">
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-get-query-log" title="geocode_mock_backend_get_query_log ()">geocode_mock_backend_get_query_log</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<a name="GeocodeMockBackend"></a><div class="refsect1">
<a name="geocode-glib-geocode-mock-backend.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="geocode-glib-geocode-mock-backend.html#GEOCODE-TYPE-MOCK-BACKEND:CAPS" title="GEOCODE_TYPE_MOCK_BACKEND">GEOCODE_TYPE_MOCK_BACKEND</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackendQuery" title="GeocodeMockBackendQuery">GeocodeMockBackendQuery</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend-struct" title="GeocodeMockBackend">GeocodeMockBackend</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="geocode-glib-geocode-mock-backend.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    GObject
    <span class="lineart">╰──</span> GeocodeMockBackend
</pre>
</div>
<div class="refsect1">
<a name="geocode-glib-geocode-mock-backend.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GeocodeMockBackend implements
 <a class="link" href="GeocodeBackend.html" title="GeocodeBackend">GeocodeBackend</a>.</p>
</div>
<div class="refsect1">
<a name="geocode-glib-geocode-mock-backend.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;geocode-glib/geocode-glib.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="geocode-glib-geocode-mock-backend.description"></a><h2>Description</h2>
<p><a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a> is intended to be used in unit tests for applications
which use geocode-glib — it allows them to set the geocode results they
expect their application to query, and check afterwards that the queries
were performed. It works offline, which allows application unit tests to be
run on integration and build machines which are not online. It is not
expected that <a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a> will be used in production code.</p>
<p>To use it, create the backend instance, add the query results to it which
you want to be returned to your application’s queries, then use it as the
<a class="link" href="GeocodeBackend.html" title="GeocodeBackend"><span class="type">GeocodeBackend</span></a> for <a class="link" href="GeocodeForward.html#geocode-forward-set-backend" title="geocode_forward_set_backend ()"><code class="function">geocode_forward_set_backend()</code></a> or
<a class="link" href="GeocodeReverse.html#geocode-reverse-set-backend" title="geocode_reverse_set_backend ()"><code class="function">geocode_reverse_set_backend()</code></a>. After a test has been run, the set of queries
which the code under test actually made on the backend can be checked using
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-get-query-log" title="geocode_mock_backend_get_query_log ()"><code class="function">geocode_mock_backend_get_query_log()</code></a>. The backend can be reset using
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-clear" title="geocode_mock_backend_clear ()"><code class="function">geocode_mock_backend_clear()</code></a> and new queries added for the next test.</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static void</span>
<span class="function">place_list_free</span> <span class="gtkdoc opt">(</span>GList <span class="gtkdoc opt">*</span>l<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  <span class="function">g_list_free_full</span> <span class="gtkdoc opt">(</span>l<span class="gtkdoc opt">,</span> g_object_unref<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span>

<span class="gtkdoc kwc">typedef</span> GList PlaceList<span class="gtkdoc opt">;</span>
<span class="function">G_DEFINE_AUTOPTR_CLEANUP_FUNC</span> <span class="gtkdoc opt">(</span>PlaceList<span class="gtkdoc opt">,</span> place_list_free<span class="gtkdoc opt">)</span>

<span class="function">g_autoptr</span> <span class="gtkdoc opt">(</span>GeocodeForward<span class="gtkdoc opt">)</span> forward <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
<span class="function">g_autoptr</span> <span class="gtkdoc opt">(</span>GeocodeMockBackend<span class="gtkdoc opt">)</span> backend <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
<span class="function">g_autoptr</span> <span class="gtkdoc opt">(</span>GHashTable<span class="gtkdoc opt">)</span> params <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
GValue location <span class="gtkdoc opt">=</span> G_VALUE_INIT<span class="gtkdoc opt">;</span>
<span class="function">g_autoptr</span> <span class="gtkdoc opt">(</span>PlaceList<span class="gtkdoc opt">)</span> results <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
<span class="function">g_autoptr</span> <span class="gtkdoc opt">(</span>PlaceList<span class="gtkdoc opt">)</span> expected_results <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
<span class="function">g_autoptr</span> <span class="gtkdoc opt">(</span>GError<span class="gtkdoc opt">)</span> error <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
<span class="function">g_autoptr</span> <span class="gtkdoc opt">(</span>GeocodePlace<span class="gtkdoc opt">)</span> expected_place <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
<span class="function">g_autoptr</span> <span class="gtkdoc opt">(</span>GeocodeLocation<span class="gtkdoc opt">)</span> expected_location <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
GPtrArray <span class="gtkdoc opt">*</span>query_log<span class="gtkdoc opt">;  /&lt;!-- --&gt;* (</span>element<span class="gtkdoc opt">-</span>type GeocodeMockBackendQuery<span class="gtkdoc opt">) *&lt;!-- --&gt;/</span>

backend <span class="gtkdoc opt">=</span> <span class="function"><a href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-new">geocode_mock_backend_new</a></span> <span class="gtkdoc opt">();</span>

<span class="gtkdoc opt">/&lt;!-- --&gt;*</span> Build the set of parameters the mock backend expects to receive from
 <span class="gtkdoc opt">*</span> the <span class="gtkdoc ppc">#GeocodeForward instance. *&lt;!-- --&gt;/</span>
params <span class="gtkdoc opt">=</span> <span class="function">g_hash_table_new_full</span> <span class="gtkdoc opt">(</span>g_str_hash<span class="gtkdoc opt">,</span> g_str_equal<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>

<span class="function">g_value_init</span> <span class="gtkdoc opt">(&amp;</span>location<span class="gtkdoc opt">,</span> G_TYPE_STRING<span class="gtkdoc opt">);</span>
<span class="function">g_value_set_static_string</span> <span class="gtkdoc opt">(&amp;</span>location<span class="gtkdoc opt">,</span> <span class="string">&quot;Bullpot Farm&quot;</span><span class="gtkdoc opt">);</span>
<span class="function">g_hash_table_insert</span> <span class="gtkdoc opt">(</span>params<span class="gtkdoc opt">, (</span>gpointer<span class="gtkdoc opt">)</span> <span class="string">&quot;location&quot;</span><span class="gtkdoc opt">, &amp;</span>location<span class="gtkdoc opt">);</span>

<span class="gtkdoc opt">/&lt;!-- --&gt;*</span> Build the set of results the mock backend should <span class="keyword">return</span><span class="gtkdoc opt">. *&lt;!-- --&gt;/</span>
expected_location <span class="gtkdoc opt">=</span> <span class="function"><a href="GeocodeLocation.html#geocode-location-new-with-description">geocode_location_new_with_description</a></span> <span class="gtkdoc opt">(</span>
    <span class="number">54.22759825</span><span class="gtkdoc opt">, -</span><span class="number">2.51857179181113</span><span class="gtkdoc opt">,</span> <span class="number">5.0</span><span class="gtkdoc opt">,</span>
    <span class="string">&quot;Bullpot Farm, Fell Road, South Lakeland, Cumbria, &quot;</span>
    <span class="string">&quot;North West England, England, United Kingdom&quot;</span><span class="gtkdoc opt">);</span>
expected_place <span class="gtkdoc opt">=</span> <span class="function"><a href="GeocodePlace.html#geocode-place-new-with-location">geocode_place_new_with_location</a></span> <span class="gtkdoc opt">(</span>
    <span class="string">&quot;Bullpot Farm&quot;</span><span class="gtkdoc opt">,</span> GEOCODE_PLACE_TYPE_BUILDING<span class="gtkdoc opt">,</span> expected_location<span class="gtkdoc opt">);</span>
expected_results <span class="gtkdoc opt">=</span> <span class="function">g_list_prepend</span> <span class="gtkdoc opt">(</span>expected_results<span class="gtkdoc opt">,</span>
                                   <span class="function">g_steal_pointer</span> <span class="gtkdoc opt">(&amp;</span>expected_place<span class="gtkdoc opt">));</span>

<span class="function"><a href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-add-forward-result">geocode_mock_backend_add_forward_result</a></span> <span class="gtkdoc opt">(</span>backend<span class="gtkdoc opt">,</span> params<span class="gtkdoc opt">,</span>
                                         expected_results<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>

<span class="gtkdoc opt">/&lt;!-- --&gt;*</span> Do the search<span class="gtkdoc opt">.</span> This would typically call the application code
 <span class="gtkdoc opt">*</span> under test<span class="gtkdoc opt">,</span> rather than geocode<span class="gtkdoc opt">-</span>glib directly<span class="gtkdoc opt">. *&lt;!-- --&gt;/</span>
forward <span class="gtkdoc opt">=</span> <span class="function"><a href="GeocodeForward.html#geocode-forward-new-for-string">geocode_forward_new_for_string</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Bullpot Farm&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="GeocodeForward.html#geocode-forward-set-backend">geocode_forward_set_backend</a></span> <span class="gtkdoc opt">(</span>forward<span class="gtkdoc opt">,</span> <span class="function">GEOCODE_BACKEND</span> <span class="gtkdoc opt">(</span>backend<span class="gtkdoc opt">));</span>
results <span class="gtkdoc opt">=</span> <span class="function"><a href="GeocodeForward.html#geocode-forward-search">geocode_forward_search</a></span> <span class="gtkdoc opt">(</span>forward<span class="gtkdoc opt">, &amp;</span>error<span class="gtkdoc opt">);</span>

<span class="function">g_assert_no_error</span> <span class="gtkdoc opt">(</span>error<span class="gtkdoc opt">);</span>
<span class="function">assert_place_list_equal</span> <span class="gtkdoc opt">(</span>results<span class="gtkdoc opt">,</span> expected_results<span class="gtkdoc opt">);</span>

<span class="gtkdoc opt">/&lt;!-- --&gt;*</span> Check the application made the expected query<span class="gtkdoc opt">. *&lt;!-- --&gt;/</span>
query_log <span class="gtkdoc opt">=</span> <span class="function"><a href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-get-query-log">geocode_mock_backend_get_query_log</a></span> <span class="gtkdoc opt">(</span>backend<span class="gtkdoc opt">);</span>
<span class="function">g_assert_cmpuint</span> <span class="gtkdoc opt">(</span>query_log<span class="gtkdoc opt">-&gt;</span>len<span class="gtkdoc opt">, ==,</span> <span class="number">1</span><span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
</div>
<div class="refsect1">
<a name="geocode-glib-geocode-mock-backend.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="geocode-mock-backend-new"></a><h3>geocode_mock_backend_new ()</h3>
<pre class="programlisting"><a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="returnvalue">GeocodeMockBackend</span></a> *
geocode_mock_backend_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new mock backend implementation with no initial forward or reverse
query results (so it will return an empty result set for all queries).</p>
<div class="refsect3">
<a name="geocode-mock-backend-new.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-full.html#api-index-3.23.1">3.23.1</a></p>
</div>
<hr>
<div class="refsect2">
<a name="geocode-mock-backend-add-forward-result"></a><h3>geocode_mock_backend_add_forward_result ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
geocode_mock_backend_add_forward_result
                               (<em class="parameter"><code><a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a> *self</code></em>,
                                <em class="parameter"><code><span class="type">GHashTable</span> *params</code></em>,
                                <em class="parameter"><code><span class="type">GList</span> *results</code></em>,
                                <em class="parameter"><code>const <span class="type">GError</span> *error</code></em>);</pre>
<p>Add a query and corresponding result (or error) to the mock backend, meaning
that if it receives a forward search for <em class="parameter"><code>params</code></em>
 through
<a class="link" href="GeocodeBackend.html#geocode-backend-forward-search" title="geocode_backend_forward_search ()"><code class="function">geocode_backend_forward_search()</code></a> (or its asynchronous variants), the mock
backend will return the given <em class="parameter"><code>results</code></em>
 or <em class="parameter"><code>error</code></em>
 to the caller.</p>
<p>If a set of <em class="parameter"><code>params</code></em>
 is added to the backend multiple times, the most
recently provided <em class="parameter"><code>results</code></em>
 and <em class="parameter"><code>error</code></em>
 will be used.</p>
<p>Exactly one of <em class="parameter"><code>results</code></em>
 and <em class="parameter"><code>error</code></em>
 must be set. Empty result sets are
represented as a <a class="link" href="geocode-glib-geocode-error.html#GEOCODE-ERROR-NO-MATCHES:CAPS"><code class="literal">GEOCODE_ERROR_NO_MATCHES</code></a> error.</p>
<div class="refsect3">
<a name="geocode-mock-backend-add-forward-result.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>params</p></td>
<td class="parameter_description"><p> query parameters to
respond to, in the same format as accepted by <a class="link" href="GeocodeForward.html#geocode-forward-search" title="geocode_forward_search ()"><code class="function">geocode_forward_search()</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 GValue]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>results</p></td>
<td class="parameter_description"><p> result set
to return for the query, or <code class="literal">NULL</code> if <em class="parameter"><code>error</code></em>
is non-<code class="literal">NULL</code>; result sets
must be in the same format as returned by <a class="link" href="GeocodeForward.html#geocode-forward-search" title="geocode_forward_search ()"><code class="function">geocode_forward_search()</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GeocodePlace]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> error to return for the query, or <code class="literal">NULL</code> if <em class="parameter"><code>results</code></em>
should be returned instead; errors must match those returned by
<a class="link" href="GeocodeForward.html#geocode-forward-search" title="geocode_forward_search ()"><code class="function">geocode_forward_search()</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-full.html#api-index-3.23.1">3.23.1</a></p>
</div>
<hr>
<div class="refsect2">
<a name="geocode-mock-backend-add-reverse-result"></a><h3>geocode_mock_backend_add_reverse_result ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
geocode_mock_backend_add_reverse_result
                               (<em class="parameter"><code><a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a> *self</code></em>,
                                <em class="parameter"><code><span class="type">GHashTable</span> *params</code></em>,
                                <em class="parameter"><code><span class="type">GList</span> *results</code></em>,
                                <em class="parameter"><code>const <span class="type">GError</span> *error</code></em>);</pre>
<p>Add a query and corresponding result (or error) to the mock backend, meaning
that if it receives a reverse search for <em class="parameter"><code>params</code></em>
 through
<a class="link" href="GeocodeBackend.html#geocode-backend-reverse-resolve" title="geocode_backend_reverse_resolve ()"><code class="function">geocode_backend_reverse_resolve()</code></a> (or its asynchronous variants), the mock
backend will return the given <em class="parameter"><code>results</code></em>
 or <em class="parameter"><code>error</code></em>
 to the caller.</p>
<p>If a set of <em class="parameter"><code>params</code></em>
 is added to the backend multiple times, the most
recently provided <em class="parameter"><code>results</code></em>
 and <em class="parameter"><code>error</code></em>
 will be used.</p>
<p>Exactly one of <em class="parameter"><code>results</code></em>
 and <em class="parameter"><code>error</code></em>
 must be set. Empty result sets are
represented as a <a class="link" href="geocode-glib-geocode-error.html#GEOCODE-ERROR-NOT-SUPPORTED:CAPS"><code class="literal">GEOCODE_ERROR_NOT_SUPPORTED</code></a> error.</p>
<div class="refsect3">
<a name="geocode-mock-backend-add-reverse-result.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>params</p></td>
<td class="parameter_description"><p> query parameters to
respond to, in the same format as accepted by <a class="link" href="GeocodeReverse.html#geocode-reverse-resolve" title="geocode_reverse_resolve ()"><code class="function">geocode_reverse_resolve()</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 GValue]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>results</p></td>
<td class="parameter_description"><p> result set
to return for the query, or <code class="literal">NULL</code> if <em class="parameter"><code>error</code></em>
is non-<code class="literal">NULL</code>; result sets
must be in the same format as returned by <a class="link" href="GeocodeReverse.html#geocode-reverse-resolve" title="geocode_reverse_resolve ()"><code class="function">geocode_reverse_resolve()</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GeocodePlace]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> error to return for the query, or <code class="literal">NULL</code> if <em class="parameter"><code>results</code></em>
should be returned instead; errors must match those returned by
<a class="link" href="GeocodeReverse.html#geocode-reverse-resolve" title="geocode_reverse_resolve ()"><code class="function">geocode_reverse_resolve()</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-full.html#api-index-3.23.1">3.23.1</a></p>
</div>
<hr>
<div class="refsect2">
<a name="geocode-mock-backend-clear"></a><h3>geocode_mock_backend_clear ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
geocode_mock_backend_clear (<em class="parameter"><code><a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a> *self</code></em>);</pre>
<p>Clear the set of stored results in the mock backend which have been added
using <a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-add-forward-result" title="geocode_mock_backend_add_forward_result ()"><code class="function">geocode_mock_backend_add_forward_result()</code></a> and
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-add-reverse-result" title="geocode_mock_backend_add_reverse_result ()"><code class="function">geocode_mock_backend_add_reverse_result()</code></a>. Additionally, clear the query log
so far (see <a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-get-query-log" title="geocode_mock_backend_get_query_log ()"><code class="function">geocode_mock_backend_get_query_log()</code></a>).</p>
<p>This effectively resets the mock backend to its initial state.</p>
<div class="refsect3">
<a name="geocode-mock-backend-clear.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-full.html#api-index-3.23.1">3.23.1</a></p>
</div>
<hr>
<div class="refsect2">
<a name="geocode-mock-backend-get-query-log"></a><h3>geocode_mock_backend_get_query_log ()</h3>
<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
geocode_mock_backend_get_query_log (<em class="parameter"><code><a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a> *self</code></em>);</pre>
<p>Get the details of the forward and reverse queries which have been requested
of the mock backend since the most recent call to
<a class="link" href="geocode-glib-geocode-mock-backend.html#geocode-mock-backend-clear" title="geocode_mock_backend_clear ()"><code class="function">geocode_mock_backend_clear()</code></a>. The query details are provided as
<a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackendQuery" title="GeocodeMockBackendQuery"><span class="type">GeocodeMockBackendQuery</span></a> structures, which map the query parameters to
either the result set or the error which <a class="link" href="GeocodeBackend.html#geocode-backend-forward-search" title="geocode_backend_forward_search ()"><code class="function">geocode_backend_forward_search()</code></a>
or <a class="link" href="GeocodeBackend.html#geocode-backend-reverse-resolve" title="geocode_backend_reverse_resolve ()"><code class="function">geocode_backend_reverse_resolve()</code></a> (or their asynchronous variants)
returned to the caller.</p>
<p>The results are provided in the order in which calls were made to
<a class="link" href="GeocodeBackend.html#geocode-backend-forward-search" title="geocode_backend_forward_search ()"><code class="function">geocode_backend_forward_search()</code></a> and <a class="link" href="GeocodeBackend.html#geocode-backend-reverse-resolve" title="geocode_backend_reverse_resolve ()"><code class="function">geocode_backend_reverse_resolve()</code></a>.
Results for forward and reverse queries may be interleaved.</p>
<div class="refsect3">
<a name="geocode-mock-backend-get-query-log.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="geocode-mock-backend-get-query-log.returns"></a><h4>Returns</h4>
<p> potentially
empty sequence of forward and reverse query details. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GeocodeMockBackendQuery]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-full.html#api-index-3.23.1">3.23.1</a></p>
</div>
</div>
<div class="refsect1">
<a name="geocode-glib-geocode-mock-backend.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GEOCODE-TYPE-MOCK-BACKEND:CAPS"></a><h3>GEOCODE_TYPE_MOCK_BACKEND</h3>
<pre class="programlisting">#define GEOCODE_TYPE_MOCK_BACKEND (geocode_mock_backend_get_type ())
</pre>
<p>See <a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a>.</p>
<p class="since">Since: <a class="link" href="api-index-full.html#api-index-3.23.1">3.23.1</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GeocodeMockBackendQuery"></a><h3>GeocodeMockBackendQuery</h3>
<pre class="programlisting">typedef struct {
	/* Request */
	GHashTable *params;
	gboolean is_forward;

	/* Response */
	GList *results;
	GError *error;
} GeocodeMockBackendQuery;
</pre>
<p>The details of a forward or reverse query which was performed on a
<a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a> by application code. This includes the input (<em class="parameter"><code>params</code></em>
,
<em class="parameter"><code>is_forward</code></em>
), and the output which was returned (<em class="parameter"><code>results</code></em>
 or <em class="parameter"><code>error</code></em>
).</p>
<p>Empty result sets are represented by the <a class="link" href="geocode-glib-geocode-error.html#GEOCODE-ERROR-NO-MATCHES:CAPS"><code class="literal">GEOCODE_ERROR_NO_MATCHES</code></a> error
(for forward queries) or the <a class="link" href="geocode-glib-geocode-error.html#GEOCODE-ERROR-NOT-SUPPORTED:CAPS"><code class="literal">GEOCODE_ERROR_NOT_SUPPORTED</code></a> error (for reverse
queries), rather than an empty <em class="parameter"><code>results</code></em>
 list.</p>
<div class="refsect3">
<a name="GeocodeMockBackendQuery.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><span class="type">GHashTable</span> *<em class="structfield"><code><a name="GeocodeMockBackendQuery.params"></a>params</code></em>;</p></td>
<td class="struct_member_description"><p>query parameters, in the format accepted by <a class="link" href="GeocodeForward.html#geocode-forward-search" title="geocode_forward_search ()"><code class="function">geocode_forward_search()</code></a>
(if <em class="parameter"><code>is_forward</code></em>
is <code class="literal">TRUE</code>) or <a class="link" href="GeocodeReverse.html#geocode-reverse-resolve" title="geocode_reverse_resolve ()"><code class="function">geocode_reverse_resolve()</code></a> (otherwise)</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><span class="type">gboolean</span> <em class="structfield"><code><a name="GeocodeMockBackendQuery.is-forward"></a>is_forward</code></em>;</p></td>
<td class="struct_member_description"><p><code class="literal">TRUE</code> if this represents a call to <a class="link" href="GeocodeForward.html#geocode-forward-search" title="geocode_forward_search ()"><code class="function">geocode_forward_search()</code></a>;
<code class="literal">FALSE</code> if it represents a call to <a class="link" href="GeocodeReverse.html#geocode-reverse-resolve" title="geocode_reverse_resolve ()"><code class="function">geocode_reverse_resolve()</code></a></p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><span class="type">GList</span> *<em class="structfield"><code><a name="GeocodeMockBackendQuery.results"></a>results</code></em>;</p></td>
<td class="struct_member_description"><p> results returned by the
query, or <code class="literal">NULL</code> if an error was returned. </p></td>
<td class="struct_member_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GeocodePlace]</span></td>
</tr>
<tr>
<td class="struct_member_name"><p><span class="type">GError</span> *<em class="structfield"><code><a name="GeocodeMockBackendQuery.error"></a>error</code></em>;</p></td>
<td class="struct_member_description"><p> error returned by the query, or <code class="literal">NULL</code> if a result set
was returned. </p></td>
<td class="struct_member_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-full.html#api-index-3.23.1">3.23.1</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GeocodeMockBackend-struct"></a><h3>GeocodeMockBackend</h3>
<pre class="programlisting">typedef struct _GeocodeMockBackend GeocodeMockBackend;</pre>
<p>All the fields in the <a class="link" href="geocode-glib-geocode-mock-backend.html#GeocodeMockBackend"><span class="type">GeocodeMockBackend</span></a> structure are private and should
never be accessed directly.</p>
<p class="since">Since: <a class="link" href="api-index-full.html#api-index-3.23.1">3.23.1</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>