Mailbox support for texture layers.
[chromium-blink-merge.git] / third_party / harfbuzz-ng / src / hb-set.cc
blob4225e3c98c9212dd1e0452f637a3f98e341ebbca
1 /*
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
16 * DAMAGE.
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"
31 /* Public API */
34 hb_set_t *
35 hb_set_create ()
37 hb_set_t *set;
39 if (!(set = hb_object_create<hb_set_t> ()))
40 return hb_set_get_empty ();
42 set->clear ();
44 return set;
47 hb_set_t *
48 hb_set_get_empty (void)
50 static const hb_set_t _hb_set_nil = {
51 HB_OBJECT_HEADER_STATIC,
53 {0} /* elts */
56 return const_cast<hb_set_t *> (&_hb_set_nil);
59 hb_set_t *
60 hb_set_reference (hb_set_t *set)
62 return hb_object_reference (set);
65 void
66 hb_set_destroy (hb_set_t *set)
68 if (!hb_object_destroy (set)) return;
70 set->fini ();
72 free (set);
75 hb_bool_t
76 hb_set_set_user_data (hb_set_t *set,
77 hb_user_data_key_t *key,
78 void * data,
79 hb_destroy_func_t destroy,
80 hb_bool_t replace)
82 return hb_object_set_user_data (set, key, data, destroy, replace);
85 void *
86 hb_set_get_user_data (hb_set_t *set,
87 hb_user_data_key_t *key)
89 return hb_object_get_user_data (set, key);
93 hb_bool_t
94 hb_set_allocation_successful (hb_set_t *set HB_UNUSED)
96 return true;
99 void
100 hb_set_clear (hb_set_t *set)
102 set->clear ();
105 hb_bool_t
106 hb_set_empty (hb_set_t *set)
108 return set->empty ();
111 hb_bool_t
112 hb_set_has (hb_set_t *set,
113 hb_codepoint_t codepoint)
115 return set->has (codepoint);
118 void
119 hb_set_add (hb_set_t *set,
120 hb_codepoint_t codepoint)
122 set->add (codepoint);
125 void
126 hb_set_del (hb_set_t *set,
127 hb_codepoint_t codepoint)
129 set->del (codepoint);
132 hb_bool_t
133 hb_set_equal (hb_set_t *set,
134 hb_set_t *other)
136 return set->equal (other);
139 void
140 hb_set_set (hb_set_t *set,
141 hb_set_t *other)
143 set->set (other);
146 void
147 hb_set_union (hb_set_t *set,
148 hb_set_t *other)
150 set->union_ (other);
153 void
154 hb_set_intersect (hb_set_t *set,
155 hb_set_t *other)
157 set->intersect (other);
160 void
161 hb_set_subtract (hb_set_t *set,
162 hb_set_t *other)
164 set->subtract (other);
167 void
168 hb_set_symmetric_difference (hb_set_t *set,
169 hb_set_t *other)
171 set->symmetric_difference (other);
174 hb_codepoint_t
175 hb_set_min (hb_set_t *set)
177 return set->get_min ();
180 hb_codepoint_t
181 hb_set_max (hb_set_t *set)
183 return set->get_max ();
186 hb_bool_t
187 hb_set_next (hb_set_t *set,
188 hb_codepoint_t *codepoint)
190 return set->next (codepoint);