Skip to content

Commit 30730df

Browse files
author
Kjell Ahlstedt
committed
Examples: More use of override keyword
* examples/sax_parser_build_dom/svgparser.h: * examples/sax_parser_entities/myparser.h: Use the override keyword on all overridden virtual methods.
1 parent dcda6a1 commit 30730df

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

examples/sax_parser_build_dom/svgparser.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ class Parser : public xmlpp::SaxParser
3636

3737
protected:
3838
// SAX parser callbacks
39-
void on_start_document() {};
40-
void on_end_document() {};
39+
void on_start_document() override {};
40+
void on_end_document() override {};
4141
void on_start_element(const Glib::ustring& name,
42-
const AttributeList& properties);
43-
void on_end_element(const Glib::ustring& name);
44-
void on_characters(const Glib::ustring& characters);
45-
void on_comment(const Glib::ustring& text);
46-
void on_warning(const Glib::ustring& text);
47-
void on_error(const Glib::ustring& text);
48-
void on_fatal_error(const Glib::ustring& text);
49-
void on_cdata_block(const Glib::ustring& text);
42+
const AttributeList& properties) override;
43+
void on_end_element(const Glib::ustring& name) override;
44+
void on_characters(const Glib::ustring& characters) override;
45+
void on_comment(const Glib::ustring& text) override;
46+
void on_warning(const Glib::ustring& text) override;
47+
void on_error(const Glib::ustring& text) override;
48+
void on_fatal_error(const Glib::ustring& text) override;
49+
void on_cdata_block(const Glib::ustring& text) override;
5050

5151
private:
5252
// context is a stack to keep track of parent node while the SAX parser

examples/sax_parser_entities/myparser.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// -*- C++ -*-
2-
31
/* myparser.h
42
*
53
* Copyright (C) 2002 The libxml++ development team
@@ -34,8 +32,8 @@ class MySaxParser : public xmlpp::SaxParser
3432
//overrides:
3533
void on_start_document() override;
3634
void on_end_document() override;
37-
virtual void on_start_element(const Glib::ustring& name,
38-
const AttributeList& properties);
35+
void on_start_element(const Glib::ustring& name,
36+
const AttributeList& properties) override;
3937
void on_end_element(const Glib::ustring& name) override;
4038
void on_characters(const Glib::ustring& characters) override;
4139
void on_comment(const Glib::ustring& text) override;
@@ -44,8 +42,8 @@ class MySaxParser : public xmlpp::SaxParser
4442
void on_fatal_error(const Glib::ustring& text) override;
4543

4644
_xmlEntity* on_get_entity(const Glib::ustring& name) override;
47-
void on_entity_declaration(const Glib::ustring& name, xmlpp::XmlEntityType type, const Glib::ustring& publicId, const Glib::ustring& systemId, const Glib::ustring& content) override;
45+
void on_entity_declaration(const Glib::ustring& name, xmlpp::XmlEntityType type,
46+
const Glib::ustring& publicId, const Glib::ustring& systemId, const Glib::ustring& content) override;
4847
};
4948

50-
5149
#endif //__LIBXMLPP_EXAMPLES_MYPARSER_H

0 commit comments

Comments
 (0)