mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-31 00:13:01 +08:00
Swap insert_attribute_* implementations
Make sure their order is consistent with the order of declaration in header file. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1057 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
f4f55051d6
commit
ccf8adce05
@ -747,18 +747,6 @@ PUGI__NS_BEGIN
|
||||
node->first_attribute = attr;
|
||||
}
|
||||
|
||||
inline void insert_attribute_before(xml_attribute_struct* attr, xml_attribute_struct* place, xml_node_struct* node)
|
||||
{
|
||||
if (place->prev_attribute_c->next_attribute)
|
||||
place->prev_attribute_c->next_attribute = attr;
|
||||
else
|
||||
node->first_attribute = attr;
|
||||
|
||||
attr->prev_attribute_c = place->prev_attribute_c;
|
||||
attr->next_attribute = place;
|
||||
place->prev_attribute_c = attr;
|
||||
}
|
||||
|
||||
inline void insert_attribute_after(xml_attribute_struct* attr, xml_attribute_struct* place, xml_node_struct* node)
|
||||
{
|
||||
if (place->next_attribute)
|
||||
@ -771,6 +759,18 @@ PUGI__NS_BEGIN
|
||||
place->next_attribute = attr;
|
||||
}
|
||||
|
||||
inline void insert_attribute_before(xml_attribute_struct* attr, xml_attribute_struct* place, xml_node_struct* node)
|
||||
{
|
||||
if (place->prev_attribute_c->next_attribute)
|
||||
place->prev_attribute_c->next_attribute = attr;
|
||||
else
|
||||
node->first_attribute = attr;
|
||||
|
||||
attr->prev_attribute_c = place->prev_attribute_c;
|
||||
attr->next_attribute = place;
|
||||
place->prev_attribute_c = attr;
|
||||
}
|
||||
|
||||
inline void remove_attribute(xml_attribute_struct* attr, xml_node_struct* node)
|
||||
{
|
||||
if (attr->next_attribute)
|
||||
@ -4867,21 +4867,6 @@ namespace pugi
|
||||
return a;
|
||||
}
|
||||
|
||||
PUGI__FN xml_attribute xml_node::insert_attribute_before(const char_t* name_, const xml_attribute& attr)
|
||||
{
|
||||
if (type() != node_element && type() != node_declaration) return xml_attribute();
|
||||
if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
|
||||
|
||||
xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
|
||||
if (!a) return xml_attribute();
|
||||
|
||||
impl::insert_attribute_before(a._attr, attr._attr, _root);
|
||||
|
||||
a.set_name(name_);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
PUGI__FN xml_attribute xml_node::insert_attribute_after(const char_t* name_, const xml_attribute& attr)
|
||||
{
|
||||
if (type() != node_element && type() != node_declaration) return xml_attribute();
|
||||
@ -4897,6 +4882,21 @@ namespace pugi
|
||||
return a;
|
||||
}
|
||||
|
||||
PUGI__FN xml_attribute xml_node::insert_attribute_before(const char_t* name_, const xml_attribute& attr)
|
||||
{
|
||||
if (type() != node_element && type() != node_declaration) return xml_attribute();
|
||||
if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
|
||||
|
||||
xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
|
||||
if (!a) return xml_attribute();
|
||||
|
||||
impl::insert_attribute_before(a._attr, attr._attr, _root);
|
||||
|
||||
a.set_name(name_);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
PUGI__FN xml_attribute xml_node::append_copy(const xml_attribute& proto)
|
||||
{
|
||||
if (!proto) return xml_attribute();
|
||||
|
Loading…
x
Reference in New Issue
Block a user