diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-07-07 20:10:48 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-07-07 20:10:48 +0000 |
commit | 5811786ccdf88af00852db78318c48deaa0dc24c (patch) | |
tree | 59bfdd72eaa7217a4820794cf9f382358a7c4c8c /src/pugixml.cpp | |
parent | e959098703889719d33b6e5d0a160f68516ae853 (diff) |
remove_child and remove_attribute now return operation result
git-svn-id: http://pugixml.googlecode.com/svn/trunk@572 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r-- | src/pugixml.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 0b50fe7..96f6037 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -3774,21 +3774,21 @@ namespace pugi return result;
}
- void xml_node::remove_attribute(const char_t* name)
+ bool xml_node::remove_attribute(const char_t* name)
{
- remove_attribute(attribute(name));
+ return remove_attribute(attribute(name));
}
- void xml_node::remove_attribute(const xml_attribute& a)
+ bool xml_node::remove_attribute(const xml_attribute& a)
{
- if (!_root || !a._attr) return;
+ if (!_root || !a._attr) return false;
// check that attribute belongs to *this
xml_attribute_struct* attr = a._attr;
while (attr->prev_attribute_c->next_attribute) attr = attr->prev_attribute_c;
- if (attr != _root->first_attribute) return;
+ if (attr != _root->first_attribute) return false;
if (a._attr->next_attribute) a._attr->next_attribute->prev_attribute_c = a._attr->prev_attribute_c;
else if (_root->first_attribute) _root->first_attribute->prev_attribute_c = a._attr->prev_attribute_c;
@@ -3797,16 +3797,18 @@ namespace pugi else _root->first_attribute = a._attr->next_attribute;
destroy_attribute(a._attr, get_allocator(_root));
+
+ return true;
}
- void xml_node::remove_child(const char_t* name)
+ bool xml_node::remove_child(const char_t* name)
{
- remove_child(child(name));
+ return remove_child(child(name));
}
- void xml_node::remove_child(const xml_node& n)
+ bool xml_node::remove_child(const xml_node& n)
{
- if (!_root || !n._root || n._root->parent != _root) return;
+ if (!_root || !n._root || n._root->parent != _root) return false;
if (n._root->next_sibling) n._root->next_sibling->prev_sibling_c = n._root->prev_sibling_c;
else if (_root->first_child) _root->first_child->prev_sibling_c = n._root->prev_sibling_c;
@@ -3815,6 +3817,8 @@ namespace pugi else _root->first_child = n._root->next_sibling;
destroy_node(n._root, get_allocator(_root));
+
+ return true;
}
xml_node xml_node::find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const
|