1 | /* |
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 | |
27 | #ifndef HB_H_IN |
28 | #error "Include <hb.h> instead." |
29 | #endif |
30 | |
31 | #ifndef HB_SET_H |
32 | #define HB_SET_H |
33 | |
34 | #include "hb-common.h" |
35 | |
36 | HB_BEGIN_DECLS |
37 | |
38 | |
39 | /* |
40 | * Since: 0.9.21 |
41 | */ |
42 | #define HB_SET_VALUE_INVALID ((hb_codepoint_t) -1) |
43 | |
44 | /** |
45 | * hb_set_t: |
46 | * |
47 | * Data type for holding a set of integers. #hb_set_t's are |
48 | * used to gather and contain glyph IDs, Unicode code |
49 | * points, and various other collections of discrete |
50 | * values. |
51 | * |
52 | **/ |
53 | typedef struct hb_set_t hb_set_t; |
54 | |
55 | |
56 | HB_EXTERN hb_set_t * |
57 | hb_set_create (void); |
58 | |
59 | HB_EXTERN hb_set_t * |
60 | hb_set_get_empty (void); |
61 | |
62 | HB_EXTERN hb_set_t * |
63 | hb_set_reference (hb_set_t *set); |
64 | |
65 | HB_EXTERN void |
66 | hb_set_destroy (hb_set_t *set); |
67 | |
68 | HB_EXTERN hb_bool_t |
69 | hb_set_set_user_data (hb_set_t *set, |
70 | hb_user_data_key_t *key, |
71 | void * data, |
72 | hb_destroy_func_t destroy, |
73 | hb_bool_t replace); |
74 | |
75 | HB_EXTERN void * |
76 | hb_set_get_user_data (hb_set_t *set, |
77 | hb_user_data_key_t *key); |
78 | |
79 | |
80 | /* Returns false if allocation has failed before */ |
81 | HB_EXTERN hb_bool_t |
82 | hb_set_allocation_successful (const hb_set_t *set); |
83 | |
84 | HB_EXTERN void |
85 | hb_set_clear (hb_set_t *set); |
86 | |
87 | HB_EXTERN hb_bool_t |
88 | hb_set_is_empty (const hb_set_t *set); |
89 | |
90 | HB_EXTERN hb_bool_t |
91 | hb_set_has (const hb_set_t *set, |
92 | hb_codepoint_t codepoint); |
93 | |
94 | HB_EXTERN void |
95 | hb_set_add (hb_set_t *set, |
96 | hb_codepoint_t codepoint); |
97 | |
98 | HB_EXTERN void |
99 | hb_set_add_range (hb_set_t *set, |
100 | hb_codepoint_t first, |
101 | hb_codepoint_t last); |
102 | |
103 | HB_EXTERN void |
104 | hb_set_del (hb_set_t *set, |
105 | hb_codepoint_t codepoint); |
106 | |
107 | HB_EXTERN void |
108 | hb_set_del_range (hb_set_t *set, |
109 | hb_codepoint_t first, |
110 | hb_codepoint_t last); |
111 | |
112 | HB_EXTERN hb_bool_t |
113 | hb_set_is_equal (const hb_set_t *set, |
114 | const hb_set_t *other); |
115 | |
116 | HB_EXTERN hb_bool_t |
117 | hb_set_is_subset (const hb_set_t *set, |
118 | const hb_set_t *larger_set); |
119 | |
120 | HB_EXTERN void |
121 | hb_set_set (hb_set_t *set, |
122 | const hb_set_t *other); |
123 | |
124 | HB_EXTERN void |
125 | hb_set_union (hb_set_t *set, |
126 | const hb_set_t *other); |
127 | |
128 | HB_EXTERN void |
129 | hb_set_intersect (hb_set_t *set, |
130 | const hb_set_t *other); |
131 | |
132 | HB_EXTERN void |
133 | hb_set_subtract (hb_set_t *set, |
134 | const hb_set_t *other); |
135 | |
136 | HB_EXTERN void |
137 | hb_set_symmetric_difference (hb_set_t *set, |
138 | const hb_set_t *other); |
139 | |
140 | HB_EXTERN unsigned int |
141 | hb_set_get_population (const hb_set_t *set); |
142 | |
143 | /* Returns HB_SET_VALUE_INVALID if set empty. */ |
144 | HB_EXTERN hb_codepoint_t |
145 | hb_set_get_min (const hb_set_t *set); |
146 | |
147 | /* Returns HB_SET_VALUE_INVALID if set empty. */ |
148 | HB_EXTERN hb_codepoint_t |
149 | hb_set_get_max (const hb_set_t *set); |
150 | |
151 | /* Pass HB_SET_VALUE_INVALID in to get started. */ |
152 | HB_EXTERN hb_bool_t |
153 | hb_set_next (const hb_set_t *set, |
154 | hb_codepoint_t *codepoint); |
155 | |
156 | /* Pass HB_SET_VALUE_INVALID in to get started. */ |
157 | HB_EXTERN hb_bool_t |
158 | hb_set_previous (const hb_set_t *set, |
159 | hb_codepoint_t *codepoint); |
160 | |
161 | /* Pass HB_SET_VALUE_INVALID for first and last to get started. */ |
162 | HB_EXTERN hb_bool_t |
163 | hb_set_next_range (const hb_set_t *set, |
164 | hb_codepoint_t *first, |
165 | hb_codepoint_t *last); |
166 | |
167 | /* Pass HB_SET_VALUE_INVALID for first and last to get started. */ |
168 | HB_EXTERN hb_bool_t |
169 | hb_set_previous_range (const hb_set_t *set, |
170 | hb_codepoint_t *first, |
171 | hb_codepoint_t *last); |
172 | |
173 | |
174 | HB_END_DECLS |
175 | |
176 | #endif /* HB_SET_H */ |
177 | |