jpayne@69: /* jpayne@69: * Copyright © 2012 Google, Inc. jpayne@69: * jpayne@69: * This is part of HarfBuzz, a text shaping library. jpayne@69: * jpayne@69: * Permission is hereby granted, without written agreement and without jpayne@69: * license or royalty fees, to use, copy, modify, and distribute this jpayne@69: * software and its documentation for any purpose, provided that the jpayne@69: * above copyright notice and the following two paragraphs appear in jpayne@69: * all copies of this software. jpayne@69: * jpayne@69: * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR jpayne@69: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES jpayne@69: * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN jpayne@69: * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH jpayne@69: * DAMAGE. jpayne@69: * jpayne@69: * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, jpayne@69: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND jpayne@69: * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS jpayne@69: * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO jpayne@69: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. jpayne@69: * jpayne@69: * Google Author(s): Behdad Esfahbod jpayne@69: */ jpayne@69: jpayne@69: #ifndef HB_H_IN jpayne@69: #error "Include instead." jpayne@69: #endif jpayne@69: jpayne@69: #ifndef HB_SET_H jpayne@69: #define HB_SET_H jpayne@69: jpayne@69: #include "hb-common.h" jpayne@69: jpayne@69: HB_BEGIN_DECLS jpayne@69: jpayne@69: jpayne@69: /* jpayne@69: * Since: 0.9.21 jpayne@69: */ jpayne@69: #define HB_SET_VALUE_INVALID ((hb_codepoint_t) -1) jpayne@69: jpayne@69: typedef struct hb_set_t hb_set_t; jpayne@69: jpayne@69: jpayne@69: HB_EXTERN hb_set_t * jpayne@69: hb_set_create (void); jpayne@69: jpayne@69: HB_EXTERN hb_set_t * jpayne@69: hb_set_get_empty (void); jpayne@69: jpayne@69: HB_EXTERN hb_set_t * jpayne@69: hb_set_reference (hb_set_t *set); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_destroy (hb_set_t *set); jpayne@69: jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_set_user_data (hb_set_t *set, jpayne@69: hb_user_data_key_t *key, jpayne@69: void * data, jpayne@69: hb_destroy_func_t destroy, jpayne@69: hb_bool_t replace); jpayne@69: jpayne@69: HB_EXTERN void * jpayne@69: hb_set_get_user_data (hb_set_t *set, jpayne@69: hb_user_data_key_t *key); jpayne@69: jpayne@69: jpayne@69: /* Returns false if allocation has failed before */ jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_allocation_successful (const hb_set_t *set); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_clear (hb_set_t *set); jpayne@69: jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_is_empty (const hb_set_t *set); jpayne@69: jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_has (const hb_set_t *set, jpayne@69: hb_codepoint_t codepoint); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_add (hb_set_t *set, jpayne@69: hb_codepoint_t codepoint); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_add_range (hb_set_t *set, jpayne@69: hb_codepoint_t first, jpayne@69: hb_codepoint_t last); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_del (hb_set_t *set, jpayne@69: hb_codepoint_t codepoint); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_del_range (hb_set_t *set, jpayne@69: hb_codepoint_t first, jpayne@69: hb_codepoint_t last); jpayne@69: jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_is_equal (const hb_set_t *set, jpayne@69: const hb_set_t *other); jpayne@69: jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_is_subset (const hb_set_t *set, jpayne@69: const hb_set_t *larger_set); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_set (hb_set_t *set, jpayne@69: const hb_set_t *other); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_union (hb_set_t *set, jpayne@69: const hb_set_t *other); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_intersect (hb_set_t *set, jpayne@69: const hb_set_t *other); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_subtract (hb_set_t *set, jpayne@69: const hb_set_t *other); jpayne@69: jpayne@69: HB_EXTERN void jpayne@69: hb_set_symmetric_difference (hb_set_t *set, jpayne@69: const hb_set_t *other); jpayne@69: jpayne@69: HB_EXTERN unsigned int jpayne@69: hb_set_get_population (const hb_set_t *set); jpayne@69: jpayne@69: /* Returns HB_SET_VALUE_INVALID if set empty. */ jpayne@69: HB_EXTERN hb_codepoint_t jpayne@69: hb_set_get_min (const hb_set_t *set); jpayne@69: jpayne@69: /* Returns HB_SET_VALUE_INVALID if set empty. */ jpayne@69: HB_EXTERN hb_codepoint_t jpayne@69: hb_set_get_max (const hb_set_t *set); jpayne@69: jpayne@69: /* Pass HB_SET_VALUE_INVALID in to get started. */ jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_next (const hb_set_t *set, jpayne@69: hb_codepoint_t *codepoint); jpayne@69: jpayne@69: /* Pass HB_SET_VALUE_INVALID in to get started. */ jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_previous (const hb_set_t *set, jpayne@69: hb_codepoint_t *codepoint); jpayne@69: jpayne@69: /* Pass HB_SET_VALUE_INVALID for first and last to get started. */ jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_next_range (const hb_set_t *set, jpayne@69: hb_codepoint_t *first, jpayne@69: hb_codepoint_t *last); jpayne@69: jpayne@69: /* Pass HB_SET_VALUE_INVALID for first and last to get started. */ jpayne@69: HB_EXTERN hb_bool_t jpayne@69: hb_set_previous_range (const hb_set_t *set, jpayne@69: hb_codepoint_t *first, jpayne@69: hb_codepoint_t *last); jpayne@69: jpayne@69: jpayne@69: HB_END_DECLS jpayne@69: jpayne@69: #endif /* HB_SET_H */