gfx/harfbuzz/src/hb-set.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     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  */
    27 #ifndef HB_H_IN
    28 #error "Include <hb.h> instead."
    29 #endif
    31 #ifndef HB_SET_H
    32 #define HB_SET_H
    34 #include "hb-common.h"
    36 HB_BEGIN_DECLS
    39 #define HB_SET_VALUE_INVALID ((hb_codepoint_t) -1)
    41 typedef struct hb_set_t hb_set_t;
    44 hb_set_t *
    45 hb_set_create (void);
    47 hb_set_t *
    48 hb_set_get_empty (void);
    50 hb_set_t *
    51 hb_set_reference (hb_set_t *set);
    53 void
    54 hb_set_destroy (hb_set_t *set);
    56 hb_bool_t
    57 hb_set_set_user_data (hb_set_t           *set,
    58 		      hb_user_data_key_t *key,
    59 		      void *              data,
    60 		      hb_destroy_func_t   destroy,
    61 		      hb_bool_t           replace);
    63 void *
    64 hb_set_get_user_data (hb_set_t           *set,
    65 		      hb_user_data_key_t *key);
    68 /* Returns false if allocation has failed before */
    69 hb_bool_t
    70 hb_set_allocation_successful (const hb_set_t *set);
    72 void
    73 hb_set_clear (hb_set_t *set);
    75 hb_bool_t
    76 hb_set_is_empty (const hb_set_t *set);
    78 hb_bool_t
    79 hb_set_has (const hb_set_t *set,
    80 	    hb_codepoint_t  codepoint);
    82 /* Right now limited to 16-bit integers.  Eventually will do full codepoint range, sans -1
    83  * which we will use as a sentinel. */
    84 void
    85 hb_set_add (hb_set_t       *set,
    86 	    hb_codepoint_t  codepoint);
    88 void
    89 hb_set_add_range (hb_set_t       *set,
    90 		  hb_codepoint_t  first,
    91 		  hb_codepoint_t  last);
    93 void
    94 hb_set_del (hb_set_t       *set,
    95 	    hb_codepoint_t  codepoint);
    97 void
    98 hb_set_del_range (hb_set_t       *set,
    99 		  hb_codepoint_t  first,
   100 		  hb_codepoint_t  last);
   102 hb_bool_t
   103 hb_set_is_equal (const hb_set_t *set,
   104 		 const hb_set_t *other);
   106 void
   107 hb_set_set (hb_set_t       *set,
   108 	    const hb_set_t *other);
   110 void
   111 hb_set_union (hb_set_t       *set,
   112 	      const hb_set_t *other);
   114 void
   115 hb_set_intersect (hb_set_t       *set,
   116 		  const hb_set_t *other);
   118 void
   119 hb_set_subtract (hb_set_t       *set,
   120 		 const hb_set_t *other);
   122 void
   123 hb_set_symmetric_difference (hb_set_t       *set,
   124 			     const hb_set_t *other);
   126 void
   127 hb_set_invert (hb_set_t *set);
   129 unsigned int
   130 hb_set_get_population (const hb_set_t *set);
   132 /* Returns -1 if set empty. */
   133 hb_codepoint_t
   134 hb_set_get_min (const hb_set_t *set);
   136 /* Returns -1 if set empty. */
   137 hb_codepoint_t
   138 hb_set_get_max (const hb_set_t *set);
   140 /* Pass -1 in to get started. */
   141 hb_bool_t
   142 hb_set_next (const hb_set_t *set,
   143 	     hb_codepoint_t *codepoint);
   145 /* Pass -1 for first and last to get started. */
   146 hb_bool_t
   147 hb_set_next_range (const hb_set_t *set,
   148 		   hb_codepoint_t *first,
   149 		   hb_codepoint_t *last);
   152 HB_END_DECLS
   154 #endif /* HB_SET_H */

mercurial