Minor: Remove some GenericXXX templates

pull/27/merge
Behdad Esfahbod 11 years ago
parent 36073ede5b
commit 9da552dcc5
  1. 32
      src/hb-open-type-private.hh
  2. 4
      src/hb-ot-cmap-table.hh
  3. 2
      src/hb-ot-layout-common-private.hh

@ -692,8 +692,8 @@ struct FixedVersion
* Use: (base+offset)
*/
template <typename Type, typename OffsetType=Offset>
struct OffsetTo : OffsetType
template <typename Type, typename OffsetType=USHORT>
struct OffsetTo : GenericOffset<OffsetType>
{
inline const Type& operator () (const void *base) const
{
@ -737,16 +737,14 @@ static inline const Type& operator + (const Base &base, const OffsetTo<Type, Off
template <typename Base, typename OffsetType, typename Type>
static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType> &offset) { return offset (base); }
template <typename Type>
struct LongOffsetTo : OffsetTo<Type, LongOffset> {};
/*
* Array Types
*/
template <typename Type, typename LenType>
struct GenericArrayOf
/* An array with a number of elements. */
template <typename Type, typename LenType=USHORT>
struct ArrayOf
{
const Type *sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const
{
@ -852,13 +850,9 @@ struct GenericArrayOf
DEFINE_SIZE_ARRAY (sizeof (LenType), array);
};
/* An array with a USHORT number of elements. */
template <typename Type>
struct ArrayOf : GenericArrayOf<Type, USHORT> {};
/* An array with a ULONG number of elements. */
template <typename Type>
struct LongArrayOf : GenericArrayOf<Type, ULONG> {};
struct LongArrayOf : ArrayOf<Type, ULONG> {};
/* Array of Offset's */
template <typename Type>
@ -866,11 +860,11 @@ struct OffsetArrayOf : ArrayOf<OffsetTo<Type> > {};
/* Array of LongOffset's */
template <typename Type>
struct LongOffsetArrayOf : ArrayOf<LongOffsetTo<Type> > {};
struct LongOffsetArrayOf : ArrayOf<OffsetTo<Type, ULONG> > {};
/* LongArray of LongOffset's */
template <typename Type>
struct LongOffsetLongArrayOf : LongArrayOf<LongOffsetTo<Type> > {};
struct LongOffsetLongArrayOf : LongArrayOf<OffsetTo<Type, ULONG> > {};
/* Array of offsets relative to the beginning of the array itself. */
template <typename Type>
@ -951,8 +945,8 @@ struct HeadlessArrayOf
/* An array with sorted elements. Supports binary searching. */
template <typename Type, typename LenType>
struct GenericSortedArrayOf : GenericArrayOf<Type, LenType>
template <typename Type, typename LenType=USHORT>
struct SortedArrayOf : ArrayOf<Type, LenType>
{
template <typename SearchType>
inline int bsearch (const SearchType &x) const
@ -974,13 +968,9 @@ struct GenericSortedArrayOf : GenericArrayOf<Type, LenType>
}
};
/* A sorted array with a USHORT number of elements. */
template <typename Type>
struct SortedArrayOf : GenericSortedArrayOf<Type, USHORT> {};
/* A sorted array with a ULONG number of elements. */
template <typename Type>
struct LongSortedArrayOf : GenericSortedArrayOf<Type, ULONG> {};
struct LongSortedArrayOf : SortedArrayOf<Type, ULONG> {};
} /* namespace OT */

@ -229,7 +229,7 @@ struct CmapSubtableTrimmed
UINT length; /* Byte length of this subtable. */
UINT language; /* Ignore. */
UINT startCharCode; /* First character code covered. */
GenericArrayOf<GlyphID, UINT>
ArrayOf<GlyphID, UINT>
glyphIdArray; /* Array of glyph index values for character
* codes in the range. */
public:
@ -350,7 +350,7 @@ struct EncodingRecord
USHORT platformID; /* Platform ID. */
USHORT encodingID; /* Platform-specific encoding ID. */
LongOffsetTo<CmapSubtable>
OffsetTo<CmapSubtable, ULONG>
subtable; /* Byte offset from beginning of table to the subtable for this encoding. */
public:
DEFINE_SIZE_STATIC (8);

@ -506,7 +506,7 @@ struct Feature
if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)))
return TRACE_RETURN (false);
if (likely (!orig_offset))
if (likely (orig_offset.is_null ()))
return TRACE_RETURN (true);
if (featureParams == 0 && closure &&

Loading…
Cancel
Save