[Coverage] Mark iterator methods const

This commit is contained in:
Behdad Esfahbod 2018-12-26 22:05:25 -05:00
parent 9df1a6eba7
commit 50cd26d394
1 changed files with 12 additions and 13 deletions

View File

@ -853,19 +853,18 @@ struct CoverageFormat1
template <typename set_t> template <typename set_t>
bool add_coverage (set_t *glyphs) const bool add_coverage (set_t *glyphs) const
{ { return glyphs->add_sorted_array (glyphArray.arrayZ, glyphArray.len); }
return glyphs->add_sorted_array (glyphArray.arrayZ, glyphArray.len);
}
public: public:
/* Older compilers need this to be public. */ /* Older compilers need this to be public. */
struct Iter { struct Iter
{
void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; } void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; }
void fini () {} void fini () {}
bool more () { return i < c->glyphArray.len; } bool more () const { return i < c->glyphArray.len; }
void next () { i++; } void next () { i++; }
hb_codepoint_t get_glyph () { return c->glyphArray[i]; } hb_codepoint_t get_glyph () const { return c->glyphArray[i]; }
unsigned int get_coverage () { return i; } unsigned int get_coverage () const { return i; }
private: private:
const struct CoverageFormat1 *c; const struct CoverageFormat1 *c;
@ -987,7 +986,7 @@ struct CoverageFormat2
} }
} }
void fini () {} void fini () {}
bool more () { return i < c->rangeRecord.len; } bool more () const { return i < c->rangeRecord.len; }
void next () void next ()
{ {
if (j >= c->rangeRecord[i].end) if (j >= c->rangeRecord[i].end)
@ -1010,8 +1009,8 @@ struct CoverageFormat2
coverage++; coverage++;
j++; j++;
} }
hb_codepoint_t get_glyph () { return j; } hb_codepoint_t get_glyph () const { return j; }
unsigned int get_coverage () { return coverage; } unsigned int get_coverage () const { return coverage; }
private: private:
const struct CoverageFormat2 *c; const struct CoverageFormat2 *c;
@ -1118,7 +1117,7 @@ struct Coverage
default: return; default: return;
} }
} }
bool more () bool more () const
{ {
switch (format) switch (format)
{ {
@ -1136,7 +1135,7 @@ struct Coverage
default: break; default: break;
} }
} }
hb_codepoint_t get_glyph () hb_codepoint_t get_glyph () const
{ {
switch (format) switch (format)
{ {
@ -1145,7 +1144,7 @@ struct Coverage
default:return 0; default:return 0;
} }
} }
unsigned int get_coverage () unsigned int get_coverage () const
{ {
switch (format) switch (format)
{ {