diff options
author | Murray Cumming <murrayc@murrayc.com> | 2015-07-31 11:40:28 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2015-07-31 11:40:28 +0200 |
commit | 89e0d60963fffb66cbc7ef34dbfd5fbdf26f81c2 (patch) | |
tree | ca019ec52f8812b4837358302257721ee88e5ac9 | |
parent | a5a7306e033ab41eecff31f885d9fa9c85e15cb4 (diff) |
C++11: Use the override keyword.
-rw-r--r-- | examples/text/user-font.cc | 12 | ||||
-rw-r--r-- | tests/test-user-font.cc | 20 |
2 files changed, 16 insertions, 16 deletions
diff --git a/examples/text/user-font.cc b/examples/text/user-font.cc index 7836f5b..851887f 100644 --- a/examples/text/user-font.cc +++ b/examples/text/user-font.cc @@ -39,10 +39,10 @@ public: return Cairo::RefPtr<BoxFontFace>(new BoxFontFace()); } - virtual Cairo::ErrorStatus + Cairo::ErrorStatus init(const Cairo::RefPtr<Cairo::ScaledFont>& /*scaled_font*/, const Cairo::RefPtr<Cairo::Context>& /*cr*/, - Cairo::FontExtents &extents) + Cairo::FontExtents &extents) override { double max = 0; for (unsigned int i = 0; i < sizeof (glyphs) / sizeof (GlyphBounds); ++i) { @@ -55,9 +55,9 @@ public: return CAIRO_STATUS_SUCCESS; } - virtual Cairo::ErrorStatus + Cairo::ErrorStatus unicode_to_glyph (const Cairo::RefPtr<Cairo::ScaledFont>& /*scaled_font*/, - unsigned long unicode, unsigned long& glyph) + unsigned long unicode, unsigned long& glyph) override { glyph = 0; // yes this is a stupid an ineffienct way to do this but we only have a few @@ -72,11 +72,11 @@ public: return CAIRO_STATUS_SUCCESS; } - virtual Cairo::ErrorStatus + Cairo::ErrorStatus render_glyph(const Cairo::RefPtr<Cairo::ScaledFont>& /*scaled_font*/, unsigned long glyph, const Cairo::RefPtr<Cairo::Context>& cr, - Cairo::TextExtents& metrics) + Cairo::TextExtents& metrics) override { // check that the glyph is in our table if (glyph >= 1 && glyph <= sizeof(glyphs)/sizeof(GlyphBounds)) { diff --git a/tests/test-user-font.cc b/tests/test-user-font.cc index 75ae566..656bcfc 100644 --- a/tests/test-user-font.cc +++ b/tests/test-user-font.cc @@ -56,11 +56,11 @@ class ImplTextUserFont: public NullRenderUserFont { public: static RefPtr<ImplTextUserFont> create() { return RefPtr<ImplTextUserFont>(new ImplTextUserFont());}; - virtual ErrorStatus text_to_glyphs(const RefPtr<ScaledFont>& /*scaled_font*/, + ErrorStatus text_to_glyphs(const RefPtr<ScaledFont>& /*scaled_font*/, const std::string& /*utf8*/, std::vector<Glyph>& glyphs, std::vector<TextCluster>& /*clusters*/, - TextClusterFlags& /*cluster_flags*/) + TextClusterFlags& /*cluster_flags*/) override { ++count_text_to_glyphs; // return an arbitrary glyph @@ -91,9 +91,9 @@ class ImplUnicodeUserFont: public NullRenderUserFont { public: static RefPtr<ImplUnicodeUserFont> create() { return RefPtr<ImplUnicodeUserFont>(new ImplUnicodeUserFont());}; - virtual ErrorStatus unicode_to_glyph(const RefPtr<ScaledFont>& /*scaled_font*/, + ErrorStatus unicode_to_glyph(const RefPtr<ScaledFont>& /*scaled_font*/, unsigned long /*unicode*/, - unsigned long& /*glyph*/) + unsigned long& /*glyph*/) override { ++count_unicode_to_glyph; return CAIRO_STATUS_SUCCESS;} int count_unicode_to_glyph; @@ -118,17 +118,17 @@ class ImplBothUserFont: public NullRenderUserFont { public: static RefPtr<ImplBothUserFont> create() { return RefPtr<ImplBothUserFont>(new ImplBothUserFont());}; - virtual ErrorStatus unicode_to_glyph(const RefPtr<ScaledFont>& /*scaled_font*/, + ErrorStatus unicode_to_glyph(const RefPtr<ScaledFont>& /*scaled_font*/, unsigned long /*unicode*/, - unsigned long& /*glyph*/) + unsigned long& /*glyph*/) override { ++count_unicode_to_glyph; return CAIRO_STATUS_SUCCESS;} int count_unicode_to_glyph; - virtual ErrorStatus text_to_glyphs(const RefPtr<ScaledFont>& /*scaled_font*/, + ErrorStatus text_to_glyphs(const RefPtr<ScaledFont>& /*scaled_font*/, const std::string& /*utf8*/, std::vector<Glyph>& glyphs, std::vector<TextCluster>& /*clusters*/, - TextClusterFlags& /*cluster_flags*/) + TextClusterFlags& /*cluster_flags*/) override { ++count_text_to_glyphs; // return an arbitrary glyph @@ -185,7 +185,7 @@ public: static RefPtr<ImplInitUserFont> create() { return RefPtr<ImplInitUserFont>(new ImplInitUserFont());}; ErrorStatus init(const RefPtr<ScaledFont>& /*scaled_font*/, const RefPtr<Context>& /*cr*/, - FontExtents& /*extents*/) + FontExtents& /*extents*/) override {++count_init; return CAIRO_STATUS_SUCCESS;} int count_init; @@ -237,7 +237,7 @@ public: ErrorStatus init(const RefPtr<ScaledFont>& /*scaled_font*/, const RefPtr<Context>& /*cr*/, - FontExtents& /*extents*/) + FontExtents& /*extents*/) override { count_init++; if (m_flags & FLAG_INIT) |