0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-31 00:13:01 +08:00

Minor refactoring of tree modification

Remove redundant this-> from type() call (argument used to be called type,
but it's now type_).
Use _root member directly when possible instead of calling internal_object.
This commit is contained in:
Arseny Kapoulkine 2014-11-20 08:54:03 -08:00
parent cd62478108
commit 8f85b1ba7a

View File

@ -4970,7 +4970,7 @@ namespace pugi
PUGI__FN xml_node xml_node::append_child(xml_node_type type_)
{
if (!impl::allow_insert_child(this->type(), type_)) return xml_node();
if (!impl::allow_insert_child(type(), type_)) return xml_node();
xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
if (!n) return xml_node();
@ -4984,7 +4984,7 @@ namespace pugi
PUGI__FN xml_node xml_node::prepend_child(xml_node_type type_)
{
if (!impl::allow_insert_child(this->type(), type_)) return xml_node();
if (!impl::allow_insert_child(type(), type_)) return xml_node();
xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
if (!n) return xml_node();
@ -4998,7 +4998,7 @@ namespace pugi
PUGI__FN xml_node xml_node::insert_child_before(xml_node_type type_, const xml_node& node)
{
if (!impl::allow_insert_child(this->type(), type_)) return xml_node();
if (!impl::allow_insert_child(type(), type_)) return xml_node();
if (!node._root || node._root->parent != _root) return xml_node();
xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
@ -5013,7 +5013,7 @@ namespace pugi
PUGI__FN xml_node xml_node::insert_child_after(xml_node_type type_, const xml_node& node)
{
if (!impl::allow_insert_child(this->type(), type_)) return xml_node();
if (!impl::allow_insert_child(type(), type_)) return xml_node();
if (!node._root || node._root->parent != _root) return xml_node();
xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
@ -5066,7 +5066,7 @@ namespace pugi
{
xml_node result = append_child(proto.type());
if (result) impl::node_copy_tree(result.internal_object(), proto.internal_object());
if (result) impl::node_copy_tree(result._root, proto._root);
return result;
}
@ -5075,7 +5075,7 @@ namespace pugi
{
xml_node result = prepend_child(proto.type());
if (result) impl::node_copy_tree(result.internal_object(), proto.internal_object());
if (result) impl::node_copy_tree(result._root, proto._root);
return result;
}
@ -5084,7 +5084,7 @@ namespace pugi
{
xml_node result = insert_child_after(proto.type(), node);
if (result) impl::node_copy_tree(result.internal_object(), proto.internal_object());
if (result) impl::node_copy_tree(result._root, proto._root);
return result;
}
@ -5093,7 +5093,7 @@ namespace pugi
{
xml_node result = insert_child_before(proto.type(), node);
if (result) impl::node_copy_tree(result.internal_object(), proto.internal_object());
if (result) impl::node_copy_tree(result._root, proto._root);
return result;
}