2 * Copyright © 2012 Google, Inc.
4 * This is part of HarfBuzz, a text shaping library.
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.
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
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.
24 * Google Author(s): Behdad Esfahbod
27 #include "hb-set-private.hh"
34 * hb_set_create: (Xconstructor)
36 * Return value: (transfer full):
45 if (!(set = hb_object_create<hb_set_t> ()))
46 return hb_set_get_empty ();
56 * Return value: (transfer full):
61 hb_set_get_empty (void)
63 return const_cast<hb_set_t *> (&Null(hb_set_t));
67 * hb_set_reference: (skip)
70 * Return value: (transfer full):
75 hb_set_reference (hb_set_t *set)
77 return hb_object_reference (set);
81 * hb_set_destroy: (skip)
87 hb_set_destroy (hb_set_t *set)
89 if (!hb_object_destroy (set)) return;
97 * hb_set_set_user_data: (skip)
109 hb_set_set_user_data (hb_set_t *set,
110 hb_user_data_key_t *key,
112 hb_destroy_func_t destroy,
115 return hb_object_set_user_data (set, key, data, destroy, replace);
119 * hb_set_get_user_data: (skip)
123 * Return value: (transfer none):
128 hb_set_get_user_data (hb_set_t *set,
129 hb_user_data_key_t *key)
131 return hb_object_get_user_data (set, key);
136 * hb_set_allocation_successful:
146 hb_set_allocation_successful (const hb_set_t *set)
148 return set->successful;
160 hb_set_clear (hb_set_t *set)
176 hb_set_is_empty (const hb_set_t *set)
178 return set->is_empty ();
193 hb_set_has (const hb_set_t *set,
194 hb_codepoint_t codepoint)
196 return set->has (codepoint);
209 hb_set_add (hb_set_t *set,
210 hb_codepoint_t codepoint)
212 set->add (codepoint);
226 hb_set_add_range (hb_set_t *set,
227 hb_codepoint_t first,
230 set->add_range (first, last);
243 hb_set_del (hb_set_t *set,
244 hb_codepoint_t codepoint)
246 set->del (codepoint);
260 hb_set_del_range (hb_set_t *set,
261 hb_codepoint_t first,
264 set->del_range (first, last);
274 * Return value: %TRUE if the two sets are equal, %FALSE otherwise.
279 hb_set_is_equal (const hb_set_t *set,
280 const hb_set_t *other)
282 return set->is_equal (other);
288 * @larger_set: other set.
292 * Return value: %TRUE if the @set is a subset of (or equal to) @larger_set, %FALSE otherwise.
297 hb_set_is_subset (const hb_set_t *set,
298 const hb_set_t *larger_set)
300 return set->is_subset (larger_set);
313 hb_set_set (hb_set_t *set,
314 const hb_set_t *other)
329 hb_set_union (hb_set_t *set,
330 const hb_set_t *other)
345 hb_set_intersect (hb_set_t *set,
346 const hb_set_t *other)
348 set->intersect (other);
361 hb_set_subtract (hb_set_t *set,
362 const hb_set_t *other)
364 set->subtract (other);
368 * hb_set_symmetric_difference:
377 hb_set_symmetric_difference (hb_set_t *set,
378 const hb_set_t *other)
380 set->symmetric_difference (other);
394 hb_set_invert (hb_set_t *set)
399 * hb_set_get_population:
402 * Returns the number of numbers in the set.
404 * Return value: set population.
409 hb_set_get_population (const hb_set_t *set)
411 return set->get_population ();
418 * Finds the minimum number in the set.
420 * Return value: minimum of the set, or %HB_SET_VALUE_INVALID if set is empty.
425 hb_set_get_min (const hb_set_t *set)
427 return set->get_min ();
434 * Finds the maximum number in the set.
436 * Return value: minimum of the set, or %HB_SET_VALUE_INVALID if set is empty.
441 hb_set_get_max (const hb_set_t *set)
443 return set->get_max ();
449 * @codepoint: (inout):
451 * Gets the next number in @set that is greater than current value of @codepoint.
453 * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
455 * Return value: whether there was a next value.
460 hb_set_next (const hb_set_t *set,
461 hb_codepoint_t *codepoint)
463 return set->next (codepoint);
469 * @codepoint: (inout):
471 * Gets the previous number in @set that is slower than current value of @codepoint.
473 * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
475 * Return value: whether there was a previous value.
480 hb_set_previous (const hb_set_t *set,
481 hb_codepoint_t *codepoint)
483 return set->previous (codepoint);
489 * @first: (out): output first codepoint in the range.
490 * @last: (inout): input current last and output last codepoint in the range.
492 * Gets the next consecutive range of numbers in @set that
493 * are greater than current value of @last.
495 * Set @last to %HB_SET_VALUE_INVALID to get started.
497 * Return value: whether there was a next range.
502 hb_set_next_range (const hb_set_t *set,
503 hb_codepoint_t *first,
504 hb_codepoint_t *last)
506 return set->next_range (first, last);
510 * hb_set_previous_range:
512 * @first: (inout): input current first and output first codepoint in the range.
513 * @last: (out): output last codepoint in the range.
515 * Gets the previous consecutive range of numbers in @set that
516 * are greater than current value of @last.
518 * Set @first to %HB_SET_VALUE_INVALID to get started.
520 * Return value: whether there was a previous range.
525 hb_set_previous_range (const hb_set_t *set,
526 hb_codepoint_t *first,
527 hb_codepoint_t *last)
529 return set->previous_range (first, last);