[HB] Remove clumsy macros and improve API
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 494a99d..26c1cac 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -52,99 +52,6 @@
/*
- * Array types
- */
-
-/* get_len() is a method returning the number of items in an array-like object */
-#define DEFINE_LEN(Type, array, num) \
- inline unsigned int get_len(void) const { return num; } \
-
-/* An array type is one that contains a variable number of objects
- * as its last item. An array object is extended with get_len()
- * methods, as well as overloaded [] operator. */
-#define DEFINE_ARRAY_TYPE(Type, array, num) \
- DEFINE_INDEX_OPERATOR(Type, array, num) \
- DEFINE_LEN(Type, array, num)
-#define DEFINE_INDEX_OPERATOR(Type, array, num) \
- inline const Type& operator[] (unsigned int i) const \
- { \
- if (HB_UNLIKELY (i >= num)) return Null(Type); \
- return array[i]; \
- }
-
-/* An offset array type is like an array type, but it contains a table
- * of offsets to the objects, relative to the beginning of the current
- * object. */
-#define DEFINE_OFFSET_ARRAY_TYPE(Type, array, num) \
- DEFINE_OFFSET_INDEX_OPERATOR(Type, array, num) \
- DEFINE_LEN(Offset, array, num)
-#define DEFINE_OFFSET_INDEX_OPERATOR(Type, array, num) \
- inline const Type& operator[] (unsigned int i) const \
- { \
- if (HB_UNLIKELY (i >= num)) return Null(Type); \
- if (HB_UNLIKELY (!array[i])) return Null(Type); \
- return *(const Type)((const char*)this + array[i]); \
- }
-
-
-#define DEFINE_ARRAY_INTERFACE(Type, name) \
- inline const Type& get_##name (unsigned int i) const { return (*this)[i]; } \
- inline unsigned int get_##name##_count (void) const { return this->get_len (); }
-#define DEFINE_INDEX_ARRAY_INTERFACE(name) \
- inline unsigned int get_##name##_index (unsigned int i) const \
- { \
- if (HB_UNLIKELY (i >= get_len ())) return NO_INDEX; \
- return (*this)[i]; \
- } \
- inline unsigned int get_##name##_count (void) const { return get_len (); }
-
-
-/*
- * List types
- */
-
-#define DEFINE_LIST_INTERFACE(Type, name) \
- inline const Type& get_##name (unsigned int i) const { return (this+name##List)[i]; } \
- inline unsigned int get_##name##_count (void) const { return (this+name##List).len; }
-
-
-/*
- * Tag types
- */
-
-#define DEFINE_TAG_ARRAY_INTERFACE(Type, name) \
- DEFINE_ARRAY_INTERFACE (Type, name); \
- inline const Tag& get_##name##_tag (unsigned int i) const { return (*this)[i].tag; }
-#define DEFINE_TAG_LIST_INTERFACE(Type, name) \
- DEFINE_LIST_INTERFACE (Type, name); \
- inline const Tag& get_##name##_tag (unsigned int i) const { return (this+name##List).get_tag (i); }
-
-#define DEFINE_TAG_FIND_INTERFACE(Type, name) \
- inline bool find_##name##_index (hb_tag_t tag, unsigned int *index) const { \
- const Tag t = tag; \
- for (unsigned int i = 0; i < get_##name##_count (); i++) \
- { \
- if (t == get_##name##_tag (i)) \
- { \
- if (index) *index = i; \
- return true; \
- } \
- } \
- if (index) *index = NO_INDEX; \
- return false; \
- } \
- inline const Type& get_##name##_by_tag (hb_tag_t tag) const \
- { \
- unsigned int i; \
- if (find_##name##_index (tag, &i)) \
- return get_##name (i); \
- else \
- return Null(Type); \
- }
-
-
-
-/*
* Class features
*/
@@ -379,13 +286,7 @@
/*
*
- * The OpenType Font File
- *
- */
-
-
-/*
- * Data Types
+ * The OpenType Font File: Data Types
*/
@@ -433,6 +334,7 @@
DEFINE_INT_TYPE (ULONG, u, 32); /* 32-bit unsigned integer. */
DEFINE_INT_TYPE (LONG, , 32); /* 32-bit signed integer. */
+
/* Array of four uint8s (length = 32 bits) used to identify a script, language
* system, feature, or baseline */
struct Tag : ULONG
@@ -550,6 +452,8 @@
template <typename Type>
struct LongOffsetTo : GenericOffsetTo<LongOffset, Type> {};
+
+
/*
* Array Types
*/