1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 // This file is available under and governed by the GNU General Public 26 // License version 2 only, as published by the Free Software Foundation. 27 // However, the following notice accompanied the original version of this 28 // file: 29 // 30 /* 31 * Copyright © 2012 Google, Inc. 32 * 33 * This is part of HarfBuzz, a text shaping library. 34 * 35 * Permission is hereby granted, without written agreement and without 36 * license or royalty fees, to use, copy, modify, and distribute this 37 * software and its documentation for any purpose, provided that the 38 * above copyright notice and the following two paragraphs appear in 39 * all copies of this software. 40 * 41 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 42 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 43 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 44 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 45 * DAMAGE. 46 * 47 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 48 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 49 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 50 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 51 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 52 * 53 * Google Author(s): Behdad Esfahbod 54 */ 55 56 #ifndef HB_H_IN 57 #error "Include <hb.h> instead." 58 #endif 59 60 #ifndef HB_SET_H 61 #define HB_SET_H 62 63 #include "hb-common.h" 64 65 HB_BEGIN_DECLS 66 67 68 /* 69 * Since: 0.9.21 70 */ 71 #define HB_SET_VALUE_INVALID ((hb_codepoint_t) -1) 72 73 typedef struct hb_set_t hb_set_t; 74 75 76 hb_set_t * 77 hb_set_create (void); 78 79 hb_set_t * 80 hb_set_get_empty (void); 81 82 hb_set_t * 83 hb_set_reference (hb_set_t *set); 84 85 void 86 hb_set_destroy (hb_set_t *set); 87 88 hb_bool_t 89 hb_set_set_user_data (hb_set_t *set, 90 hb_user_data_key_t *key, 91 void * data, 92 hb_destroy_func_t destroy, 93 hb_bool_t replace); 94 95 void * 96 hb_set_get_user_data (hb_set_t *set, 97 hb_user_data_key_t *key); 98 99 100 /* Returns false if allocation has failed before */ 101 hb_bool_t 102 hb_set_allocation_successful (const hb_set_t *set); 103 104 void 105 hb_set_clear (hb_set_t *set); 106 107 hb_bool_t 108 hb_set_is_empty (const hb_set_t *set); 109 110 hb_bool_t 111 hb_set_has (const hb_set_t *set, 112 hb_codepoint_t codepoint); 113 114 /* Right now limited to 16-bit integers. Eventually will do full codepoint range, sans -1 115 * which we will use as a sentinel. */ 116 void 117 hb_set_add (hb_set_t *set, 118 hb_codepoint_t codepoint); 119 120 void 121 hb_set_add_range (hb_set_t *set, 122 hb_codepoint_t first, 123 hb_codepoint_t last); 124 125 void 126 hb_set_del (hb_set_t *set, 127 hb_codepoint_t codepoint); 128 129 void 130 hb_set_del_range (hb_set_t *set, 131 hb_codepoint_t first, 132 hb_codepoint_t last); 133 134 hb_bool_t 135 hb_set_is_equal (const hb_set_t *set, 136 const hb_set_t *other); 137 138 void 139 hb_set_set (hb_set_t *set, 140 const hb_set_t *other); 141 142 void 143 hb_set_union (hb_set_t *set, 144 const hb_set_t *other); 145 146 void 147 hb_set_intersect (hb_set_t *set, 148 const hb_set_t *other); 149 150 void 151 hb_set_subtract (hb_set_t *set, 152 const hb_set_t *other); 153 154 void 155 hb_set_symmetric_difference (hb_set_t *set, 156 const hb_set_t *other); 157 158 void 159 hb_set_invert (hb_set_t *set); 160 161 unsigned int 162 hb_set_get_population (const hb_set_t *set); 163 164 /* Returns -1 if set empty. */ 165 hb_codepoint_t 166 hb_set_get_min (const hb_set_t *set); 167 168 /* Returns -1 if set empty. */ 169 hb_codepoint_t 170 hb_set_get_max (const hb_set_t *set); 171 172 /* Pass -1 in to get started. */ 173 hb_bool_t 174 hb_set_next (const hb_set_t *set, 175 hb_codepoint_t *codepoint); 176 177 /* Pass -1 for first and last to get started. */ 178 hb_bool_t 179 hb_set_next_range (const hb_set_t *set, 180 hb_codepoint_t *first, 181 hb_codepoint_t *last); 182 183 184 HB_END_DECLS 185 186 #endif /* HB_SET_H */