Skip to content

Commit ce5da79

Browse files
committed
Add explicit keyword to some single-parameter constructors.
Noticed by cppcheck.
1 parent be996b0 commit ce5da79

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

examples/dom_update_namespace/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Tests
4343
class fail_exception : public std::exception
4444
{
4545
public:
46-
fail_exception(const std::string& msg) : msg_(msg) {}
46+
explicit fail_exception(const std::string& msg) : msg_(msg) {}
4747
~fail_exception() noexcept override {}
4848
const char* what() const noexcept override { return msg_.c_str(); }
4949

examples/sax_parser_build_dom/svgelement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Element : public xmlpp::Element
3232
{
3333
public:
3434

35-
Element(xmlNode* node);
35+
explicit Element(xmlNode* node);
3636
~Element() override;
3737

3838
// example custom methods

examples/sax_parser_build_dom/svggroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace SVG {
3030
class Group : public Element
3131
{
3232
public:
33-
Group(xmlNode* node)
33+
explicit Group(xmlNode* node)
3434
: Element(node)
3535
{}
3636
};

examples/sax_parser_build_dom/svgparser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace SVG {
3131
class Parser : public xmlpp::SaxParser
3232
{
3333
public:
34-
Parser(xmlpp::Document& document);
34+
explicit Parser(xmlpp::Document& document);
3535
~Parser() override;
3636

3737
protected:

examples/sax_parser_build_dom/svgpath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace SVG {
3131
class Path : public Element
3232
{
3333
public:
34-
Path(xmlNode* node)
34+
explicit Path(xmlNode* node)
3535
: Element(node)
3636
{}
3737

examples/textreader/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
struct indent {
3333
int depth_;
34-
indent(int depth): depth_(depth) {};
34+
explicit indent(int depth): depth_(depth) {};
3535
};
3636

3737
std::ostream & operator<<(std::ostream & o, indent const & in)

libxml++/parsers/textreader.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace xmlpp
1212
class TextReader::PropertyReader
1313
{
1414
public:
15-
PropertyReader(TextReader& owner)
15+
explicit PropertyReader(TextReader& owner)
1616
: owner_(owner)
1717
{}
1818

libxml++/relaxngschema.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace
3131
class RelaxNGSchemaParserContextHolder
3232
{
3333
public:
34-
RelaxNGSchemaParserContextHolder(xmlRelaxNGParserCtxtPtr ctx) noexcept : ctx_(ctx) {}
34+
explicit RelaxNGSchemaParserContextHolder(xmlRelaxNGParserCtxtPtr ctx) noexcept : ctx_(ctx) {}
3535
~RelaxNGSchemaParserContextHolder() { if (ctx_) xmlRelaxNGFreeParserCtxt(ctx_); }
3636

3737
private:

libxml++/xsdschema.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace
2929
class XsdSchemaParserContextHolder
3030
{
3131
public:
32-
XsdSchemaParserContextHolder(xmlSchemaParserCtxtPtr ctx) noexcept : ctx_(ctx) {}
32+
explicit XsdSchemaParserContextHolder(xmlSchemaParserCtxtPtr ctx) noexcept : ctx_(ctx) {}
3333
~XsdSchemaParserContextHolder() { if (ctx_) xmlSchemaFreeParserCtxt(ctx_); }
3434

3535
private:

0 commit comments

Comments
 (0)