MCPcopy Create free account
hub / github.com/MyGUI/mygui / insert_attribute_after

Method insert_attribute_after

Tools/EditorFramework/pugixml.cpp:4728–4758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4726 }
4727
4728 PUGI__FN xml_attribute xml_node::insert_attribute_after(const char_t* name_, const xml_attribute& attr)
4729 {
4730 if ((type() != node_element && type() != node_declaration) || attr.empty())
4731 return xml_attribute();
4732
4733 // check that attribute belongs to *this
4734 xml_attribute_struct* cur = attr._attr;
4735
4736 while (cur->prev_attribute_c->next_attribute)
4737 cur = cur->prev_attribute_c;
4738
4739 if (cur != _root->first_attribute)
4740 return xml_attribute();
4741
4742 xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
4743 if (!a)
4744 return xml_attribute();
4745
4746 a.set_name(name_);
4747
4748 if (attr._attr->next_attribute)
4749 attr._attr->next_attribute->prev_attribute_c = a._attr;
4750 else
4751 _root->first_attribute->prev_attribute_c = a._attr;
4752
4753 a._attr->next_attribute = attr._attr->next_attribute;
4754 a._attr->prev_attribute_c = attr._attr;
4755 attr._attr->next_attribute = a._attr;
4756
4757 return a;
4758 }
4759
4760 PUGI__FN xml_attribute xml_node::append_copy(const xml_attribute& proto)
4761 {

Callers

nothing calls this directly

Calls 3

allocate_attributeFunction · 0.70
emptyMethod · 0.45
set_nameMethod · 0.45

Tested by

no test coverage detected