hb-set.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. #ifndef HB_H_IN
  27. #error "Include <hb.h> instead."
  28. #endif
  29. #ifndef HB_SET_H
  30. #define HB_SET_H
  31. #include "hb-common.h"
  32. HB_BEGIN_DECLS
  33. /*
  34. * Since: 0.9.21
  35. */
  36. #define HB_SET_VALUE_INVALID ((hb_codepoint_t) -1)
  37. typedef struct hb_set_t hb_set_t;
  38. HB_EXTERN hb_set_t *
  39. hb_set_create (void);
  40. HB_EXTERN hb_set_t *
  41. hb_set_get_empty (void);
  42. HB_EXTERN hb_set_t *
  43. hb_set_reference (hb_set_t *set);
  44. HB_EXTERN void
  45. hb_set_destroy (hb_set_t *set);
  46. HB_EXTERN hb_bool_t
  47. hb_set_set_user_data (hb_set_t *set,
  48. hb_user_data_key_t *key,
  49. void * data,
  50. hb_destroy_func_t destroy,
  51. hb_bool_t replace);
  52. HB_EXTERN void *
  53. hb_set_get_user_data (hb_set_t *set,
  54. hb_user_data_key_t *key);
  55. /* Returns false if allocation has failed before */
  56. HB_EXTERN hb_bool_t
  57. hb_set_allocation_successful (const hb_set_t *set);
  58. HB_EXTERN void
  59. hb_set_clear (hb_set_t *set);
  60. HB_EXTERN hb_bool_t
  61. hb_set_is_empty (const hb_set_t *set);
  62. HB_EXTERN hb_bool_t
  63. hb_set_has (const hb_set_t *set,
  64. hb_codepoint_t codepoint);
  65. HB_EXTERN void
  66. hb_set_add (hb_set_t *set,
  67. hb_codepoint_t codepoint);
  68. HB_EXTERN void
  69. hb_set_add_range (hb_set_t *set,
  70. hb_codepoint_t first,
  71. hb_codepoint_t last);
  72. HB_EXTERN void
  73. hb_set_del (hb_set_t *set,
  74. hb_codepoint_t codepoint);
  75. HB_EXTERN void
  76. hb_set_del_range (hb_set_t *set,
  77. hb_codepoint_t first,
  78. hb_codepoint_t last);
  79. HB_EXTERN hb_bool_t
  80. hb_set_is_equal (const hb_set_t *set,
  81. const hb_set_t *other);
  82. HB_EXTERN hb_bool_t
  83. hb_set_is_subset (const hb_set_t *set,
  84. const hb_set_t *larger_set);
  85. HB_EXTERN void
  86. hb_set_set (hb_set_t *set,
  87. const hb_set_t *other);
  88. HB_EXTERN void
  89. hb_set_union (hb_set_t *set,
  90. const hb_set_t *other);
  91. HB_EXTERN void
  92. hb_set_intersect (hb_set_t *set,
  93. const hb_set_t *other);
  94. HB_EXTERN void
  95. hb_set_subtract (hb_set_t *set,
  96. const hb_set_t *other);
  97. HB_EXTERN void
  98. hb_set_symmetric_difference (hb_set_t *set,
  99. const hb_set_t *other);
  100. HB_EXTERN unsigned int
  101. hb_set_get_population (const hb_set_t *set);
  102. /* Returns HB_SET_VALUE_INVALID if set empty. */
  103. HB_EXTERN hb_codepoint_t
  104. hb_set_get_min (const hb_set_t *set);
  105. /* Returns HB_SET_VALUE_INVALID if set empty. */
  106. HB_EXTERN hb_codepoint_t
  107. hb_set_get_max (const hb_set_t *set);
  108. /* Pass HB_SET_VALUE_INVALID in to get started. */
  109. HB_EXTERN hb_bool_t
  110. hb_set_next (const hb_set_t *set,
  111. hb_codepoint_t *codepoint);
  112. /* Pass HB_SET_VALUE_INVALID in to get started. */
  113. HB_EXTERN hb_bool_t
  114. hb_set_previous (const hb_set_t *set,
  115. hb_codepoint_t *codepoint);
  116. /* Pass HB_SET_VALUE_INVALID for first and last to get started. */
  117. HB_EXTERN hb_bool_t
  118. hb_set_next_range (const hb_set_t *set,
  119. hb_codepoint_t *first,
  120. hb_codepoint_t *last);
  121. /* Pass HB_SET_VALUE_INVALID for first and last to get started. */
  122. HB_EXTERN hb_bool_t
  123. hb_set_previous_range (const hb_set_t *set,
  124. hb_codepoint_t *first,
  125. hb_codepoint_t *last);
  126. HB_END_DECLS
  127. #endif /* HB_SET_H */