1 
2 //          Copyright Ahmet Sait Koçak 2020.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          https://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.hb.bind.set;
8 
9 import bindbc.hb.config;
10 
11 import bindbc.hb.bind.common;
12 
13 extern(C) @nogc nothrow:
14 
15 /*
16  * Since: 0.9.21
17  */
18 enum HB_SET_VALUE_INVALID = cast(hb_codepoint_t) -1;
19 
20 struct hb_set_t;
21 
22 version(BindHB_Static)
23     hb_set_t* hb_set_create ();
24 else
25 {
26     private alias fp_hb_set_create = hb_set_t* function ();
27     __gshared fp_hb_set_create hb_set_create;
28 }
29 
30 version(BindHB_Static)
31     hb_set_t* hb_set_get_empty ();
32 else
33 {
34     private alias fp_hb_set_get_empty = hb_set_t* function ();
35     __gshared fp_hb_set_get_empty hb_set_get_empty;
36 }
37 
38 version(BindHB_Static)
39     hb_set_t* hb_set_reference (hb_set_t* set);
40 else
41 {
42     private alias fp_hb_set_reference = hb_set_t* function (hb_set_t* set);
43     __gshared fp_hb_set_reference hb_set_reference;
44 }
45 
46 version(BindHB_Static)
47     void hb_set_destroy (hb_set_t* set);
48 else
49 {
50     private alias fp_hb_set_destroy = void function (hb_set_t* set);
51     __gshared fp_hb_set_destroy hb_set_destroy;
52 }
53 
54 version(BindHB_Static)
55     hb_bool_t hb_set_set_user_data (
56         hb_set_t* set,
57         hb_user_data_key_t* key,
58         void* data,
59         hb_destroy_func_t destroy,
60         hb_bool_t replace);
61 else
62 {
63     private alias fp_hb_set_set_user_data = hb_bool_t function (
64         hb_set_t* set,
65         hb_user_data_key_t* key,
66         void* data,
67         hb_destroy_func_t destroy,
68         hb_bool_t replace);
69     __gshared fp_hb_set_set_user_data hb_set_set_user_data;
70 }
71 
72 version(BindHB_Static)
73     void* hb_set_get_user_data (hb_set_t* set, hb_user_data_key_t* key);
74 else
75 {
76     private alias fp_hb_set_get_user_data = void* function (hb_set_t* set, hb_user_data_key_t* key);
77     __gshared fp_hb_set_get_user_data hb_set_get_user_data;
78 }
79 
80 /* Returns false if allocation has failed before */
81 version(BindHB_Static)
82     hb_bool_t hb_set_allocation_successful (const(hb_set_t)* set);
83 else
84 {
85     private alias fp_hb_set_allocation_successful = hb_bool_t function (const(hb_set_t)* set);
86     __gshared fp_hb_set_allocation_successful hb_set_allocation_successful;
87 }
88 
89 version(BindHB_Static)
90     void hb_set_clear (hb_set_t* set);
91 else
92 {
93     private alias fp_hb_set_clear = void function (hb_set_t* set);
94     __gshared fp_hb_set_clear hb_set_clear;
95 }
96 
97 version(BindHB_Static)
98     hb_bool_t hb_set_is_empty (const(hb_set_t)* set);
99 else
100 {
101     private alias fp_hb_set_is_empty = hb_bool_t function (const(hb_set_t)* set);
102     __gshared fp_hb_set_is_empty hb_set_is_empty;
103 }
104 
105 version(BindHB_Static)
106     hb_bool_t hb_set_has (const(hb_set_t)* set, hb_codepoint_t codepoint);
107 else
108 {
109     private alias fp_hb_set_has = hb_bool_t function (const(hb_set_t)* set, hb_codepoint_t codepoint);
110     __gshared fp_hb_set_has hb_set_has;
111 }
112 
113 version(BindHB_Static)
114     void hb_set_add (hb_set_t* set, hb_codepoint_t codepoint);
115 else
116 {
117     private alias fp_hb_set_add = void function (hb_set_t* set, hb_codepoint_t codepoint);
118     __gshared fp_hb_set_add hb_set_add;
119 }
120 
121 version(BindHB_Static)
122     void hb_set_add_range (
123         hb_set_t* set,
124         hb_codepoint_t first,
125         hb_codepoint_t last);
126 else
127 {
128     private alias fp_hb_set_add_range = void function (
129         hb_set_t* set,
130         hb_codepoint_t first,
131         hb_codepoint_t last);
132     __gshared fp_hb_set_add_range hb_set_add_range;
133 }
134 
135 version(BindHB_Static)
136     void hb_set_del (hb_set_t* set, hb_codepoint_t codepoint);
137 else
138 {
139     private alias fp_hb_set_del = void function (hb_set_t* set, hb_codepoint_t codepoint);
140     __gshared fp_hb_set_del hb_set_del;
141 }
142 
143 version(BindHB_Static)
144     void hb_set_del_range (
145         hb_set_t* set,
146         hb_codepoint_t first,
147         hb_codepoint_t last);
148 else
149 {
150     private alias fp_hb_set_del_range = void function (
151         hb_set_t* set,
152         hb_codepoint_t first,
153         hb_codepoint_t last);
154     __gshared fp_hb_set_del_range hb_set_del_range;
155 }
156 
157 version(BindHB_Static)
158     hb_bool_t hb_set_is_equal (const(hb_set_t)* set, const(hb_set_t)* other);
159 else
160 {
161     private alias fp_hb_set_is_equal = hb_bool_t function (const(hb_set_t)* set, const(hb_set_t)* other);
162     __gshared fp_hb_set_is_equal hb_set_is_equal;
163 }
164 
165 static if (hbSupport >= HBSupport.v2_6_3)
166 {
167 	version(BindHB_Static)
168 		hb_bool_t hb_set_is_subset (const(hb_set_t)* set, const(hb_set_t)* larger_set);
169 	else
170 	{
171 		private alias fp_hb_set_is_subset = hb_bool_t function (const(hb_set_t)* set, const(hb_set_t)* larger_set);
172 		__gshared fp_hb_set_is_subset hb_set_is_subset;
173 	}
174 }
175 
176 version(BindHB_Static)
177     void hb_set_set (hb_set_t* set, const(hb_set_t)* other);
178 else
179 {
180     private alias fp_hb_set_set = void function (hb_set_t* set, const(hb_set_t)* other);
181     __gshared fp_hb_set_set hb_set_set;
182 }
183 
184 version(BindHB_Static)
185     void hb_set_union (hb_set_t* set, const(hb_set_t)* other);
186 else
187 {
188     private alias fp_hb_set_union = void function (hb_set_t* set, const(hb_set_t)* other);
189     __gshared fp_hb_set_union hb_set_union;
190 }
191 
192 version(BindHB_Static)
193     void hb_set_intersect (hb_set_t* set, const(hb_set_t)* other);
194 else
195 {
196     private alias fp_hb_set_intersect = void function (hb_set_t* set, const(hb_set_t)* other);
197     __gshared fp_hb_set_intersect hb_set_intersect;
198 }
199 
200 version(BindHB_Static)
201     void hb_set_subtract (hb_set_t* set, const(hb_set_t)* other);
202 else
203 {
204     private alias fp_hb_set_subtract = void function (hb_set_t* set, const(hb_set_t)* other);
205     __gshared fp_hb_set_subtract hb_set_subtract;
206 }
207 
208 version(BindHB_Static)
209     void hb_set_symmetric_difference (hb_set_t* set, const(hb_set_t)* other);
210 else
211 {
212     private alias fp_hb_set_symmetric_difference = void function (hb_set_t* set, const(hb_set_t)* other);
213     __gshared fp_hb_set_symmetric_difference hb_set_symmetric_difference;
214 }
215 
216 version(BindHB_Static)
217     uint hb_set_get_population (const(hb_set_t)* set);
218 else
219 {
220     private alias fp_hb_set_get_population = uint function (const(hb_set_t)* set);
221     __gshared fp_hb_set_get_population hb_set_get_population;
222 }
223 
224 /* Returns HB_SET_VALUE_INVALID if set empty. */
225 version(BindHB_Static)
226     hb_codepoint_t hb_set_get_min (const(hb_set_t)* set);
227 else
228 {
229     private alias fp_hb_set_get_min = hb_codepoint_t function (const(hb_set_t)* set);
230     __gshared fp_hb_set_get_min hb_set_get_min;
231 }
232 
233 /* Returns HB_SET_VALUE_INVALID if set empty. */
234 version(BindHB_Static)
235     hb_codepoint_t hb_set_get_max (const(hb_set_t)* set);
236 else
237 {
238     private alias fp_hb_set_get_max = hb_codepoint_t function (const(hb_set_t)* set);
239     __gshared fp_hb_set_get_max hb_set_get_max;
240 }
241 
242 /* Pass HB_SET_VALUE_INVALID in to get started. */
243 version(BindHB_Static)
244     hb_bool_t hb_set_next (const(hb_set_t)* set, hb_codepoint_t* codepoint);
245 else
246 {
247     private alias fp_hb_set_next = hb_bool_t function (const(hb_set_t)* set, hb_codepoint_t* codepoint);
248     __gshared fp_hb_set_next hb_set_next;
249 }
250 
251 static if (hbSupport >= HBSupport.v2_6_3)
252 {
253 	/* Pass HB_SET_VALUE_INVALID in to get started. */
254 	version(BindHB_Static)
255 		hb_bool_t hb_set_previous (const(hb_set_t)* set, hb_codepoint_t* codepoint);
256 	else
257 	{
258 		private alias fp_hb_set_previous = hb_bool_t function (const(hb_set_t)* set, hb_codepoint_t* codepoint);
259 		__gshared fp_hb_set_previous hb_set_previous;
260 	}
261 }
262 
263 /* Pass HB_SET_VALUE_INVALID for first and last to get started. */
264 version(BindHB_Static)
265     hb_bool_t hb_set_next_range (
266         const(hb_set_t)* set,
267         hb_codepoint_t* first,
268         hb_codepoint_t* last);
269 else
270 {
271     private alias fp_hb_set_next_range = hb_bool_t function (
272         const(hb_set_t)* set,
273         hb_codepoint_t* first,
274         hb_codepoint_t* last);
275     __gshared fp_hb_set_next_range hb_set_next_range;
276 }
277 
278 static if (hbSupport >= HBSupport.v2_6_3)
279 {
280 	/* Pass HB_SET_VALUE_INVALID for first and last to get started. */
281 	version(BindHB_Static)
282 		hb_bool_t hb_set_previous_range (
283 			const(hb_set_t)* set,
284 			hb_codepoint_t* first,
285 			hb_codepoint_t* last);
286 	else
287 	{
288 		private alias fp_hb_set_previous_range = hb_bool_t function (
289 			const(hb_set_t)* set,
290 			hb_codepoint_t* first,
291 			hb_codepoint_t* last);
292 		__gshared fp_hb_set_previous_range hb_set_previous_range;
293 	}
294 }