[libxml++/libxml++-2-40] Use nullptr instead of 0 at missing places - C++-11



commit 737e638a78b219de3cab01382dd3e825020dbba9
Author: Gaurav Gupta <g gupta samsung com>
Date:   Thu Oct 8 12:59:47 2015 +0530

    Use nullptr instead of 0 at missing places - C++-11

 libxml++/document.cc           |    6 +++---
 libxml++/nodes/element.cc      |   28 ++++++++++++++--------------
 libxml++/nodes/node.cc         |   12 ++++++------
 libxml++/parsers/textreader.cc |    4 ++--
 4 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/libxml++/document.cc b/libxml++/document.cc
index e4f5c1c..739bbc5 100644
--- a/libxml++/document.cc
+++ b/libxml++/document.cc
@@ -202,7 +202,7 @@ Dtd* Document::get_internal_subset() const
 {
   auto dtd = xmlGetIntSubset(impl_);
   if(!dtd)
-    return 0;
+    return nullptr;
 
   if(!dtd->_private)
     dtd->_private = new Dtd(dtd);
@@ -227,7 +227,7 @@ Element* Document::get_root_node() const
 {
   auto root = xmlDocGetRootElement(impl_);
   if(root == nullptr)
-    return 0;
+    return nullptr;
   else
   {
     Node::create_wrapper(root);
@@ -266,7 +266,7 @@ Element* Document::create_root_node_by_import(const Node* node,
                                              bool recursive)
 {
   if (!node)
-    return 0;
+    return nullptr;
 
   //Create the node, by copying:
   auto imported_node = xmlDocCopyNode(const_cast<xmlNode*>(node->cobj()), impl_, recursive);
diff --git a/libxml++/nodes/element.cc b/libxml++/nodes/element.cc
index a2a4f55..23cb41a 100644
--- a/libxml++/nodes/element.cc
+++ b/libxml++/nodes/element.cc
@@ -47,7 +47,7 @@ Attribute* Element::get_attribute(const Glib::ustring& name,
   {
     ns_uri = get_namespace_uri_for_prefix(ns_prefix);
     if (ns_uri.empty())
-      return 0; // No such prefix.
+      return nullptr; // No such prefix.
   }
 
   // The return value of xmlHasNsProp() may be either an xmlAttr*, pointing to an
@@ -55,14 +55,14 @@ Attribute* Element::get_attribute(const Glib::ustring& name,
   // cast to an xmlAttr*, pointing to the declaration of an attribute with a
   // default value (XML_ATTRIBUTE_DECL).
   auto attr = xmlHasNsProp(const_cast<xmlNode*>(cobj()), (const xmlChar*)name.c_str(),
-                               ns_uri.empty() ? 0 : (const xmlChar*)ns_uri.c_str());
+                               ns_uri.empty() ? nullptr : (const xmlChar*)ns_uri.c_str());
   if (attr)
   {
     Node::create_wrapper(reinterpret_cast<xmlNode*>(attr));
     return reinterpret_cast<Attribute*>(attr->_private);
   }
 
-  return 0;
+  return nullptr;
 }
 
 Glib::ustring Element::get_attribute_value(const Glib::ustring& name, const Glib::ustring& ns_prefix) const
@@ -102,7 +102,7 @@ Attribute* Element::set_attribute(const Glib::ustring& name, const Glib::ustring
     return reinterpret_cast<Attribute*>(attr->_private);
   }
   else
-    return 0;
+    return nullptr;
 }
 
 void Element::remove_attribute(const Glib::ustring& name, const Glib::ustring& ns_prefix)
@@ -127,7 +127,7 @@ const TextNode* Element::get_child_text() const
        return static_cast<TextNode*>(child->_private);
      }
 
-  return 0;
+  return nullptr;
 }
 
 TextNode* Element::get_child_text()
@@ -141,7 +141,7 @@ TextNode* Element::get_child_text()
        return static_cast<TextNode*>(child->_private);
      }
 
-  return 0;
+  return nullptr;
 }
 
 void Element::set_child_text(const Glib::ustring& content)
@@ -169,13 +169,13 @@ TextNode* Element::add_child_text(const Glib::ustring& content)
     Node::create_wrapper(node);
     return static_cast<TextNode*>(node->_private);
   }
