[set] Add hb_set_is_inverted()
diff --git a/src/hb-bit-set-invertible.hh b/src/hb-bit-set-invertible.hh index ff8aecc..1eb1b1c 100644 --- a/src/hb-bit-set-invertible.hh +++ b/src/hb-bit-set-invertible.hh
@@ -74,6 +74,11 @@ inverted = !inverted; } + bool is_inverted () const + { + return inverted; + } + bool is_empty () const { hb_codepoint_t v = INVALID;
diff --git a/src/hb-set.cc b/src/hb-set.cc index 0270b21..4496120 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc
@@ -492,6 +492,22 @@ } /** + * hb_set_is_inverted: + * @set: A set + * + * Returns whether the set is inverted. + * + * Return value: `true` if the set is inverted, `false` otherwise + * + * Since: REPLACEME + **/ +hb_bool_t +hb_set_is_inverted (const hb_set_t *set) +{ + return set->is_inverted (); +} + +/** * hb_set_get_population: * @set: A set *
diff --git a/src/hb-set.h b/src/hb-set.h index 93636ab..de53231 100644 --- a/src/hb-set.h +++ b/src/hb-set.h
@@ -98,6 +98,9 @@ hb_set_invert (hb_set_t *set); HB_EXTERN hb_bool_t +hb_set_is_inverted (const hb_set_t *set); + +HB_EXTERN hb_bool_t hb_set_has (const hb_set_t *set, hb_codepoint_t codepoint);
diff --git a/src/hb-set.hh b/src/hb-set.hh index b13d537..6048023 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh
@@ -79,6 +79,7 @@ void reset () { s.reset (); } void clear () { s.clear (); } void invert () { s.invert (); } + bool is_inverted () const { return s.is_inverted (); } bool is_empty () const { return s.is_empty (); } uint32_t hash () const { return s.hash (); }
diff --git a/src/test-set.cc b/src/test-set.cc index a0b7ac9..9fe319d 100644 --- a/src/test-set.cc +++ b/src/test-set.cc
@@ -132,7 +132,8 @@ assert (last == 4); assert (!s.previous_range (&start, &last)); - /* Inverted set returns true for invalid value. */ + assert (s.is_inverted ()); + /* Inverted set returns true for invalid value; oh well. */ assert (s.has (HB_SET_VALUE_INVALID)); }