Convert tag 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:08:57 +01:00
parent 39e1b6d03f
commit ef00654962
41 changed files with 56 additions and 56 deletions

View File

@ -74,7 +74,7 @@ struct FontDescriptor
struct fdsc
{
enum { tableTag = HB_AAT_TAG_fdsc };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_fdsc;
enum {
Weight = HB_TAG ('w','g','h','t'),

View File

@ -58,7 +58,7 @@ typedef LArrayOf<Anchor> GlyphAnchors;
struct ankr
{
enum { tableTag = HB_AAT_TAG_ankr };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_ankr;
const Anchor &get_anchor (hb_codepoint_t glyph_id,
unsigned int i,

View File

@ -116,7 +116,7 @@ struct BaselineTableFormat3Part
struct bsln
{
enum { tableTag = HB_AAT_TAG_bsln };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_bsln;
bool sanitize (hb_sanitize_context_t *c) const
{

View File

@ -154,7 +154,7 @@ struct FeatureName
struct feat
{
enum { tableTag = HB_AAT_TAG_feat };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_feat;
bool has_data () const { return version.to_int (); }

View File

@ -382,7 +382,7 @@ struct JustificationHeader
struct just
{
enum { tableTag = HB_AAT_TAG_just };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_just;
bool sanitize (hb_sanitize_context_t *c) const
{

View File

@ -979,7 +979,7 @@ struct kerx : KerxTable<kerx>
{
friend struct KerxTable<kerx>;
enum { tableTag = HB_AAT_TAG_kerx };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_kerx;
enum { minVersion = 2u };
typedef KerxSubTableHeader SubTableHeader;

View File

@ -40,7 +40,7 @@ typedef ArrayOf<HBINT16> LigCaretClassEntry;
struct lcar
{
enum { tableTag = HB_AAT_TAG_lcar };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_lcar;
unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,

View File

@ -1097,7 +1097,7 @@ struct Chain
template <typename Types>
struct mortmorx
{
enum { tableTag = HB_AAT_TAG_morx };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_morx;
bool has_data () const { return version != 0; }
@ -1159,11 +1159,11 @@ struct mortmorx
struct morx : mortmorx<ExtendedTypes>
{
enum { tableTag = HB_AAT_TAG_morx };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_morx;
};
struct mort : mortmorx<ObsoleteTypes>
{
enum { tableTag = HB_AAT_TAG_mort };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_mort;
};

View File

@ -160,7 +160,7 @@ struct TrackData
struct trak
{
enum { tableTag = HB_AAT_TAG_trak };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_trak;
bool has_data () const { return version.to_int (); }

View File

@ -60,7 +60,7 @@ struct FTStringRange
struct ltag
{
enum { tableTag = HB_AAT_TAG_ltag };
static constexpr hb_tag_t tableTag = HB_AAT_TAG_ltag;
hb_language_t get_language (unsigned int i) const
{

View File

@ -984,7 +984,7 @@ using namespace CFF;
struct cff1
{
enum { tableTag = HB_OT_TAG_cff1 };
static constexpr hb_tag_t tableTag = HB_OT_TAG_cff1;
bool sanitize (hb_sanitize_context_t *c) const
{

View File

@ -408,7 +408,7 @@ using namespace CFF;
struct cff2
{
enum { tableTag = HB_OT_TAG_cff2 };
static constexpr hb_tag_t tableTag = HB_OT_TAG_cff2;
bool sanitize (hb_sanitize_context_t *c) const
{

View File

@ -841,7 +841,7 @@ struct EncodingRecord
struct cmap
{
enum { tableTag = HB_OT_TAG_cmap };
static constexpr hb_tag_t tableTag = HB_OT_TAG_cmap;
struct subset_plan
{

View File

@ -332,7 +332,7 @@ struct CBLC
{
friend struct CBDT;
enum { tableTag = HB_OT_TAG_CBLC };
static constexpr hb_tag_t tableTag = HB_OT_TAG_CBLC;
bool sanitize (hb_sanitize_context_t *c) const
{
@ -378,7 +378,7 @@ struct CBLC
struct CBDT
{
enum { tableTag = HB_OT_TAG_CBDT };
static constexpr hb_tag_t tableTag = HB_OT_TAG_CBDT;
struct accelerator_t
{

View File

@ -87,7 +87,7 @@ struct BaseGlyphRecord
struct COLR
{
enum { tableTag = HB_OT_TAG_COLR };
static constexpr hb_tag_t tableTag = HB_OT_TAG_COLR;
bool has_data () const { return numBaseGlyphs; }

View File

@ -107,7 +107,7 @@ typedef HBUINT32 BGRAColor;
struct CPAL
{
enum { tableTag = HB_OT_TAG_CPAL };
static constexpr hb_tag_t tableTag = HB_OT_TAG_CPAL;
bool has_data () const { return numPalettes; }

View File

@ -130,7 +130,7 @@ struct SBIXStrike
struct sbix
{
enum { tableTag = HB_OT_TAG_sbix };
static constexpr hb_tag_t tableTag = HB_OT_TAG_sbix;
bool has_data () const { return version; }

View File

@ -73,7 +73,7 @@ struct SVGDocumentIndexEntry
struct SVG
{
enum { tableTag = HB_OT_TAG_SVG };
static constexpr hb_tag_t tableTag = HB_OT_TAG_SVG;
bool has_data () const { return svgDocEntries; }

View File

@ -57,7 +57,7 @@ struct GaspRange
struct gasp
{
enum { tableTag = HB_OT_TAG_gasp };
static constexpr hb_tag_t tableTag = HB_OT_TAG_gasp;
const GaspRange &get_gasp_range (unsigned int i) const
{ return gaspRanges[i]; }

View File

@ -45,7 +45,7 @@ struct loca
{
friend struct glyf;
enum { tableTag = HB_OT_TAG_loca };
static constexpr hb_tag_t tableTag = HB_OT_TAG_loca;
bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
{
@ -71,7 +71,7 @@ struct loca
struct glyf
{
enum { tableTag = HB_OT_TAG_glyf };
static constexpr hb_tag_t tableTag = HB_OT_TAG_glyf;
bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
{

View File

@ -119,7 +119,7 @@ struct DeviceRecord
struct hdmx
{
enum { tableTag = HB_OT_TAG_hdmx };
static constexpr hb_tag_t tableTag = HB_OT_TAG_hdmx;
unsigned int get_size () const
{ return min_size + numRecords * sizeDeviceRecord; }

View File

@ -45,7 +45,7 @@ struct head
{
friend struct OffsetTable;
enum { tableTag = HB_OT_TAG_head };
static constexpr hb_tag_t tableTag = HB_OT_TAG_head;
unsigned int get_upem () const
{

View File

@ -86,10 +86,10 @@ struct _hea
};
struct hhea : _hea<hhea> {
enum { tableTag = HB_OT_TAG_hhea };
static constexpr hb_tag_t tableTag = HB_OT_TAG_hhea;
};
struct vhea : _hea<vhea> {
enum { tableTag = HB_OT_TAG_vhea };
static constexpr hb_tag_t tableTag = HB_OT_TAG_vhea;
};

View File

@ -323,14 +323,14 @@ struct hmtxvmtx
};
struct hmtx : hmtxvmtx<hmtx, hhea> {
enum { tableTag = HB_OT_TAG_hmtx };
enum { variationsTag = HB_OT_TAG_HVAR };
enum { os2Tag = HB_OT_TAG_OS2 };
static constexpr hb_tag_t tableTag = HB_OT_TAG_hmtx;
static constexpr hb_tag_t variationsTag = HB_OT_TAG_HVAR;
static constexpr hb_tag_t os2Tag = HB_OT_TAG_OS2;
};
struct vmtx : hmtxvmtx<vmtx, vhea> {
enum { tableTag = HB_OT_TAG_vmtx };
enum { variationsTag = HB_OT_TAG_VVAR };
enum { os2Tag = HB_TAG_NONE };
static constexpr hb_tag_t tableTag = HB_OT_TAG_vmtx;
static constexpr hb_tag_t variationsTag = HB_OT_TAG_VVAR;
static constexpr hb_tag_t os2Tag = HB_TAG_NONE;
};
struct hmtx_accelerator_t : hmtx::accelerator_t {};

View File

@ -197,7 +197,7 @@ struct KernOT : AAT::KerxTable<KernOT>
{
friend struct AAT::KerxTable<KernOT>;
enum { tableTag = HB_OT_TAG_kern };
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
enum { minVersion = 0u };
typedef KernOTSubTableHeader SubTableHeader;
@ -252,7 +252,7 @@ struct KernAAT : AAT::KerxTable<KernAAT>
{
friend struct AAT::KerxTable<KernAAT>;
enum { tableTag = HB_OT_TAG_kern };
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
enum { minVersion = 0x00010000u };
typedef KernAATSubTableHeader SubTableHeader;
@ -269,7 +269,7 @@ struct KernAAT : AAT::KerxTable<KernAAT>
struct kern
{
enum { tableTag = HB_OT_TAG_kern };
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
bool has_data () const { return u.version32; }
unsigned int get_type () const { return u.major; }

View File

@ -464,7 +464,7 @@ struct Axis
struct BASE
{
enum { tableTag = HB_OT_TAG_BASE };
static constexpr hb_tag_t tableTag = HB_OT_TAG_BASE;
const Axis &get_axis (hb_direction_t direction) const
{ return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; }

View File

@ -341,7 +341,7 @@ struct MarkGlyphSets
struct GDEF
{
enum { tableTag = HB_OT_TAG_GDEF };
static constexpr hb_tag_t tableTag = HB_OT_TAG_GDEF;
enum GlyphClasses {
UnclassifiedGlyph = 0,

View File

@ -1601,7 +1601,7 @@ struct PosLookup : Lookup
struct GPOS : GSUBGPOS
{
enum { tableTag = HB_OT_TAG_GPOS };
static constexpr hb_tag_t tableTag = HB_OT_TAG_GPOS;
const PosLookup& get_lookup (unsigned int i) const
{ return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }

View File

@ -1410,7 +1410,7 @@ struct SubstLookup : Lookup
struct GSUB : GSUBGPOS
{
enum { tableTag = HB_OT_TAG_GSUB };
static constexpr hb_tag_t tableTag = HB_OT_TAG_GSUB;
const SubstLookup& get_lookup (unsigned int i) const
{ return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }

View File

@ -195,7 +195,7 @@ struct JstfScript
struct JSTF
{
enum { tableTag = HB_OT_TAG_JSTF };
static constexpr hb_tag_t tableTag = HB_OT_TAG_JSTF;
unsigned int get_script_count () const
{ return scriptList.len; }

View File

@ -679,7 +679,7 @@ struct MathVariants
struct MATH
{
enum { tableTag = HB_OT_TAG_MATH };
static constexpr hb_tag_t tableTag = HB_OT_TAG_MATH;
bool has_data () const { return version.to_int (); }

View File

@ -71,7 +71,7 @@ struct maxpV1Tail
struct maxp
{
enum { tableTag = HB_OT_TAG_maxp };
static constexpr hb_tag_t tableTag = HB_OT_TAG_maxp;
unsigned int get_num_glyphs () const { return numGlyphs; }

View File

@ -151,7 +151,7 @@ _hb_ot_name_entry_cmp (const void *pa, const void *pb)
struct name
{
enum { tableTag = HB_OT_TAG_name };
static constexpr hb_tag_t tableTag = HB_OT_TAG_name;
unsigned int get_size () const
{ return min_size + count * nameRecordZ.item_size; }

View File

@ -92,7 +92,7 @@ struct OS2V5Tail
struct OS2
{
enum { tableTag = HB_OT_TAG_OS2 };
static constexpr hb_tag_t tableTag = HB_OT_TAG_OS2;
bool has_data () const { return this != &Null (OS2); }

View File

@ -71,7 +71,7 @@ struct postV2Tail
struct post
{
enum { tableTag = HB_OT_TAG_post };
static constexpr hb_tag_t tableTag = HB_OT_TAG_post;
bool subset (hb_subset_plan_t *plan) const
{

View File

@ -225,7 +225,7 @@ struct StatAxisRecord
struct STAT
{
enum { tableTag = HB_OT_TAG_STAT };
static constexpr hb_tag_t tableTag = HB_OT_TAG_STAT;
bool sanitize (hb_sanitize_context_t *c) const
{

View File

@ -99,7 +99,7 @@ struct SegmentMaps : ArrayOf<AxisValueMap>
struct avar
{
enum { tableTag = HB_OT_TAG_avar };
static constexpr hb_tag_t tableTag = HB_OT_TAG_avar;
bool sanitize (hb_sanitize_context_t *c) const
{

View File

@ -96,7 +96,7 @@ struct AxisRecord
struct fvar
{
enum { tableTag = HB_OT_TAG_fvar };
static constexpr hb_tag_t tableTag = HB_OT_TAG_fvar;
bool has_data () const { return version.to_int (); }

View File

@ -100,8 +100,8 @@ struct DeltaSetIndexMap
struct HVARVVAR
{
enum { HVARTag = HB_OT_TAG_HVAR };
enum { VVARTag = HB_OT_TAG_VVAR };
static constexpr hb_tag_t HVARTag = HB_OT_TAG_HVAR;
static constexpr hb_tag_t VVARTag = HB_OT_TAG_VVAR;
bool sanitize (hb_sanitize_context_t *c) const
{
@ -140,10 +140,10 @@ struct HVARVVAR
};
struct HVAR : HVARVVAR {
enum { tableTag = HB_OT_TAG_HVAR };
static constexpr hb_tag_t tableTag = HB_OT_TAG_HVAR;
};
struct VVAR : HVARVVAR {
enum { tableTag = HB_OT_TAG_VVAR };
static constexpr hb_tag_t tableTag = HB_OT_TAG_VVAR;
bool sanitize (hb_sanitize_context_t *c) const
{

View File

@ -58,7 +58,7 @@ struct VariationValueRecord
struct MVAR
{
enum { tableTag = HB_OT_TAG_MVAR };
static constexpr hb_tag_t tableTag = HB_OT_TAG_MVAR;
bool sanitize (hb_sanitize_context_t *c) const
{

View File

@ -57,7 +57,7 @@ struct VertOriginMetric
struct VORG
{
enum { tableTag = HB_OT_TAG_VORG };
static constexpr hb_tag_t tableTag = HB_OT_TAG_VORG;
bool has_data () const { return version.to_int (); }