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

Method insert_attribute_before

Tools/EditorFramework/pugixml.cpp:4696–4726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4694 }
4695
4696 PUGI__FN xml_attribute xml_node::insert_attribute_before(const char_t* name_, const xml_attribute& attr)
4697 {
4698 if ((type() != node_element && type() != node_declaration) || attr.empty())
4699 return xml_attribute();
4700
4701 // check that attribute belongs to *this
4702 xml_attribute_struct* cur = attr._attr;
4703
4704 while (cur->prev_attribute_c->next_attribute)
4705 cur = cur->prev_attribute_c;
4706
4707 if (cur != _root->first_attribute)
4708 return xml_attribute();
4709
4710 xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
4711 if (!a)
4712 return xml_attribute();
4713
4714 a.set_name(name_);
4715
4716 if (attr._attr->prev_attribute_c->next_attribute)
4717 attr._attr->prev_attribute_c->next_attribute = a._attr;
4718 else
4719 _root->first_attribute = a._attr;
4720
4721 a._attr->prev_attribute_c = attr._attr->prev_attribute_c;
4722 a._attr->next_attribute = attr._attr;
4723 attr._attr->prev_attribute_c = a._attr;
4724
4725 return a;
4726 }
4727
4728 PUGI__FN xml_attribute xml_node::insert_attribute_after(const char_t* name_, const xml_attribute& attr)
4729 {

Callers

nothing calls this directly

Calls 3

allocate_attributeFunction · 0.70
emptyMethod · 0.45
set_nameMethod · 0.45

Tested by

no test coverage detected