[libxml++] Add explicit keyword to some single-parameter constructors.



commit c8d8f5883b1339b0c1118ca90df1e8a64c5b8029
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Dec 12 09:12:28 2016 +0100

    Add explicit keyword to some single-parameter constructors.
    
    Noticed by cppcheck.

 examples/dom_update_namespace/main.cc      |    2 +-
 examples/sax_parser_build_dom/svgelement.h |    2 +-
 examples/sax_parser_build_dom/svggroup.h   |    2 +-
 examples/sax_parser_build_dom/svgparser.h  |    2 +-
 examples/sax_parser_build_dom/svgpath.h    |    2 +-
 examples/textreader/main.cc                |    2 +-
 libxml++/parsers/textreader.cc             |    2 +-
 libxml++/relaxngschema.cc                  |    2 +-
 libxml++/xsdschema.cc                      |    2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/examples/dom_update_namespace/main.cc b/examples/dom_update_namespace/main.cc
index ed46041..3c47a4a 100644
--- a/examples/dom_update_namespace/main.cc
+++ b/examples/dom_update_namespace/main.cc
@@ -43,7 +43,7 @@ class Tests
 class fail_exception : public std::exception
 {
   public:
-    fail_exception(const std::string& msg) : msg_(msg) {}
+    explicit fail_exception(const std::string& msg) : msg_(msg) {}
     ~fail_exception() noexcept override {}
     const char* what() const noexcept override { return msg_.c_str(); }
 
diff --git a/examples/sax_parser_build_dom/svgelement.h b/examples/sax_parser_build_dom/svgelement.h
index 0440b14..963c0f6 100644
--- a/examples/sax_parser_build_dom/svgelement.h
+++ b/examples/sax_parser_build_dom/svgelement.h
@@ -32,7 +32,7 @@ class Element : public xmlpp::Element
 {
 public:
 
-  Element(xmlNode* node);
+  explicit Element(xmlNode* node);
   ~Element() override;
 
   // example custom methods
diff --git a/examples/sax_parser_build_dom/svggroup.h b/examples/sax_parser_build_dom/svggroup.h
index e0c6de8..3502ad4 100644
--- a/examples/sax_parser_build_dom/svggroup.h
+++ b/examples/sax_parser_build_dom/svggroup.h
@@ -30,7 +30,7 @@ namespace SVG {
 class Group : public Element
 {
 public:
-  Group(xmlNode* node)
+  explicit Group(xmlNode* node)
     : Element(node)
     {}
 };
diff --git a/examples/sax_parser_build_dom/svgparser.h b/examples/sax_parser_build_dom/svgparser.h
index 27ce4ea..60b591f 100644
--- a/examples/sax_parser_build_dom/svgparser.h
+++ b/examples/sax_parser_build_dom/svgparser.h
@@ -31,7 +31,7 @@ namespace SVG {
 class Parser : public xmlpp::SaxParser
 {
 public:
-  Parser(xmlpp::Document& document);
+  explicit Parser(xmlpp::Document& document);
   ~Parser() override;
 
 protected:
diff --git a/examples/sax_parser_build_dom/svgpath.h b/examples/sax_parser_build_dom/svgpath.h
index 854e13c..9648e20 100644
--- a/examples/sax_parser_build_dom/svgpath.h
+++ b/examples/sax_parser_build_dom/svgpath.h
@@ -31,7 +31,7 @@ namespace SVG {
 class Path : public Element
 {
 public:
-  Path(xmlNode* node)
+  explicit Path(xmlNode* node)
     : Element(node)
     {}
 
diff --git a/examples/textreader/main.cc b/examples/textreader/main.cc
index 5b97f32..adc78e4 100644
--- a/examples/textreader/main.cc
+++ b/examples/textreader/main.cc
@@ -31,7 +31,7 @@
 
 struct indent {
   int depth_;
-  indent(int depth): depth_(depth) {};
+  explicit indent(int depth): depth_(depth) {};
 };
 
 std::ostream & operator<<(std::ostream & o, indent const & in)
diff --git a/libxml++/parsers/textreader.cc b/libxml++/parsers/textreader.cc
index 66958a9..ef2f8b9 100644
--- a/libxml++/parsers/textreader.cc
+++ b/libxml++/parsers/textreader.cc
@@ -12,7 +12,7 @@ namespace xmlpp
 class TextReader::PropertyReader
 {
 public:
-  PropertyReader(TextReader& owner)
+  explicit PropertyReader(TextReader& owner)
   : owner_(owner)
   {}
 
diff --git a/libxml++/relaxngschema.cc b/libxml++/relaxngschema.cc
index 4e44f41..3804f12 100644
--- a/libxml++/relaxngschema.cc
+++ b/libxml++/relaxngschema.cc
@@ -31,7 +31,7 @@ namespace
   class RelaxNGSchemaParserContextHolder
   {
   public:
-    RelaxNGSchemaParserContextHolder(xmlRelaxNGParserCtxtPtr ctx) noexcept : ctx_(ctx) {}
+    explicit RelaxNGSchemaParserContextHolder(xmlRelaxNGParserCtxtPtr ctx) noexcept : ctx_(ctx) {}
     ~RelaxNGSchemaParserContextHolder() { if (ctx_) xmlRelaxNGFreeParserCtxt(ctx_); }
 
   private:
diff --git a/libxml++/xsdschema.cc b/libxml++/xsdschema.cc
index c91ef37..7e13f2e 100644
--- a/libxml++/xsdschema.cc
+++ b/libxml++/xsdschema.cc
@@ -29,7 +29,7 @@ namespace
   class XsdSchemaParserContextHolder
   {
   public:
-    XsdSchemaParserContextHolder(xmlSchemaParserCtxtPtr ctx) noexcept : ctx_(ctx) {}
+    explicit XsdSchemaParserContextHolder(xmlSchemaParserCtxtPtr ctx) noexcept : ctx_(ctx) {}
     ~XsdSchemaParserContextHolder() { if (ctx_) xmlSchemaFreeParserCtxt(ctx_); }
 
   private:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]