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"
39 if (!(set = hb_object_create<hb_set_t> ()))
40 return hb_set_get_empty ();
48 hb_set_get_empty (void)
50 static const hb_set_t _hb_set_nil = {
51 HB_OBJECT_HEADER_STATIC,
57 return const_cast<hb_set_t *> (&_hb_set_nil);
61 hb_set_reference (hb_set_t *set)
63 return hb_object_reference (set);
67 hb_set_destroy (hb_set_t *set)
69 if (!hb_object_destroy (set)) return;
77 hb_set_set_user_data (hb_set_t *set,
78 hb_user_data_key_t *key,
80 hb_destroy_func_t destroy,
83 return hb_object_set_user_data (set, key, data, destroy, replace);
87 hb_set_get_user_data (hb_set_t *set,
88 hb_user_data_key_t *key)
90 return hb_object_get_user_data (set, key);
95 hb_set_allocation_successful (const hb_set_t *set HB_UNUSED)
97 return !set->in_error;
101 hb_set_clear (hb_set_t *set)
107 hb_set_is_empty (const hb_set_t *set)
109 return set->is_empty ();
113 hb_set_has (const hb_set_t *set,
114 hb_codepoint_t codepoint)
116 return set->has (codepoint);
120 hb_set_add (hb_set_t *set,
121 hb_codepoint_t codepoint)
123 set->add (codepoint);
127 hb_set_add_range (hb_set_t *set,
128 hb_codepoint_t first,
131 set->add_range (first, last);
135 hb_set_del (hb_set_t *set,
136 hb_codepoint_t codepoint)
138 set->del (codepoint);
142 hb_set_del_range (hb_set_t *set,
143 hb_codepoint_t first,
146 set->del_range (first, last);
150 hb_set_is_equal (const hb_set_t *set,
151 const hb_set_t *other)
153 return set->is_equal (other);
157 hb_set_set (hb_set_t *set,
158 const hb_set_t *other)
164 hb_set_union (hb_set_t *set,
165 const hb_set_t *other)
171 hb_set_intersect (hb_set_t *set,
172 const hb_set_t *other)
174 set->intersect (other);
178 hb_set_subtract (hb_set_t *set,
179 const hb_set_t *other)
181 set->subtract (other);
185 hb_set_symmetric_difference (hb_set_t *set,
186 const hb_set_t *other)
188 set->symmetric_difference (other);
192 hb_set_invert (hb_set_t *set)
198 hb_set_get_population (const hb_set_t *set)
200 return set->get_population ();
204 hb_set_get_min (const hb_set_t *set)
206 return set->get_min ();
210 hb_set_get_max (const hb_set_t *set)
212 return set->get_max ();
216 hb_set_next (const hb_set_t *set,
217 hb_codepoint_t *codepoint)
219 return set->next (codepoint);
223 hb_set_next_range (const hb_set_t *set,
224 hb_codepoint_t *first,
225 hb_codepoint_t *last)
227 return set->next_range (first, last);