Revert "Hide symbols in hb-iter"

This reverts commit 98f14c4cdb.

Same as previous commit.
pull/1666/head
Behdad Esfahbod 6 years ago
parent dab92bdd46
commit a98e4068e7
  1. 88
      src/hb-iter.hh

@ -58,8 +58,8 @@ struct hb_iter_t
private:
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
HB_INTERNAL const iter_t* thiz () const { return static_cast<const iter_t *> (this); }
HB_INTERNAL iter_t* thiz () { return static_cast< iter_t *> (this); }
const iter_t* thiz () const { return static_cast<const iter_t *> (this); }
iter_t* thiz () { return static_cast< iter_t *> (this); }
public:
/* TODO:
@ -67,39 +67,39 @@ struct hb_iter_t
* an operator and use it, and remove hb_iter_fallback_mixin_t completely. */
/* Operators. */
HB_INTERNAL iter_t iter () const { return *thiz(); }
HB_INTERNAL iter_t operator + () const { return *thiz(); }
HB_INTERNAL explicit operator bool () const { return thiz()->__more__ (); }
HB_INTERNAL unsigned len () const { return thiz()->__len__ (); }
iter_t iter () const { return *thiz(); }
iter_t operator + () const { return *thiz(); }
explicit operator bool () const { return thiz()->__more__ (); }
unsigned len () const { return thiz()->__len__ (); }
/* The following can only be enabled if item_t is reference type. Otherwise
* it will be returning pointer to temporary rvalue. */
template <typename T = item_t,
hb_enable_if (hb_is_reference (T))>
HB_INTERNAL hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); }
HB_INTERNAL item_t operator * () const { return thiz()->__item__ (); }
HB_INTERNAL item_t operator * () { return thiz()->__item__ (); }
HB_INTERNAL item_t operator [] (unsigned i) const { return thiz()->__item_at__ (i); }
HB_INTERNAL item_t operator [] (unsigned i) { return thiz()->__item_at__ (i); }
HB_INTERNAL iter_t& operator += (unsigned count) { thiz()->__forward__ (count); return *thiz(); }
HB_INTERNAL iter_t& operator ++ () { thiz()->__next__ (); return *thiz(); }
HB_INTERNAL iter_t& operator -= (unsigned count) { thiz()->__rewind__ (count); return *thiz(); }
HB_INTERNAL iter_t& operator -- () { thiz()->__prev__ (); return *thiz(); }
HB_INTERNAL iter_t operator + (unsigned count) const { auto c = thiz()->iter (); c += count; return c; }
HB_INTERNAL friend iter_t operator + (unsigned count, const iter_t &it) { return it + count; }
HB_INTERNAL iter_t operator ++ (int) { iter_t c (*thiz()); ++*thiz(); return c; }
HB_INTERNAL iter_t operator - (unsigned count) const { auto c = thiz()->iter (); c -= count; return c; }
HB_INTERNAL iter_t operator -- (int) { iter_t c (*thiz()); --*thiz(); return c; }
hb_remove_reference (item_t)* operator -> () const { return hb_addressof (**thiz()); }
item_t operator * () const { return thiz()->__item__ (); }
item_t operator * () { return thiz()->__item__ (); }
item_t operator [] (unsigned i) const { return thiz()->__item_at__ (i); }
item_t operator [] (unsigned i) { return thiz()->__item_at__ (i); }
iter_t& operator += (unsigned count) { thiz()->__forward__ (count); return *thiz(); }
iter_t& operator ++ () { thiz()->__next__ (); return *thiz(); }
iter_t& operator -= (unsigned count) { thiz()->__rewind__ (count); return *thiz(); }
iter_t& operator -- () { thiz()->__prev__ (); return *thiz(); }
iter_t operator + (unsigned count) const { auto c = thiz()->iter (); c += count; return c; }
friend iter_t operator + (unsigned count, const iter_t &it) { return it + count; }
iter_t operator ++ (int) { iter_t c (*thiz()); ++*thiz(); return c; }
iter_t operator - (unsigned count) const { auto c = thiz()->iter (); c -= count; return c; }
iter_t operator -- (int) { iter_t c (*thiz()); --*thiz(); return c; }
template <typename T>
HB_INTERNAL iter_t& operator >> (T &v) { v = **thiz(); ++*thiz(); return *thiz(); }
iter_t& operator >> (T &v) { v = **thiz(); ++*thiz(); return *thiz(); }
template <typename T>
HB_INTERNAL iter_t& operator >> (T &v) const { v = **thiz(); ++*thiz(); return *thiz(); }
iter_t& operator >> (T &v) const { v = **thiz(); ++*thiz(); return *thiz(); }
template <typename T>
HB_INTERNAL iter_t& operator << (const T v) { **thiz() = v; ++*thiz(); return *thiz(); }
iter_t& operator << (const T v) { **thiz() = v; ++*thiz(); return *thiz(); }
protected:
HB_INTERNAL hb_iter_t () {}
HB_INTERNAL hb_iter_t (const hb_iter_t &o HB_UNUSED) {}
HB_INTERNAL void operator = (const hb_iter_t &o HB_UNUSED) {}
hb_iter_t () {}
hb_iter_t (const hb_iter_t &o HB_UNUSED) {}
void operator = (const hb_iter_t &o HB_UNUSED) {}
};
#define HB_ITER_USING(Name) \
@ -140,11 +140,11 @@ static const struct
/* Specialization for C arrays. */
template <typename Type> inline hb_array_t<Type>
HB_INTERNAL operator () (Type *array, unsigned int length) const
operator () (Type *array, unsigned int length) const
{ return hb_array_t<Type> (array, length); }
template <typename Type, unsigned int length> hb_array_t<Type>
HB_INTERNAL operator () (Type (&array)[length]) const
operator () (Type (&array)[length]) const
{ return hb_array_t<Type> (array, length); }
} hb_iter HB_UNUSED;
@ -156,31 +156,31 @@ struct hb_iter_fallback_mixin_t
{
private:
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
HB_INTERNAL const iter_t* thiz () const { return static_cast<const iter_t *> (this); }
HB_INTERNAL iter_t* thiz () { return static_cast< iter_t *> (this); }
const iter_t* thiz () const { return static_cast<const iter_t *> (this); }
iter_t* thiz () { return static_cast< iter_t *> (this); }
public:
/* Access: Implement __item__(), or __item_at__() if random-access. */
HB_INTERNAL item_t __item__ () const { return (*thiz())[0]; }
HB_INTERNAL item_t __item_at__ (unsigned i) const { return *(*thiz() + i); }
item_t __item__ () const { return (*thiz())[0]; }
item_t __item_at__ (unsigned i) const { return *(*thiz() + i); }
/* Termination: Implement __more__(), or __len__() if random-access. */
HB_INTERNAL bool __more__ () const { return thiz()->len (); }
HB_INTERNAL unsigned __len__ () const
bool __more__ () const { return thiz()->len (); }
unsigned __len__ () const
{ iter_t c (*thiz()); unsigned l = 0; while (c) { c++; l++; }; return l; }
/* Advancing: Implement __next__(), or __forward__() if random-access. */
HB_INTERNAL void __next__ () { *thiz() += 1; }
HB_INTERNAL void __forward__ (unsigned n) { while (n--) ++*thiz(); }
void __next__ () { *thiz() += 1; }
void __forward__ (unsigned n) { while (n--) ++*thiz(); }
/* Rewinding: Implement __prev__() or __rewind__() if bidirectional. */
HB_INTERNAL void __prev__ () { *thiz() -= 1; }
HB_INTERNAL void __rewind__ (unsigned n) { while (n--) --*thiz(); }
void __prev__ () { *thiz() -= 1; }
void __rewind__ (unsigned n) { while (n--) --*thiz(); }
protected:
HB_INTERNAL hb_iter_fallback_mixin_t () {}
HB_INTERNAL hb_iter_fallback_mixin_t (const hb_iter_fallback_mixin_t &o HB_UNUSED) {}
HB_INTERNAL void operator = (const hb_iter_fallback_mixin_t &o HB_UNUSED) {}
hb_iter_fallback_mixin_t () {}
hb_iter_fallback_mixin_t (const hb_iter_fallback_mixin_t &o HB_UNUSED) {}
void operator = (const hb_iter_fallback_mixin_t &o HB_UNUSED) {}
};
template <typename iter_t, typename item_t = typename iter_t::__item_t__>
@ -189,11 +189,11 @@ struct hb_iter_with_fallback_t :
hb_iter_fallback_mixin_t<iter_t, item_t>
{
protected:
HB_INTERNAL hb_iter_with_fallback_t () {}
HB_INTERNAL hb_iter_with_fallback_t (const hb_iter_with_fallback_t &o HB_UNUSED) :
hb_iter_with_fallback_t () {}
hb_iter_with_fallback_t (const hb_iter_with_fallback_t &o HB_UNUSED) :
hb_iter_t<iter_t, item_t> (o),
hb_iter_fallback_mixin_t<iter_t, item_t> (o) {}
HB_INTERNAL void operator = (const hb_iter_with_fallback_t &o HB_UNUSED) {}
void operator = (const hb_iter_with_fallback_t &o HB_UNUSED) {}
};
/*

Loading…
Cancel
Save