Convert boolean enum class consts to static constexpr

Part of https://github.com/harfbuzz/harfbuzz/issues/1553
This commit is contained in:
Behdad Esfahbod 2019-01-22 12:07:43 +01:00
parent 271cb7c1c0
commit 39e1b6d03f
6 changed files with 20 additions and 20 deletions

View File

@ -669,7 +669,7 @@ struct ClassTable
struct ObsoleteTypes struct ObsoleteTypes
{ {
enum { extended = false }; static constexpr bool extended = false;
typedef HBUINT16 HBUINT; typedef HBUINT16 HBUINT;
typedef HBUINT8 HBUSHORT; typedef HBUINT8 HBUSHORT;
typedef ClassTable<HBUINT8> ClassTypeNarrow; typedef ClassTable<HBUINT8> ClassTypeNarrow;
@ -699,7 +699,7 @@ struct ObsoleteTypes
}; };
struct ExtendedTypes struct ExtendedTypes
{ {
enum { extended = true }; static constexpr bool extended = true;
typedef HBUINT32 HBUINT; typedef HBUINT32 HBUINT;
typedef HBUINT16 HBUSHORT; typedef HBUINT16 HBUSHORT;
typedef Lookup<HBUINT16> ClassTypeNarrow; typedef Lookup<HBUINT16> ClassTypeNarrow;

View File

@ -210,7 +210,7 @@ struct KerxSubTableFormat1
struct driver_context_t struct driver_context_t
{ {
enum { in_place = true }; static constexpr bool in_place = true;
enum enum
{ {
DontAdvance = Format1EntryT::DontAdvance, DontAdvance = Format1EntryT::DontAdvance,
@ -471,7 +471,7 @@ struct KerxSubTableFormat4
struct driver_context_t struct driver_context_t
{ {
enum { in_place = true }; static constexpr bool in_place = true;
enum Flags enum Flags
{ {
Mark = 0x8000, /* If set, remember this glyph as the marked glyph. */ Mark = 0x8000, /* If set, remember this glyph as the marked glyph. */

View File

@ -54,7 +54,7 @@ struct RearrangementSubtable
struct driver_context_t struct driver_context_t
{ {
enum { in_place = true }; static constexpr bool in_place = true;
enum Flags enum Flags
{ {
MarkFirst = 0x8000, /* If set, make the current glyph the first MarkFirst = 0x8000, /* If set, make the current glyph the first
@ -204,7 +204,7 @@ struct ContextualSubtable
struct driver_context_t struct driver_context_t
{ {
enum { in_place = true }; static constexpr bool in_place = true;
enum Flags enum Flags
{ {
SetMark = 0x8000, /* If set, make the current glyph the marked glyph. */ SetMark = 0x8000, /* If set, make the current glyph the marked glyph. */
@ -425,7 +425,7 @@ struct LigatureSubtable
struct driver_context_t struct driver_context_t
{ {
enum { in_place = false }; static constexpr bool in_place = false;
enum enum
{ {
DontAdvance = LigatureEntryT::DontAdvance, DontAdvance = LigatureEntryT::DontAdvance,
@ -661,7 +661,7 @@ struct InsertionSubtable
struct driver_context_t struct driver_context_t
{ {
enum { in_place = false }; static constexpr bool in_place = false;
enum Flags enum Flags
{ {
SetMark = 0x8000, /* If set, mark the current glyph. */ SetMark = 0x8000, /* If set, mark the current glyph. */

View File

@ -553,26 +553,26 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o
struct HbOpOr struct HbOpOr
{ {
enum { passthru_left = true }; static constexpr bool passthru_left = true;
enum { passthru_right = true }; static constexpr bool passthru_right = true;
template <typename T> static void process (T &o, const T &a, const T &b) { o = a | b; } template <typename T> static void process (T &o, const T &a, const T &b) { o = a | b; }
}; };
struct HbOpAnd struct HbOpAnd
{ {
enum { passthru_left = false }; static constexpr bool passthru_left = false;
enum { passthru_right = false }; static constexpr bool passthru_right = false;
template <typename T> static void process (T &o, const T &a, const T &b) { o = a & b; } template <typename T> static void process (T &o, const T &a, const T &b) { o = a & b; }
}; };
struct HbOpMinus struct HbOpMinus
{ {
enum { passthru_left = true }; static constexpr bool passthru_left = true;
enum { passthru_right = false }; static constexpr bool passthru_right = false;
template <typename T> static void process (T &o, const T &a, const T &b) { o = a & ~b; } template <typename T> static void process (T &o, const T &a, const T &b) { o = a & ~b; }
}; };
struct HbOpXor struct HbOpXor
{ {
enum { passthru_left = true }; static constexpr bool passthru_left = true;
enum { passthru_right = true }; static constexpr bool passthru_right = true;
template <typename T> static void process (T &o, const T &a, const T &b) { o = a ^ b; } template <typename T> static void process (T &o, const T &a, const T &b) { o = a ^ b; }
}; };

View File

@ -160,7 +160,7 @@ struct KernSubTable
struct KernOTSubTableHeader struct KernOTSubTableHeader
{ {
enum { apple = false }; static constexpr bool apple = false;
typedef AAT::ObsoleteTypes Types; typedef AAT::ObsoleteTypes Types;
unsigned int tuple_count () const { return 0; } unsigned int tuple_count () const { return 0; }
@ -215,7 +215,7 @@ struct KernOT : AAT::KerxTable<KernOT>
struct KernAATSubTableHeader struct KernAATSubTableHeader
{ {
enum { apple = true }; static constexpr bool apple = true;
typedef AAT::ObsoleteTypes Types; typedef AAT::ObsoleteTypes Types;
unsigned int tuple_count () const { return 0; } unsigned int tuple_count () const { return 0; }

View File

@ -1300,7 +1300,7 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
struct GSUBProxy struct GSUBProxy
{ {
enum { table_index = 0u }; enum { table_index = 0u };
enum { inplace = false }; static constexpr bool inplace = false;
typedef OT::SubstLookup Lookup; typedef OT::SubstLookup Lookup;
GSUBProxy (hb_face_t *face) : GSUBProxy (hb_face_t *face) :
@ -1314,7 +1314,7 @@ struct GSUBProxy
struct GPOSProxy struct GPOSProxy
{ {
enum { table_index = 1u }; enum { table_index = 1u };
enum { inplace = true }; static constexpr bool inplace = true;
typedef OT::PosLookup Lookup; typedef OT::PosLookup Lookup;
GPOSProxy (hb_face_t *face) : GPOSProxy (hb_face_t *face) :