[libxml++] Remove some unnecessary #include and reinterpret_cast



commit 3b943c2b104be315a23154b89fc74d16bd53d4f3
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Oct 1 14:40:37 2015 +0200

    Remove some unnecessary #include and reinterpret_cast

 libxml++/attribute.cc                       |    2 --
 libxml++/attribute.h                        |    6 ------
 libxml++/attributenode.h                    |    6 ++++++
 libxml++/document.cc                        |    1 -
 libxml++/document.h                         |    7 ++++---
 libxml++/dtd.h                              |    2 ++
 libxml++/exceptions/internal_error.h        |    3 ---
 libxml++/exceptions/parse_error.h           |    3 ---
 libxml++/nodes/cdatanode.cc                 |    1 -
 libxml++/nodes/commentnode.cc               |    1 -
 libxml++/nodes/element.cc                   |    1 -
 libxml++/nodes/entityreference.cc           |    1 -
 libxml++/nodes/processinginstructionnode.cc |    1 -
 libxml++/nodes/textnode.cc                  |    1 -
 libxml++/parsers/domparser.h                |    3 +--
 libxml++/parsers/saxparser.h                |    2 +-
 libxml++/validators/relaxngvalidator.cc     |    2 +-
 libxml++/validators/xsdvalidator.cc         |    2 +-
 18 files changed, 16 insertions(+), 29 deletions(-)
---
diff --git a/libxml++/attribute.cc b/libxml++/attribute.cc
index 56f659a..18b1f44 100644
--- a/libxml++/attribute.cc
+++ b/libxml++/attribute.cc
@@ -5,7 +5,6 @@
  */
 
 #include "libxml++/attribute.h"
-#include "libxml++/attributedeclaration.h"
 
 #include <libxml/tree.h>
 
@@ -22,4 +21,3 @@ Attribute::~Attribute()
 }
 
 } //namespace xmlpp