-  return 0;
+  return nullptr;
 }
 
 TextNode* Element::add_child_text(xmlpp::Node* previous_sibling, const Glib::ustring& content)
 {
   if(!previous_sibling)
-    return 0;
+    return nullptr;
 
   if(cobj()->type == XML_ELEMENT_NODE)
   {
@@ -191,13 +191,13 @@ TextNode* Element::add_child_text(xmlpp::Node* previous_sibling, const Glib::ust
     Node::create_wrapper(node);
     return static_cast<TextNode*>(node->_private);
   }
-  return 0;
+  return nullptr;
 }
 
 TextNode* Element::add_child_text_before(xmlpp::Node* next_sibling, const Glib::ustring& content)
 {
   if(!next_sibling)
-    return 0;
+    return nullptr;
 
   if(cobj()->type == XML_ELEMENT_NODE)
   {
@@ -213,7 +213,7 @@ TextNode* Element::add_child_text_before(xmlpp::Node* next_sibling, const Glib::
     Node::create_wrapper(node);
     return static_cast<TextNode*>(node->_private);
   }
-  return 0;
+  return nullptr;
 }
 
 bool Element::has_child_text() const
@@ -224,13 +224,13 @@ bool Element::has_child_text() const
 void Element::set_namespace_declaration(const Glib::ustring& ns_uri, const Glib::ustring& ns_prefix)
 {
   //Create a new namespace declaration for this element:
-  auto ns = xmlNewNs(cobj(), (const xmlChar*)(ns_uri.empty() ? 0 : ns_uri.c_str()),
-                       (const xmlChar*)(ns_prefix.empty() ? 0 : ns_prefix.c_str()) );
+  auto ns = xmlNewNs(cobj(), (const xmlChar*)(ns_uri.empty() ? nullptr : ns_uri.c_str()),
+                       (const xmlChar*)(ns_prefix.empty() ? nullptr : ns_prefix.c_str()) );
   if (!ns)
   {
     // Not an error, if we try to assign the same uri to the prefix once again.
     ns = xmlSearchNs(cobj()->doc, cobj(),
-                     (const xmlChar*)(ns_prefix.empty() ? 0 : ns_prefix.c_str()));
+                     (const xmlChar*)(ns_prefix.empty() ? nullptr : ns_prefix.c_str()));
     const char* const previous_href = (ns && ns->href) ? (const char*)ns->href : "";
     if (!ns || ns_uri != previous_href)
       throw exception("Could not add namespace declaration with URI=" + ns_uri +
diff --git a/libxml++/nodes/node.cc b/libxml++/nodes/node.cc
index cd3263e..4cf7184 100644
--- a/libxml++/nodes/node.cc
+++ b/libxml++/nodes/node.cc
@@ -148,7 +148,7 @@ const Element* Node::get_parent() const
 Element* Node::get_parent()
 {
   if(!(cobj()->parent && cobj()->parent->type == XML_ELEMENT_NODE))
-    return 0;
+    return nullptr;
 
   Node::create_wrapper(cobj()->parent);
   return static_cast<Element*>(cobj()->parent->_private);
@@ -162,7 +162,7 @@ const Node* Node::get_next_sibling() const
 Node* Node::get_next_sibling()
 {
   if(!cobj()->next)
-    return 0;
+    return nullptr;
 
   Node::create_wrapper(cobj()->next);
   return static_cast<Node*>(cobj()->next->_private);
@@ -176,7 +176,7 @@ const Node* Node::get_previous_sibling() const
 Node* Node::get_previous_sibling()
 {
   if(!cobj()->prev)
-    return 0;
+    return nullptr;
 
   Node::create_wrapper(cobj()->prev);
   return static_cast<Node*>(cobj()->prev->_private);
@@ -197,7 +197,7 @@ Node* Node::get_first_child(const Glib::ustring& name)
 {
   auto child = impl_->children;
   if(!child)
-    return 0;
+    return nullptr;
 
   do
   {
@@ -206,7 +206,7 @@ Node* Node::get_first_child(const Glib::ustring& name)
   }
   while((child = child->next));
    
-  return 0;
+  return nullptr;
 }
 
 const Node* Node::get_first_child(const Glib::ustring& name) const
@@ -373,7 +373,7 @@ void Node::remove_child(Node* node)
 Node* Node::import_node(const Node* node, bool recursive)
 {
   if (!node)
-    return 0;
+    return nullptr;
 
   //Create the node, by copying:
   auto imported_node = xmlDocCopyNode(const_cast<xmlNode*>(node->cobj()), impl_->doc, recursive);
diff --git a/libxml++/parsers/textreader.cc b/libxml++/parsers/textreader.cc
index 5eb0414..74804e3 100644
--- a/libxml++/parsers/textreader.cc
+++ b/libxml++/parsers/textreader.cc
@@ -301,7 +301,7 @@ Node* TextReader::get_current_node()
   }
     
   check_for_exceptions();
-  return 0;
+  return nullptr;
 }
 
 const Node* TextReader::get_current_node() const
@@ -329,7 +329,7 @@ Node* TextReader::expand()
   }
     
   check_for_exceptions();
-  return 0;
+  return nullptr;
 }
 
 bool TextReader::next()


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