29 #ifndef HB_OPEN_TYPE_HH
30 #define HB_OPEN_TYPE_HH
56 template <
typename Type,
74 IntType& operator ++ () { *
this += 1;
return *
this; }
75 IntType& operator -- () { *
this -= 1;
return *
this; }
80 {
return b->cmp (*
a); }
88 template <
typename Type2,
90 sizeof (Type2) <
sizeof (
int) &&
91 sizeof (
Type) <
sizeof (
int))>
95 return (
int)
a - (int)
b;
97 template <
typename Type2,
102 return a <
b ? -1 :
a ==
b ? 0 : +1;
148 float to_float ()
const {
return ((int32_t)
v) / 16384.f; }
159 float to_float ()
const {
return ((int32_t)
v) / 65536.f; }
187 operator const char* ()
const {
return reinterpret_cast<const char *
> (
this); }
188 operator char* () {
return reinterpret_cast<char *
> (
this); }
215 template <
typename Type,
bool has_null=true>
222 bool is_null ()
const {
return has_null && 0 == *
this; }
242 assert (0 == (Length & 3));
243 const HBUINT32 *EndPtr =
Table + Length / HBUINT32::static_size;
245 while (
Table < EndPtr)
263 template <
typename FixedType=HBUINT16>
286 template <
typename Type,
bool has_null>
292 template <
typename Type>
299 template <
typename Type,
typename OffsetType,
bool has_null=true>
310 return StructAtOffset<const Type> (
base, *
this);
315 return StructAtOffset<Type> (
base, *
this);
318 template <
typename Base,
321 template <
typename Base,
324 template <
typename Base,
327 template <
typename Base,
332 template <
typename ...Ts>
334 const void *src_base, Ts&&... ds)
340 auto *
s =
c->serializer;
344 bool ret =
c->dispatch (src_base+
src, std::forward<Ts> (ds)...);
346 if (
ret || !has_null)
347 s->add_link (*
this,
s->pop_pack ());
355 template <
typename ...Ts>
361 bool ret =
obj->serialize (
c, std::forward<Ts> (ds)...);
364 c->add_link (*
this,
c->pop_pack ());
375 template <
typename ...Ts>
377 const void *src_base,
unsigned dst_bias,
387 bool ret =
c->copy (src_base+
src, std::forward<Ts> (ds)...);
389 c->add_link (*
this,
c->pop_pack (), whence, dst_bias);
395 const void *src_base,
unsigned dst_bias = 0)
407 template <
typename ...Ts>
413 c->
dispatch (StructAtOffset<Type> (
base, *
this), std::forward<Ts> (ds)...) ||
420 if (!has_null)
return false;
421 return c->try_set (
this, 0);
440 template <
typename Type>
450 unsigned int i = (
unsigned int) i_;
457 unsigned int i = (
unsigned int) i_;
464 {
return len * Type::static_size; }
466 template <
typename T>
operator T * () {
return arrayZ; }
467 template <
typename T>
operator const T * ()
const {
return arrayZ; }
473 template <
typename T>
476 template <
typename T>
479 template <
typename T>
480 bool lfind (
unsigned int len,
const T &
x,
unsigned int *
i =
nullptr,
482 unsigned int to_store = (
unsigned int) -1)
const
485 void qsort (
unsigned int len,
unsigned int start = 0,
unsigned int end = (
unsigned int) -1)
494 template <
typename Iterator,
511 auto *
out =
c->start_embed (
this);
516 template <
typename ...Ts>
522 for (
unsigned int i = 0;
i <
count;
i++)
541 template <
typename Type,
typename OffsetType,
bool has_null=true>
545 template <
typename Type,
typename OffsetType,
bool has_null=true>
550 unsigned int i = (
unsigned int) i_;
557 unsigned int i = (
unsigned int) i_;
563 template <
typename ...Ts>
573 template <
typename Type>
583 template <
typename T>
586 template <
typename T>
589 template <
typename T>
590 bool bfind (
unsigned int len,
const T &
x,
unsigned int *
i =
nullptr,
592 unsigned int to_store = (
unsigned int) -1)
const
598 template <
typename Type,
typename LenType>
608 unsigned int i = (
unsigned int) i_;
614 unsigned int i = (
unsigned int) i_;
620 {
return len.static_size +
len * Type::static_size; }
622 explicit operator bool ()
const {
return len; }
646 template <
typename T>
648 {
return *
as_array ().lsearch (
x, ¬_found); }
649 template <
typename T>
651 {
return *
as_array ().lsearch (
x, ¬_found); }
652 template <
typename T>
655 unsigned int to_store = (
unsigned int) -1)
const
656 {
return as_array ().lfind (
x,
i, not_found, to_store); }
669 template <
typename Iterator,
698 auto *
out =
c->start_embed (
this);
705 template <
typename ...Ts>
712 for (
unsigned int i = 0;
i <
count;
i++)
740 template <
typename Type>
745 unsigned int i = (
unsigned int) i_;
747 return this+this->arrayZ[
i];
751 unsigned int i = (
unsigned int) i_;
753 return this+this->arrayZ[
i];
762 for (
unsigned int i = 0;
i <
count;
i++)
767 template <
typename ...Ts>
776 template <
typename Type,
typename LenType=HBUINT16>
779 static constexpr
unsigned item_size = Type::static_size;
785 unsigned int i = (
unsigned int) i_;
791 unsigned int i = (
unsigned int) i_;
819 template <
typename Iterator,
833 template <
typename ...Ts>
840 for (
unsigned int i = 0;
i <
count;
i++)
862 template <
typename Type,
typename LenType=HBUINT16>
869 unsigned int i = (
unsigned int) i_;
875 unsigned int i = (
unsigned int) i_;
880 {
return lenM1.static_size + (
lenM1 + 1) * Type::static_size; }
882 template <
typename ...Ts>
889 for (
unsigned int i = 0;
i <
count;
i++)
911 template <
typename Type,
typename LenType>
940 template <
typename Iterator,
949 template <
typename T>
951 {
return *
as_array ().bsearch (
x, ¬_found); }
952 template <
typename T>
954 {
return *
as_array ().bsearch (
x, ¬_found); }
955 template <
typename T>
958 unsigned int to_store = (
unsigned int) -1)
const
959 {
return as_array ().bfind (
x,
i, not_found, to_store); }
969 template <
typename LenType=HBUINT16>
972 operator uint32_t ()
const {
return len; }
1002 template <
typename Type,
typename LenType=HBUINT16>
1028 template <
typename Type>
1044 unsigned int count = Type::TerminationWordCount;
1045 for (
unsigned int i = 0;
i <
count;
i++)
1046 if (words[
i] != 0xFFFFu)
1053 unsigned int i = (
unsigned int) i_;
1059 unsigned int i = (
unsigned int) i_;
1068 template <
typename ...Ts>
1075 for (
unsigned int i = 0;
i <
count;
i++)
1081 template <
typename T>
1085 return hb_bsearch_impl (&
pos,
1090 _hb_cmp_method<T, Type>)
small capitals from c petite p scientific i
[1]
@ HB_NOT_FOUND_DONT_STORE
hb_array_t< T > hb_array(T *array, unsigned int length)
hb_sorted_array_t< T > hb_sorted_array(T *array, unsigned int length)
#define TRACE_SERIALIZE(this)
#define TRACE_SANITIZE(this)
#define return_trace(RET)
#define TRACE_SUBSET(this)
#define hb_is_sorted_source_of(Iter, Item)
static auto hb_requires(hb_is_iterable(Iterable))> static inline auto end(Iterable &&iterable) HB_AUTO_RETURN(hb_iter(iterable).end()) namespace OT
_hb_static_size< T, void > hb_static_size
HB_EXTERN unsigned int start_offset
@ HB_SERIALIZE_ERROR_ARRAY_OVERFLOW
IntType< uint8_t > HBUINT8
IntType< int32_t > HBINT32
DECLARE_NULL_NAMESPACE_BYTES(OT, Index)
Offset< HBUINT24 > Offset24
Offset< HBUINT16 > Offset16
IntType< uint32_t > HBUINT32
IntType< uint16_t > HBUINT16
IntType< int16_t > HBINT16
Offset< HBUINT32 > Offset32
IntType< uint32_t, 3 > HBUINT24
QString & operator+=(QString &that, const ProString &other)
constexpr bool operator!=(const timespec &t1, const timespec &t2)
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two)
GLenum GLuint GLenum GLsizei length
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
QTextStream out(stdout)
[7]
static const Type * get_null()
static const Type * get_null()
hb_array_t< const Type > sub_array(unsigned int start_offset, unsigned int *count=nullptr) const
bool sanitize_shallow(hb_sanitize_context_t *c) const
ArrayOf * copy(hb_serialize_context_t *c) const
const Type & lsearch(const T &x, const Type ¬_found=Null(Type)) const
bool sanitize(hb_sanitize_context_t *c, Ts &&... ds) const
hb_array_t< Type > writer_t
HB_NODISCARD bool serialize(hb_serialize_context_t *c, unsigned items_len)
Type & lsearch(const T &x, Type ¬_found=Crap(Type))
hb_array_t< Type > as_array()
Type arrayZ[HB_VAR_ARRAY]
hb_array_t< Type > sub_array(unsigned int start_offset, unsigned int count)
const Type & operator[](int i_) const
hb_array_t< Type > sub_array(unsigned int start_offset, unsigned int *count=nullptr)
HB_NODISCARD bool serialize(hb_serialize_context_t *c, Iterator items)
DEFINE_SIZE_ARRAY(sizeof(LenType), arrayZ)
void qsort(unsigned int start=0, unsigned int end=(unsigned int) -1)
Type * serialize_append(hb_serialize_context_t *c)
unsigned int get_size() const
HB_DELETE_CREATE_COPY_ASSIGN(ArrayOf)
static constexpr unsigned item_size
bool lfind(const T &x, unsigned int *i=nullptr, hb_not_found_t not_found=HB_NOT_FOUND_DONT_STORE, unsigned int to_store=(unsigned int) -1) const
hb_array_t< const Type > sub_array(unsigned int start_offset, unsigned int count) const
hb_array_t< const Type > iter_t
hb_array_t< const Type > as_array() const
HB_DELETE_CREATE_COPY_ASSIGN(ArrayOfM1)
const Type & operator[](int i_) const
Type arrayZ[HB_VAR_ARRAY]
unsigned int get_size() const
DEFINE_SIZE_ARRAY(sizeof(LenType), arrayZ)
bool sanitize(hb_sanitize_context_t *c, Ts &&... ds) const
static uint32_t CalcTableChecksum(const HBUINT32 *Table, uint32_t Length)
CheckSum & operator=(uint32_t i)
void set_for_data(const void *data, unsigned int length)
F2DOT14 & operator=(uint16_t i)
bool sanitize(hb_sanitize_context_t *c) const
DEFINE_SIZE_STATIC(2 *sizeof(FixedType))
HBFixed & operator=(uint32_t i)
HBGlyphID16 & operator=(uint16_t i)
HBUINT15 & operator=(uint16_t i)
HB_DELETE_CREATE_COPY_ASSIGN(HeadlessArrayOf)
DEFINE_SIZE_ARRAY(sizeof(LenType), arrayZ)
bool sanitize(hb_sanitize_context_t *c, Ts &&... ds) const
hb_array_t< Type > writer_t
hb_array_t< const Type > iter_t
hb_array_t< const Type > as_array() const
Type arrayZ[HB_VAR_ARRAY]
hb_array_t< Type > as_array()
unsigned get_length() const
bool serialize(hb_serialize_context_t *c, Iterator items)
unsigned int get_size() const
static constexpr unsigned item_size
const Type & operator[](int i_) const
bool serialize(hb_serialize_context_t *c, unsigned int items_len)
static constexpr unsigned NOT_FOUND_INDEX
Index & operator=(uint16_t i)
constexpr IntType(Type V)
static HB_INTERNAL int cmp(const IntType *a, const IntType *b)
static HB_INTERNAL int cmp(const void *a, const void *b)
IntType & operator=(uint16_t i)
bool sanitize(hb_sanitize_context_t *c) const
bool sanitize(hb_sanitize_context_t *c) const
const Type & operator[](int i_) const
bool subset(hb_subset_context_t *c) const
bool sanitize(hb_sanitize_context_t *c, Ts &&... ds) const
Offset & operator=(typename Type::type i)
DEFINE_SIZE_STATIC(sizeof(Type))
OffsetTo & operator=(typename OffsetType::type i)
bool neuter(hb_sanitize_context_t *c) const
const Type & operator()(const void *base) const
DEFINE_SIZE_STATIC(sizeof(OffsetType))
HB_DELETE_COPY_ASSIGN(OffsetTo)
friend const Type & operator+(const Base &base, const OffsetTo &offset)
bool sanitize(hb_sanitize_context_t *c, const void *base, Ts &&... ds) const
bool serialize_copy(hb_serialize_context_t *c, const OffsetTo &src, const void *src_base, unsigned dst_bias=0)
bool serialize_serialize(hb_serialize_context_t *c, Ts &&... ds)
bool sanitize_shallow(hb_sanitize_context_t *c, const void *base) const
bool serialize_subset(hb_subset_context_t *c, const OffsetTo &src, const void *src_base, Ts &&... ds)
bool serialize_copy(hb_serialize_context_t *c, const OffsetTo &src, const void *src_base, unsigned dst_bias, hb_serialize_context_t::whence_t whence, Ts &&... ds)
bool serialize(hb_serialize_context_t *c, Iterator items)
bool serialize(hb_serialize_context_t *c, unsigned int items_len)
hb_sorted_array_t< const Type > sub_array(unsigned int start_offset, unsigned int *count=nullptr) const
bool bfind(const T &x, unsigned int *i=nullptr, hb_not_found_t not_found=HB_NOT_FOUND_DONT_STORE, unsigned int to_store=(unsigned int) -1) const
hb_sorted_array_t< const Type > as_array() const
hb_sorted_array_t< Type > as_array()
hb_sorted_array_t< const Type > sub_array(unsigned int start_offset, unsigned int count) const
Type & bsearch(const T &x, Type ¬_found=Crap(Type))
hb_sorted_array_t< const Type > iter_t
hb_sorted_array_t< Type > sub_array(unsigned int start_offset, unsigned int count)
hb_sorted_array_t< Type > writer_t
hb_sorted_array_t< Type > sub_array(unsigned int start_offset, unsigned int *count=nullptr)
const Type & bsearch(const T &x, const Type ¬_found=Null(Type)) const
bool bfind(unsigned int len, const T &x, unsigned int *i=nullptr, hb_not_found_t not_found=HB_NOT_FOUND_DONT_STORE, unsigned int to_store=(unsigned int) -1) const
const Type & bsearch(unsigned int len, const T &x, const Type ¬_found=Null(Type)) const
Type & bsearch(unsigned int len, const T &x, Type ¬_found=Crap(Type))
hb_sorted_array_t< const Type > as_array(unsigned int len) const
hb_sorted_array_t< Type > as_array(unsigned int len)
Tag & operator=(hb_tag_t i)
bool serialize(hb_serialize_context_t *c, Iterator items)
Type arrayZ[HB_VAR_ARRAY]
hb_array_t< Type > as_array(unsigned int len)
UnsizedArrayOf * copy(hb_serialize_context_t *c, unsigned count) const
bool serialize(hb_serialize_context_t *c, unsigned int items_len)
const Type & operator[](int i_) const
void qsort(unsigned int len, unsigned int start=0, unsigned int end=(unsigned int) -1)
const Type & lsearch(unsigned int len, const T &x, const Type ¬_found=Null(Type)) const
bool lfind(unsigned int len, const T &x, unsigned int *i=nullptr, hb_not_found_t not_found=HB_NOT_FOUND_DONT_STORE, unsigned int to_store=(unsigned int) -1) const
HB_DELETE_CREATE_COPY_ASSIGN(UnsizedArrayOf)
Type & lsearch(unsigned int len, const T &x, Type ¬_found=Crap(Type))
static constexpr unsigned item_size
hb_array_t< const Type > as_array(unsigned int len) const
unsigned int get_size(unsigned int len) const
bool sanitize_shallow(hb_sanitize_context_t *c, unsigned int count) const
bool sanitize(hb_sanitize_context_t *c, unsigned int count, Ts &&... ds) const
bool sanitize(hb_sanitize_context_t *c, unsigned int count, Ts &&... ds) const
const Type & operator[](int i_) const
static constexpr unsigned NO_VARIATION
VarIdx & operator=(uint32_t i)
bool last_is_terminator() const
bool sanitize(hb_sanitize_context_t *c, Ts &&... ds) const
unsigned int get_length() const
HB_DELETE_CREATE_COPY_ASSIGN(VarSizedBinSearchArrayOf)
UnsizedArrayOf< HBUINT8 > bytesZ
const Type & operator[](int i_) const
const Type * bsearch(const T &key) const
unsigned int get_size() const
static constexpr unsigned item_size
VarSizedBinSearchHeader header
DEFINE_SIZE_ARRAY(10, bytesZ)
return_t dispatch(const T &obj, Ts &&... ds)