* Google Author(s): Behdad Esfahbod
*/
-#include "hb-set-private.hh"
+#include "hb-set.hh"
-/* Public API */
+/**
+ * SECTION:hb-set
+ * @title: hb-set
+ * @short_description: Object representing a set of integers
+ * @include: hb.h
+ *
+ * Set objects represent a mathematical set of integer values. They are
+ * used in non-shaping API to query certain set of characters or glyphs,
+ * or other integer values.
+ **/
/**
*
* Return value: (transfer full):
*
- * Since: 1.0
+ * Since: 0.9.2
**/
hb_set_t *
-hb_set_create (void)
+hb_set_create ()
{
hb_set_t *set;
if (!(set = hb_object_create<hb_set_t> ()))
return hb_set_get_empty ();
- set->clear ();
+ set->init_shallow ();
return set;
}
*
* Return value: (transfer full):
*
- * Since: 1.0
+ * Since: 0.9.2
**/
hb_set_t *
-hb_set_get_empty (void)
+hb_set_get_empty ()
{
- static const hb_set_t _hb_set_nil = {
- HB_OBJECT_HEADER_STATIC,
- true, /* in_error */
-
- {0} /* elts */
- };
-
- return const_cast<hb_set_t *> (&_hb_set_nil);
+ return const_cast<hb_set_t *> (&Null(hb_set_t));
}
/**
*
* Return value: (transfer full):
*
- * Since: 1.0
+ * Since: 0.9.2
**/
hb_set_t *
hb_set_reference (hb_set_t *set)
* hb_set_destroy: (skip)
* @set: a set.
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_destroy (hb_set_t *set)
{
if (!hb_object_destroy (set)) return;
- set->fini ();
+ set->fini_shallow ();
free (set);
}
* @set: a set.
* @key:
* @data:
- * @destroy (closure data):
+ * @destroy:
* @replace:
*
* Return value:
*
- * Since: 1.0
+ * Since: 0.9.2
**/
hb_bool_t
hb_set_set_user_data (hb_set_t *set,
*
* Return value: (transfer none):
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void *
hb_set_get_user_data (hb_set_t *set,
*
* Return value:
*
- * Since: 1.0
+ * Since: 0.9.2
**/
hb_bool_t
-hb_set_allocation_successful (const hb_set_t *set HB_UNUSED)
+hb_set_allocation_successful (const hb_set_t *set)
{
- return !set->in_error;
+ return set->successful;
}
/**
*
*
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_clear (hb_set_t *set)
*
* Return value:
*
- * Since: 1.0
+ * Since: 0.9.7
**/
hb_bool_t
hb_set_is_empty (const hb_set_t *set)
*
* Return value:
*
- * Since: 1.0
+ * Since: 0.9.2
**/
hb_bool_t
hb_set_has (const hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_add (hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.7
**/
void
hb_set_add_range (hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_del (hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.7
**/
void
hb_set_del_range (hb_set_t *set,
/**
* hb_set_is_equal:
* @set: a set.
- * @other:
+ * @other: other set.
*
*
*
- * Return value:
+ * Return value: %TRUE if the two sets are equal, %FALSE otherwise.
*
- * Since: 1.0
+ * Since: 0.9.7
**/
hb_bool_t
hb_set_is_equal (const hb_set_t *set,
}
/**
+ * hb_set_is_subset:
+ * @set: a set.
+ * @larger_set: other set.
+ *
+ *
+ *
+ * Return value: %TRUE if the @set is a subset of (or equal to) @larger_set, %FALSE otherwise.
+ *
+ * Since: 1.8.1
+ **/
+hb_bool_t
+hb_set_is_subset (const hb_set_t *set,
+ const hb_set_t *larger_set)
+{
+ return set->is_subset (larger_set);
+}
+
+/**
* hb_set_set:
* @set: a set.
* @other:
*
*
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_set (hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_union (hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_intersect (hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_subtract (hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.2
**/
void
hb_set_symmetric_difference (hb_set_t *set,
*
*
*
- * Since: 1.0
+ * Since: 0.9.10
+ *
+ * Deprecated: 1.6.1
**/
void
-hb_set_invert (hb_set_t *set)
+hb_set_invert (hb_set_t *set HB_UNUSED)
{
- set->invert ();
}
/**
*
* Return value: set population.
*
- * Since: 1.0
+ * Since: 0.9.7
**/
unsigned int
hb_set_get_population (const hb_set_t *set)
*
* Return value: minimum of the set, or %HB_SET_VALUE_INVALID if set is empty.
*
- * Since: 1.0
+ * Since: 0.9.7
**/
hb_codepoint_t
hb_set_get_min (const hb_set_t *set)
*
* Return value: minimum of the set, or %HB_SET_VALUE_INVALID if set is empty.
*
- * Since: 1.0
+ * Since: 0.9.7
**/
hb_codepoint_t
hb_set_get_max (const hb_set_t *set)
* @set: a set.
* @codepoint: (inout):
*
- *
+ * Gets the next number in @set that is greater than current value of @codepoint.
+ *
+ * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
*
* Return value: whether there was a next value.
*
- * Since: 1.0
+ * Since: 0.9.2
**/
hb_bool_t
hb_set_next (const hb_set_t *set,
}
/**
+ * hb_set_previous:
+ * @set: a set.
+ * @codepoint: (inout):
+ *
+ * Gets the previous number in @set that is slower than current value of @codepoint.
+ *
+ * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
+ *
+ * Return value: whether there was a previous value.
+ *
+ * Since: 1.8.0
+ **/
+hb_bool_t
+hb_set_previous (const hb_set_t *set,
+ hb_codepoint_t *codepoint)
+{
+ return set->previous (codepoint);
+}
+
+/**
* hb_set_next_range:
* @set: a set.
* @first: (out): output first codepoint in the range.
* Gets the next consecutive range of numbers in @set that
* are greater than current value of @last.
*
+ * Set @last to %HB_SET_VALUE_INVALID to get started.
+ *
* Return value: whether there was a next range.
*
- * Since: 1.0
+ * Since: 0.9.7
**/
hb_bool_t
hb_set_next_range (const hb_set_t *set,
{
return set->next_range (first, last);
}
+
+/**
+ * hb_set_previous_range:
+ * @set: a set.
+ * @first: (inout): input current first and output first codepoint in the range.
+ * @last: (out): output last codepoint in the range.
+ *
+ * Gets the previous consecutive range of numbers in @set that
+ * are greater than current value of @last.
+ *
+ * Set @first to %HB_SET_VALUE_INVALID to get started.
+ *
+ * Return value: whether there was a previous range.
+ *
+ * Since: 1.8.0
+ **/
+hb_bool_t
+hb_set_previous_range (const hb_set_t *set,
+ hb_codepoint_t *first,
+ hb_codepoint_t *last)
+{
+ return set->previous_range (first, last);
+}