-
diff --git a/libxml++/attribute.h b/libxml++/attribute.h
index 57193b9..8458f22 100644
--- a/libxml++/attribute.h
+++ b/libxml++/attribute.h
@@ -12,12 +12,6 @@
 
 #include <libxml++/nodes/node.h>
 
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-extern "C" {
-  struct _xmlAttr;
-}
-#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
 namespace xmlpp
 {
 
diff --git a/libxml++/attributenode.h b/libxml++/attributenode.h
index 435ba49..cc28114 100644
--- a/libxml++/attributenode.h
+++ b/libxml++/attributenode.h
@@ -12,6 +12,12 @@
 
 #include <libxml++/attribute.h>
 
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+extern "C" {
+  struct _xmlAttr;
+}
+#endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
 namespace xmlpp
 {
 
diff --git a/libxml++/document.cc b/libxml++/document.cc
index e8ddd74..fed1718 100644
--- a/libxml++/document.cc
+++ b/libxml++/document.cc
@@ -9,7 +9,6 @@
 
 #include <libxml++/document.h>
 #include <libxml++/dtd.h>
-#include <libxml++/attribute.h>
 #include <libxml++/nodes/element.h>
 #include <libxml++/exceptions/internal_error.h>
 #include <libxml++/keepblanks.h>
diff --git a/libxml++/document.h b/libxml++/document.h
index 07c25c2..722e883 100644
--- a/libxml++/document.h
+++ b/libxml++/document.h
@@ -48,12 +48,13 @@ typedef enum {
     XML_INTERNAL_PREDEFINED_ENTITY = 6
 } XmlEntityType;
 
-class Document;
-
 //TODO: Make Document inherit from Node, when we can break ABI one day?
 //
 //libxml might intend xmlDoc to derive (theoretically) from xmlNode.
-//This is suggested because the xmlNodeSet returned by xmlXPathEval (see the Node::find() implementation) 
can contain either xmlNode or xmlDocument elements.
+//This is suggested because the xmlNodeSet returned by xmlXPathEval (see the
+//Node::find() implementation) can contain either xmlNode or xmlDocument elements.
+// See https://bugzilla.gnome.org/show_bug.cgi?id=754673#c8 for an explanation
+// why it has not been done in libxml++ 3.0.
 /**
  * Represents an XML document in the DOM model.
  */
diff --git a/libxml++/dtd.h b/libxml++/dtd.h
index 30a6bfd..16e50cf 100644
--- a/libxml++/dtd.h
+++ b/libxml++/dtd.h
@@ -22,6 +22,8 @@ namespace xmlpp
 {
 
 //TODO: Derive from Node?
+// See https://bugzilla.gnome.org/show_bug.cgi?id=754673#c8 for an explanation
+// why it has not been done in libxml++ 3.0.
 /** Represents an XML DTD for validating XML files.
  * DTD = Document Type Definition
  */
diff --git a/libxml++/exceptions/internal_error.h b/libxml++/exceptions/internal_error.h
index 303109f..e43d452 100644
--- a/libxml++/exceptions/internal_error.h
+++ b/libxml++/exceptions/internal_error.h
@@ -22,9 +22,6 @@
 
 #include <libxml++/exceptions/exception.h>
 
-#include <exception>
-#include <glibmm/ustring.h>
-
 namespace xmlpp {
   
 class internal_error : public exception
diff --git a/libxml++/exceptions/parse_error.h b/libxml++/exceptions/parse_error.h
index 659b135..3b386d8 100644
--- a/libxml++/exceptions/parse_error.h
+++ b/libxml++/exceptions/parse_error.h
@@ -22,9 +22,6 @@
 
 #include <libxml++/exceptions/exception.h>
 
-#include <exception>
-#include <glibmm/ustring.h>
-
 namespace xmlpp
 {
 
diff --git a/libxml++/nodes/cdatanode.cc b/libxml++/nodes/cdatanode.cc
index 0955732..167d5af 100644
--- a/libxml++/nodes/cdatanode.cc
+++ b/libxml++/nodes/cdatanode.cc
@@ -5,7 +5,6 @@
  */
 
 #include <libxml++/nodes/cdatanode.h>
-#include <libxml++/exceptions/internal_error.h>
 
 #include <libxml/tree.h>
 
diff --git a/libxml++/nodes/commentnode.cc b/libxml++/nodes/commentnode.cc
index 046205c..aa066cf 100644
--- a/libxml++/nodes/commentnode.cc
+++ b/libxml++/nodes/commentnode.cc
@@ -5,7 +5,6 @@
  */
 
 #include <libxml++/nodes/commentnode.h>
-#include <libxml++/exceptions/internal_error.h>
 
 #include <libxml/tree.h>
 
diff --git a/libxml++/nodes/element.cc b/libxml++/nodes/element.cc
index d6b1df9..30e912c 100644
--- a/libxml++/nodes/element.cc
+++ b/libxml++/nodes/element.cc
@@ -6,7 +6,6 @@
 
 #include <libxml++/nodes/element.h>
 #include <libxml++/exceptions/internal_error.h>
-#include <libxml++/document.h>
 
 #include <libxml/tree.h>
 
diff --git a/libxml++/nodes/entityreference.cc b/libxml++/nodes/entityreference.cc
index d8e2f4d..3c35405 100644
--- a/libxml++/nodes/entityreference.cc
+++ b/libxml++/nodes/entityreference.cc
@@ -5,7 +5,6 @@
  */
 
 #include <libxml++/nodes/entityreference.h>
-#include <libxml++/exceptions/internal_error.h>
 
 #include <libxml/tree.h>
 
diff --git a/libxml++/nodes/processinginstructionnode.cc b/libxml++/nodes/processinginstructionnode.cc
index 074fce7..9c3d394 100644
--- a/libxml++/nodes/processinginstructionnode.cc
+++ b/libxml++/nodes/processinginstructionnode.cc
@@ -5,7 +5,6 @@
  */
 
 #include <libxml++/nodes/processinginstructionnode.h>
-#include <libxml++/exceptions/internal_error.h>
 
 #include <libxml/tree.h>
 
diff --git a/libxml++/nodes/textnode.cc b/libxml++/nodes/textnode.cc
index b640e02..d76a062 100644
--- a/libxml++/nodes/textnode.cc
+++ b/libxml++/nodes/textnode.cc
@@ -5,7 +5,6 @@
  */
 
 #include <libxml++/nodes/textnode.h>
-#include <libxml++/exceptions/internal_error.h>
 
 #include <libxml/tree.h>
 
diff --git a/libxml++/parsers/domparser.h b/libxml++/parsers/domparser.h
index df13a9c..bcf997c 100644
--- a/libxml++/parsers/domparser.h
+++ b/libxml++/parsers/domparser.h
@@ -8,13 +8,12 @@
 #define __LIBXMLPP_PARSERS_DOMPARSER_H
 
 #include <libxml++/parsers/parser.h>
-#include <libxml++/dtd.h>
 #include <libxml++/document.h>
 
 namespace xmlpp {
 
 /** DOM XML parser.
- *
+ * DOM = Document Object Model
  */
 class DomParser : public Parser
 {
diff --git a/libxml++/parsers/saxparser.h b/libxml++/parsers/saxparser.h
index c3aa1bf..83ce3a9 100644
--- a/libxml++/parsers/saxparser.h
+++ b/libxml++/parsers/saxparser.h
@@ -9,7 +9,6 @@
 
 #include <libxml++/parsers/parser.h>
 
-#include <list>
 #include <deque>
 #include <memory>
 #include "libxml++/document.h"
@@ -25,6 +24,7 @@ namespace xmlpp {
 
 /** SAX XML parser.
  * Derive your own class and override the on_*() methods.
+ * SAX = Simple API for XML
  */
 class SaxParser : public Parser
 {
diff --git a/libxml++/validators/relaxngvalidator.cc b/libxml++/validators/relaxngvalidator.cc
index 4cd9a9c..7eb1036 100644
--- a/libxml++/validators/relaxngvalidator.cc
+++ b/libxml++/validators/relaxngvalidator.cc
@@ -119,7 +119,7 @@ const RelaxNGSchema* RelaxNGValidator::get_schema() const
 
 RelaxNGValidator::operator bool() const noexcept
 {
-  return reinterpret_cast<const void*>(pimpl_->schema && pimpl_->schema->cobj());
+  return pimpl_->schema && pimpl_->schema->cobj();
 }
 
 
diff --git a/libxml++/validators/xsdvalidator.cc b/libxml++/validators/xsdvalidator.cc
index 9d496a0..ebe1c91 100644
--- a/libxml++/validators/xsdvalidator.cc
+++ b/libxml++/validators/xsdvalidator.cc
@@ -116,7 +116,7 @@ const XsdSchema* XsdValidator::get_schema() const
 
 XsdValidator::operator bool() const noexcept
 {
-  return reinterpret_cast<const void*>(pimpl_->schema && pimpl_->schema->cobj());
+  return pimpl_->schema && pimpl_->schema->cobj();
 }
 
 


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