summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-set.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-set.hh')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set.hh35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set.hh b/src/3rdparty/harfbuzz-ng/src/hb-set.hh
index 437e234361..1f05407869 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-set.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set.hh
@@ -42,9 +42,22 @@ struct hb_sparseset_t
~hb_sparseset_t () { fini (); }
hb_sparseset_t (const hb_sparseset_t& other) : hb_sparseset_t () { set (other); }
- void operator= (const hb_sparseset_t& other) { set (other); }
- // TODO Add move construtor/assign
- // TODO Add constructor for Iterator
+ hb_sparseset_t (hb_sparseset_t&& other) : hb_sparseset_t () { s = std::move (other.s); }
+ hb_sparseset_t& operator= (const hb_sparseset_t& other) { set (other); return *this; }
+ hb_sparseset_t& operator= (hb_sparseset_t&& other) { hb_swap (*this, other); return *this; }
+ friend void swap (hb_sparseset_t& a, hb_sparseset_t& b) { hb_swap (a.s, b.s); }
+
+ hb_sparseset_t (std::initializer_list<hb_codepoint_t> lst) : hb_sparseset_t ()
+ {
+ for (auto&& item : lst)
+ add (item);
+ }
+ template <typename Iterable,
+ hb_requires (hb_is_iterable (Iterable))>
+ hb_sparseset_t (const Iterable &o) : hb_sparseset_t ()
+ {
+ hb_copy (o, *this);
+ }
void init_shallow () { s.init (); }
void init ()
@@ -96,6 +109,7 @@ struct hb_sparseset_t
typedef bool value_t;
value_t operator [] (hb_codepoint_t k) const { return get (k); }
bool has (hb_codepoint_t k) const { return (*this)[k] != SENTINEL; }
+
/* Predicate. */
bool operator () (hb_codepoint_t k) const { return has (k); }
@@ -125,6 +139,8 @@ struct hb_sparseset_t
{ return s.next_range (first, last); }
bool previous_range (hb_codepoint_t *first, hb_codepoint_t *last) const
{ return s.previous_range (first, last); }
+ unsigned int next_many (hb_codepoint_t codepoint, hb_codepoint_t *out, unsigned int size) const
+ { return s.next_many (codepoint, out, size); }
unsigned int get_population () const { return s.get_population (); }
hb_codepoint_t get_min () const { return s.get_min (); }
@@ -140,7 +156,18 @@ struct hb_sparseset_t
operator iter_t () const { return iter (); }
};
-struct hb_set_t : hb_sparseset_t<hb_bit_set_invertible_t> {};
+struct hb_set_t : hb_sparseset_t<hb_bit_set_invertible_t>
+{
+ hb_set_t () = default;
+ ~hb_set_t () = default;
+ hb_set_t (hb_set_t&) = default;
+ hb_set_t& operator= (const hb_set_t&) = default;
+ hb_set_t& operator= (hb_set_t&&) = default;
+ hb_set_t (std::initializer_list<hb_codepoint_t> lst) : hb_sparseset_t<hb_bit_set_invertible_t> (lst) {}
+ template <typename Iterable,
+ hb_requires (hb_is_iterable (Iterable))>
+ hb_set_t (const Iterable &o) : hb_sparseset_t<hb_bit_set_invertible_t> (o) {}
+};
static_assert (hb_set_t::INVALID == HB_SET_VALUE_INVALID, "");