Imported Upstream version 2.6.7
[platform/upstream/harfbuzz.git] / src / hb-set.cc
index 07cf9d0..0551ed8 100644 (file)
  * 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.
+ **/
 
 
 /**
  * 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->init ();
+  set->init_shallow ();
 
   return set;
 }
 
-static const hb_set_t _hb_set_nil = {
-  HB_OBJECT_HEADER_STATIC,
-  true, /* in_error */
-
-  {0} /* elts */
-};
-
 /**
  * hb_set_get_empty:
  *
@@ -65,9 +67,9 @@ static const hb_set_t _hb_set_nil = {
  * Since: 0.9.2
  **/
 hb_set_t *
-hb_set_get_empty (void)
+hb_set_get_empty ()
 {
-  return const_cast<hb_set_t *> (&_hb_set_nil);
+  return const_cast<hb_set_t *> (&Null (hb_set_t));
 }
 
 /**
@@ -95,7 +97,7 @@ hb_set_destroy (hb_set_t *set)
 {
   if (!hb_object_destroy (set)) return;
 
-  set->finish ();
+  set->fini_shallow ();
 
   free (set);
 }
@@ -143,23 +145,23 @@ hb_set_get_user_data (hb_set_t           *set,
  * hb_set_allocation_successful:
  * @set: a set.
  *
- * 
  *
- * Return value: 
+ *
+ * Return value:
  *
  * 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;
 }
 
 /**
  * hb_set_clear:
  * @set: a set.
  *
- * 
+ *
  *
  * Since: 0.9.2
  **/
@@ -173,9 +175,9 @@ hb_set_clear (hb_set_t *set)
  * hb_set_is_empty:
  * @set: a set.
  *
- * 
  *
- * Return value: 
+ *
+ * Return value:
  *
  * Since: 0.9.7
  **/
@@ -188,11 +190,11 @@ hb_set_is_empty (const hb_set_t *set)
 /**
  * hb_set_has:
  * @set: a set.
- * @codepoint: 
+ * @codepoint:
  *
- * 
  *
- * Return value: 
+ *
+ * Return value:
  *
  * Since: 0.9.2
  **/
@@ -206,9 +208,9 @@ hb_set_has (const hb_set_t *set,
 /**
  * hb_set_add:
  * @set: a set.
- * @codepoint: 
+ * @codepoint:
+ *
  *
- * 
  *
  * Since: 0.9.2
  **/
@@ -222,10 +224,10 @@ hb_set_add (hb_set_t       *set,
 /**
  * hb_set_add_range:
  * @set: a set.
- * @first: 
- * @last: 
+ * @first:
+ * @last:
+ *
  *
- * 
  *
  * Since: 0.9.7
  **/
@@ -240,9 +242,9 @@ hb_set_add_range (hb_set_t       *set,
 /**
  * hb_set_del:
  * @set: a set.
- * @codepoint: 
+ * @codepoint:
+ *
  *
- * 
  *
  * Since: 0.9.2
  **/
@@ -256,10 +258,10 @@ hb_set_del (hb_set_t       *set,
 /**
  * hb_set_del_range:
  * @set: a set.
- * @first: 
- * @last: 
+ * @first:
+ * @last:
+ *
  *
- * 
  *
  * Since: 0.9.7
  **/
@@ -274,11 +276,11 @@ 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: 0.9.7
  **/
@@ -290,11 +292,29 @@ 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: 
+ * @other:
+ *
  *
- * 
  *
  * Since: 0.9.2
  **/
@@ -308,9 +328,9 @@ hb_set_set (hb_set_t       *set,
 /**
  * hb_set_union:
  * @set: a set.
- * @other: 
+ * @other:
+ *
  *
- * 
  *
  * Since: 0.9.2
  **/
@@ -324,9 +344,9 @@ hb_set_union (hb_set_t       *set,
 /**
  * hb_set_intersect:
  * @set: a set.
- * @other: 
+ * @other:
+ *
  *
- * 
  *
  * Since: 0.9.2
  **/
@@ -340,9 +360,9 @@ hb_set_intersect (hb_set_t       *set,
 /**
  * hb_set_subtract:
  * @set: a set.
- * @other: 
+ * @other:
+ *
  *
- * 
  *
  * Since: 0.9.2
  **/
@@ -356,9 +376,9 @@ hb_set_subtract (hb_set_t       *set,
 /**
  * hb_set_symmetric_difference:
  * @set: a set.
- * @other: 
+ * @other:
+ *
  *
- * 
  *
  * Since: 0.9.2
  **/
@@ -369,20 +389,22 @@ hb_set_symmetric_difference (hb_set_t       *set,
   set->symmetric_difference (other);
 }
 
+#ifndef HB_DISABLE_DEPRECATED
 /**
  * hb_set_invert:
  * @set: a set.
  *
- * 
+ *
  *
  * 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)
 {
 }
+#endif
 
 /**
  * hb_set_get_population:
@@ -457,7 +479,7 @@ hb_set_next (const hb_set_t *set,
  * @set: a set.
  * @codepoint: (inout):
  *
- * Gets the previous number in @set that is slower than current value of @codepoint.
+ * Gets the previous number in @set that is lower than current value of @codepoint.
  *
  * Set @codepoint to %HB_SET_VALUE_INVALID to get started.
  *
@@ -502,7 +524,7 @@ hb_set_next_range (const hb_set_t *set,
  * @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.
+ * are less than current value of @first.
  *
  * Set @first to %HB_SET_VALUE_INVALID to get started.
  *