[set] Add backwards iterator New API: - hb_set_previous() - hb_set_previous_range()
diff --git a/src/hb-set.cc b/src/hb-set.cc index f3b864c..07cf9d0 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc
@@ -437,7 +437,9 @@ * @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. * @@ -451,6 +453,26 @@ } /** + * 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. @@ -459,6 +481,8 @@ * 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: 0.9.7 @@ -470,3 +494,26 @@ { 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); +}