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