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
//! The `gpkg_extensions` catalogue, and this library's support for each entry.
//!
//! Use the catalogue to check what a file registers before you work on it,
//! rather than finding out mid-write that a table is under an extension this
//! library cannot honour. That write would fail with `GPKG_STATUS_UNSUPPORTED`.
//! [`gpkg_extensions_count`] returns the number of rows, and
//! [`gpkg_extension_at`] reads one row, with the support level this library
//! claims for it.
//!
//! ```c
//! size_t count = 0;
//! if (gpkg_extensions_count(gpkg, &count, &error) != GPKG_STATUS_OK) {
//! return fail("gpkg_extensions_count", &error);
//! }
//! for (size_t i = 0; i < count; i++) {
//! char *name = NULL, *table = NULL, *support = NULL;
//! if (gpkg_extension_at(gpkg, i, &name, &table, NULL, NULL, &support,
//! &error) != GPKG_STATUS_OK) {
//! return fail("gpkg_extension_at", &error);
//! }
//! printf("%s on %s: %s\n", name, table ? table : "(whole file)", support);
//! gpkg_string_free(name);
//! gpkg_string_free(table);
//! gpkg_string_free(support);
//! }
//! ```
//!
//! The support level is one of `implemented`, `known, not read or written`,
//! `removed from the standard in 2016`, or `unrecognised`. If every row reports
//! `implemented`, the file contains nothing this library will reject. A row
//! reporting `unrecognised` names a table this library will not write unless
//! the file was opened with that protection turned off.
use c_char;
use crate;
use crateContainer;
use cratewrite_out_strings;
/// Writes the number of `gpkg_extensions` rows in the file through `out`.
///
/// A file with no `gpkg_extensions` table registers no extensions, and the
/// count is zero. `gpkg_extension_at` reads the same list, ordered by
/// extension name, then table, then column.
///
/// # Safety
///
/// `gpkg` must be a live container handle, `out` writable, `error` NULL or
/// writable.
pub unsafe extern "C"
/// Returns one `gpkg_extensions` row, with the support level this library
/// claims for it.
///
/// This reads the list that `gpkg_extensions_count` counts. Pass NULL for any
/// out-parameter to skip it. You own each string written, and free it with
/// `gpkg_string_free`.
///
/// `out_table` and `out_column` are NULL when the row applies to the whole
/// file or the whole table, matching what NULL means in those catalogue
/// columns.
/// `out_scope` is the row's declared scope, `read-write` or `write-only`.
/// `out_support` is this library's support level for the extension: one of
/// `implemented`, `known, not read or written`, `removed from the standard in
/// 2016`, or `unrecognised`.
///
/// An index at or beyond the count returns `GPKG_STATUS_NOT_FOUND`, not a read
/// error. On any failure, nothing is written.
///
/// # Safety
///
/// `gpkg` must be a live container handle; every out-parameter NULL or
/// writable; `error` NULL or writable.
pub unsafe extern "C"