Imported Upstream version 2.91.2
[platform/upstream/libxml++.git] / libxml++ / nodes / node.cc
index 16cb55f..71eab85 100644 (file)
@@ -222,7 +222,7 @@ Node::Node(xmlNode* node)
   : impl_(node)
 {
   if (!impl_)
-    throw internal_error("xmlNode pointer cannot be 0");
+    throw internal_error("xmlNode pointer cannot be nullptr");
 
   impl_->_private = this;
 }
@@ -238,7 +238,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);
@@ -252,7 +252,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);
@@ -266,7 +266,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);
@@ -276,7 +276,7 @@ Node* Node::get_first_child(const Glib::ustring& name)
 {
   auto child = impl_->children;
   if(!child)
-    return 0;
+    return nullptr;
 
   do
   {
@@ -285,7 +285,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
@@ -320,7 +320,7 @@ void Node::remove_node(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);
@@ -332,7 +332,7 @@ Node* Node::import_node(const Node* node, bool recursive)
   if (imported_node->type == XML_ATTRIBUTE_NODE && impl_->type == XML_ELEMENT_NODE)
   {
     auto old_attr = xmlHasNsProp(impl_, imported_node->name,
-      imported_node->ns ? imported_node->ns->href : 0);
+      imported_node->ns ? imported_node->ns->href : nullptr);
     if (old_attr && old_attr->type != XML_ATTRIBUTE_DECL)
     {
       // *this has an attribute with the same name as the imported attribute.
@@ -396,12 +396,12 @@ Glib::ustring Node::get_path() const
 
 Node::NodeSet Node::find(const Glib::ustring& xpath)
 {
-  return find_common<NodeSet>(xpath, 0, impl_);
+  return find_common<NodeSet>(xpath, nullptr, impl_);
 }
 
 Node::const_NodeSet Node::find(const Glib::ustring& xpath) const
 {
-  return find_common<const_NodeSet>(xpath, 0, impl_);
+  return find_common<const_NodeSet>(xpath, nullptr, impl_);
 }
 
 Node::NodeSet Node::find(const Glib::ustring& xpath, const PrefixNsMap& namespaces)
@@ -416,7 +416,7 @@ Node::const_NodeSet Node::find(const Glib::ustring& xpath, const PrefixNsMap& na
 
 bool Node::eval_to_boolean(const Glib::ustring& xpath, XPathResultType* result_type) const
 {
-  return eval_common_to_boolean(xpath, 0, result_type, impl_);
+  return eval_common_to_boolean(xpath, nullptr, result_type, impl_);
 }
 
 bool Node::eval_to_boolean(const Glib::ustring& xpath, const PrefixNsMap& namespaces,
@@ -427,7 +427,7 @@ bool Node::eval_to_boolean(const Glib::ustring& xpath, const PrefixNsMap& namesp
 
 double Node::eval_to_number(const Glib::ustring& xpath, XPathResultType* result_type) const
 {
-  return eval_common_to_number(xpath, 0, result_type, impl_);
+  return eval_common_to_number(xpath, nullptr, result_type, impl_);
 }
 
 double Node::eval_to_number(const Glib::ustring& xpath, const PrefixNsMap& namespaces,
@@ -438,7 +438,7 @@ double Node::eval_to_number(const Glib::ustring& xpath, const PrefixNsMap& names
 
 Glib::ustring Node::eval_to_string(const Glib::ustring& xpath, XPathResultType* result_type) const
 {
-  return eval_common_to_string(xpath, 0, result_type, impl_);
+  return eval_common_to_string(xpath, nullptr, result_type, impl_);
 }
 
 Glib::ustring Node::eval_to_string(const Glib::ustring& xpath, const PrefixNsMap& namespaces,
@@ -502,7 +502,7 @@ void Node::set_namespace(const Glib::ustring& ns_prefix)
   }
 
   //Look for the existing namespace to use:
-  auto ns = xmlSearchNs( cobj()->doc, cobj(), (xmlChar*)(ns_prefix.empty() ? 0 : ns_prefix.c_str()) );
+  auto ns = xmlSearchNs( cobj()->doc, cobj(), (xmlChar*)(ns_prefix.empty() ? nullptr : ns_prefix.c_str()) );
   if(ns)
   {
       //Use it for this element: