blob: 068236264527cebc851d44c52e1dbd36fb1f2466 [file] [log] [blame]
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -04001/*
2 * Copyright © 2012 Google, Inc.
3 *
4 * This is part of HarfBuzz, a text shaping library.
5 *
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE.
17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 *
24 * Google Author(s): Behdad Esfahbod
25 */
26
Behdad Esfahbodc77ae402018-08-25 22:36:36 -070027#include "hb-set.hh"
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040028
29
Behdad Esfahbod524fb702018-10-27 04:27:36 -070030/**
31 * SECTION:hb-set
Behdad Esfahboda4f4f5b2018-10-28 08:23:36 -070032 * @title: hb-set
Behdad Esfahbod524fb702018-10-27 04:27:36 -070033 * @short_description: Object representing a set of integers
34 * @include: hb.h
35 *
36 * Set objects represent a mathematical set of integer values. They are
37 * used in non-shaping API to query certain set of characters or glyphs,
38 * or other integer values.
39 **/
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -040040
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040041
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040042/**
Behdad Esfahbod085d4292013-09-12 17:14:33 -040043 * hb_set_create: (Xconstructor)
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040044 *
45 * Return value: (transfer full):
46 *
Sascha Brawer01c3a882015-06-01 13:22:01 +020047 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040048 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040049hb_set_t *
Ebrahim Byagowie4120082018-12-17 21:31:01 +033050hb_set_create ()
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040051{
52 hb_set_t *set;
53
54 if (!(set = hb_object_create<hb_set_t> ()))
Behdad Esfahbodf06ab8a2012-06-05 12:31:51 -040055 return hb_set_get_empty ();
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040056
Behdad Esfahbodf1f6bc02018-05-02 12:56:21 -040057 set->init_shallow ();
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040058
59 return set;
60}
61
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040062/**
63 * hb_set_get_empty:
64 *
Behdad Esfahbod288f2892013-09-06 15:40:22 -040065 * Return value: (transfer full):
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040066 *
Sascha Brawer01c3a882015-06-01 13:22:01 +020067 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040068 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040069hb_set_t *
Ebrahim Byagowie4120082018-12-17 21:31:01 +033070hb_set_get_empty ()
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040071{
Behdad Esfahbod7b50bf52018-05-31 20:20:17 -070072 return const_cast<hb_set_t *> (&Null(hb_set_t));
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040073}
74
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040075/**
76 * hb_set_reference: (skip)
77 * @set: a set.
78 *
79 * Return value: (transfer full):
80 *
Sascha Brawer01c3a882015-06-01 13:22:01 +020081 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040082 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040083hb_set_t *
84hb_set_reference (hb_set_t *set)
85{
86 return hb_object_reference (set);
87}
88
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040089/**
90 * hb_set_destroy: (skip)
91 * @set: a set.
92 *
Sascha Brawer01c3a882015-06-01 13:22:01 +020093 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -040094 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -040095void
96hb_set_destroy (hb_set_t *set)
97{
98 if (!hb_object_destroy (set)) return;
99
Behdad Esfahbodf1f6bc02018-05-02 12:56:21 -0400100 set->fini_shallow ();
Behdad Esfahboda5e39fe2012-04-25 00:14:46 -0400101
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400102 free (set);
103}
104
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400105/**
106 * hb_set_set_user_data: (skip)
107 * @set: a set.
108 * @key:
109 * @data:
Behdad Esfahbodd2f249e2017-01-22 17:42:33 -0800110 * @destroy:
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400111 * @replace:
112 *
113 * Return value:
114 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200115 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400116 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400117hb_bool_t
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800118hb_set_set_user_data (hb_set_t *set,
119 hb_user_data_key_t *key,
120 void * data,
121 hb_destroy_func_t destroy,
122 hb_bool_t replace)
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400123{
124 return hb_object_set_user_data (set, key, data, destroy, replace);
125}
126
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400127/**
128 * hb_set_get_user_data: (skip)
129 * @set: a set.
130 * @key:
131 *
132 * Return value: (transfer none):
133 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200134 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400135 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400136void *
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800137hb_set_get_user_data (hb_set_t *set,
138 hb_user_data_key_t *key)
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400139{
140 return hb_object_get_user_data (set, key);
141}
142
143
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400144/**
145 * hb_set_allocation_successful:
146 * @set: a set.
147 *
148 *
149 *
150 * Return value:
151 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200152 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400153 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400154hb_bool_t
Ebrahim Byagowi24b8b9b2018-04-23 19:03:57 +0430155hb_set_allocation_successful (const hb_set_t *set)
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400156{
Behdad Esfahbod7185b272018-05-31 20:03:00 -0700157 return set->successful;
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400158}
159
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400160/**
161 * hb_set_clear:
162 * @set: a set.
163 *
164 *
165 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200166 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400167 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400168void
169hb_set_clear (hb_set_t *set)
170{
171 set->clear ();
172}
173
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400174/**
175 * hb_set_is_empty:
176 * @set: a set.
177 *
178 *
179 *
180 * Return value:
181 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200182 * Since: 0.9.7
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400183 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400184hb_bool_t
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800185hb_set_is_empty (const hb_set_t *set)
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400186{
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800187 return set->is_empty ();
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400188}
189
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400190/**
191 * hb_set_has:
192 * @set: a set.
193 * @codepoint:
194 *
195 *
196 *
197 * Return value:
198 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200199 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400200 **/
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400201hb_bool_t
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800202hb_set_has (const hb_set_t *set,
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400203 hb_codepoint_t codepoint)
204{
205 return set->has (codepoint);
206}
207
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400208/**
209 * hb_set_add:
210 * @set: a set.
211 * @codepoint:
212 *
213 *
214 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200215 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400216 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400217void
218hb_set_add (hb_set_t *set,
219 hb_codepoint_t codepoint)
220{
221 set->add (codepoint);
222}
223
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400224/**
225 * hb_set_add_range:
226 * @set: a set.
227 * @first:
228 * @last:
229 *
230 *
231 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200232 * Since: 0.9.7
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400233 **/
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400234void
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800235hb_set_add_range (hb_set_t *set,
236 hb_codepoint_t first,
237 hb_codepoint_t last)
238{
239 set->add_range (first, last);
240}
241
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400242/**
243 * hb_set_del:
244 * @set: a set.
245 * @codepoint:
246 *
247 *
248 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200249 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400250 **/
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800251void
Behdad Esfahbod0b08adb2012-04-23 22:41:09 -0400252hb_set_del (hb_set_t *set,
253 hb_codepoint_t codepoint)
254{
255 set->del (codepoint);
256}
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400257
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400258/**
259 * hb_set_del_range:
260 * @set: a set.
261 * @first:
262 * @last:
263 *
264 *
265 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200266 * Since: 0.9.7
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400267 **/
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800268void
269hb_set_del_range (hb_set_t *set,
270 hb_codepoint_t first,
271 hb_codepoint_t last)
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400272{
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800273 set->del_range (first, last);
274}
275
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400276/**
277 * hb_set_is_equal:
278 * @set: a set.
Behdad Esfahbod11f1f412018-06-06 16:46:50 -0700279 * @other: other set.
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400280 *
281 *
282 *
Behdad Esfahbod11f1f412018-06-06 16:46:50 -0700283 * Return value: %TRUE if the two sets are equal, %FALSE otherwise.
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400284 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200285 * Since: 0.9.7
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400286 **/
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800287hb_bool_t
288hb_set_is_equal (const hb_set_t *set,
289 const hb_set_t *other)
290{
291 return set->is_equal (other);
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400292}
293
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400294/**
Behdad Esfahbod11f1f412018-06-06 16:46:50 -0700295 * hb_set_is_subset:
296 * @set: a set.
297 * @larger_set: other set.
298 *
299 *
300 *
301 * Return value: %TRUE if the @set is a subset of (or equal to) @larger_set, %FALSE otherwise.
302 *
303 * Since: 1.8.1
304 **/
305hb_bool_t
306hb_set_is_subset (const hb_set_t *set,
307 const hb_set_t *larger_set)
308{
309 return set->is_subset (larger_set);
310}
311
312/**
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400313 * hb_set_set:
314 * @set: a set.
315 * @other:
316 *
317 *
318 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200319 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400320 **/
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400321void
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800322hb_set_set (hb_set_t *set,
323 const hb_set_t *other)
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400324{
325 set->set (other);
326}
327
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400328/**
329 * hb_set_union:
330 * @set: a set.
331 * @other:
332 *
333 *
334 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200335 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400336 **/
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400337void
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800338hb_set_union (hb_set_t *set,
339 const hb_set_t *other)
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400340{
341 set->union_ (other);
342}
343
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400344/**
345 * hb_set_intersect:
346 * @set: a set.
347 * @other:
348 *
349 *
350 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200351 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400352 **/
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400353void
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800354hb_set_intersect (hb_set_t *set,
355 const hb_set_t *other)
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400356{
357 set->intersect (other);
358}
359
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400360/**
361 * hb_set_subtract:
362 * @set: a set.
363 * @other:
364 *
365 *
366 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200367 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400368 **/
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400369void
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800370hb_set_subtract (hb_set_t *set,
371 const hb_set_t *other)
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400372{
373 set->subtract (other);
374}
375
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400376/**
377 * hb_set_symmetric_difference:
378 * @set: a set.
379 * @other:
380 *
381 *
382 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200383 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400384 **/
Behdad Esfahbod62c3e112012-05-25 13:48:00 -0400385void
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800386hb_set_symmetric_difference (hb_set_t *set,
387 const hb_set_t *other)
Behdad Esfahbod62c3e112012-05-25 13:48:00 -0400388{
389 set->symmetric_difference (other);
390}
391
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400392/**
393 * hb_set_invert:
394 * @set: a set.
395 *
396 *
397 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200398 * Since: 0.9.10
Behdad Esfahbod1d397122017-10-15 16:15:24 +0200399 *
400 * Deprecated: 1.6.1
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400401 **/
Behdad Esfahbod8165f272013-01-02 22:50:36 -0600402void
Behdad Esfahbod39bd07a2018-10-26 21:01:11 -0700403hb_set_invert (hb_set_t *set HB_UNUSED)
Behdad Esfahbod8165f272013-01-02 22:50:36 -0600404{
Behdad Esfahbod8165f272013-01-02 22:50:36 -0600405}
406
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400407/**
408 * hb_set_get_population:
409 * @set: a set.
410 *
411 * Returns the number of numbers in the set.
412 *
413 * Return value: set population.
414 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200415 * Since: 0.9.7
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400416 **/
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800417unsigned int
Behdad Esfahbodac064a22012-11-21 01:14:19 -0500418hb_set_get_population (const hb_set_t *set)
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800419{
420 return set->get_population ();
421}
422
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400423/**
424 * hb_set_get_min:
425 * @set: a set.
426 *
427 * Finds the minimum number in the set.
428 *
429 * Return value: minimum of the set, or %HB_SET_VALUE_INVALID if set is empty.
430 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200431 * Since: 0.9.7
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400432 **/
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400433hb_codepoint_t
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800434hb_set_get_min (const hb_set_t *set)
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400435{
Behdad Esfahbodf039e792012-05-17 20:55:12 -0400436 return set->get_min ();
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400437}
438
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400439/**
440 * hb_set_get_max:
441 * @set: a set.
442 *
443 * Finds the maximum number in the set.
444 *
445 * Return value: minimum of the set, or %HB_SET_VALUE_INVALID if set is empty.
446 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200447 * Since: 0.9.7
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400448 **/
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400449hb_codepoint_t
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800450hb_set_get_max (const hb_set_t *set)
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400451{
Behdad Esfahbodf039e792012-05-17 20:55:12 -0400452 return set->get_max ();
Behdad Esfahbod6c6ccaf2012-04-24 14:21:15 -0400453}
Behdad Esfahbod29ce4462012-05-25 14:17:54 -0400454
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400455/**
456 * hb_set_next:
457 * @set: a set.
458 * @codepoint: (inout):
459 *
Behdad Esfahbod694eaf62018-02-14 01:00:10 -0800460 * Gets the next number in @set that is greater than current value of @codepoint.
461 *
462 * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400463 *
464 * Return value: whether there was a next value.
465 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200466 * Since: 0.9.2
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400467 **/
Behdad Esfahbod29ce4462012-05-25 14:17:54 -0400468hb_bool_t
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800469hb_set_next (const hb_set_t *set,
Behdad Esfahbod29ce4462012-05-25 14:17:54 -0400470 hb_codepoint_t *codepoint)
471{
472 return set->next (codepoint);
473}
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800474
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400475/**
Behdad Esfahbod694eaf62018-02-14 01:00:10 -0800476 * hb_set_previous:
477 * @set: a set.
478 * @codepoint: (inout):
479 *
480 * Gets the previous number in @set that is slower than current value of @codepoint.
481 *
482 * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
483 *
484 * Return value: whether there was a previous value.
485 *
486 * Since: 1.8.0
487 **/
488hb_bool_t
489hb_set_previous (const hb_set_t *set,
490 hb_codepoint_t *codepoint)
491{
492 return set->previous (codepoint);
493}
494
495/**
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400496 * hb_set_next_range:
497 * @set: a set.
498 * @first: (out): output first codepoint in the range.
499 * @last: (inout): input current last and output last codepoint in the range.
500 *
501 * Gets the next consecutive range of numbers in @set that
502 * are greater than current value of @last.
503 *
Behdad Esfahbod694eaf62018-02-14 01:00:10 -0800504 * Set @last to %HB_SET_VALUE_INVALID to get started.
505 *
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400506 * Return value: whether there was a next range.
507 *
Sascha Brawer01c3a882015-06-01 13:22:01 +0200508 * Since: 0.9.7
Behdad Esfahbod20cbc1f2013-09-06 15:29:22 -0400509 **/
Behdad Esfahbodaec89de2012-11-15 16:15:42 -0800510hb_bool_t
511hb_set_next_range (const hb_set_t *set,
512 hb_codepoint_t *first,
513 hb_codepoint_t *last)
514{
515 return set->next_range (first, last);
516}
Behdad Esfahbod694eaf62018-02-14 01:00:10 -0800517
518/**
519 * hb_set_previous_range:
520 * @set: a set.
521 * @first: (inout): input current first and output first codepoint in the range.
522 * @last: (out): output last codepoint in the range.
523 *
524 * Gets the previous consecutive range of numbers in @set that
525 * are greater than current value of @last.
526 *
527 * Set @first to %HB_SET_VALUE_INVALID to get started.
528 *
529 * Return value: whether there was a previous range.
530 *
531 * Since: 1.8.0
532 **/
533hb_bool_t
534hb_set_previous_range (const hb_set_t *set,
535 hb_codepoint_t *first,
536 hb_codepoint_t *last)
537{
538 return set->previous_range (first, last);
539}