MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / FindOrCreateAttribute

Method FindOrCreateAttribute

Source/ThirdParty/tinyxml2/tinyxml2.cpp:1603–1628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1601
1602
1603XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name )
1604{
1605 XMLAttribute* last = 0;
1606 XMLAttribute* attrib = 0;
1607 for( attrib = _rootAttribute;
1608 attrib;
1609 last = attrib, attrib = attrib->_next ) {
1610 if ( XMLUtil::StringEqual( attrib->Name(), name ) ) {
1611 break;
1612 }
1613 }
1614 if ( !attrib ) {
1615 TIXMLASSERT( sizeof( XMLAttribute ) == _document->_attributePool.ItemSize() );
1616 attrib = new (_document->_attributePool.Alloc() ) XMLAttribute();
1617 attrib->_memPool = &_document->_attributePool;
1618 if ( last ) {
1619 last->_next = attrib;
1620 }
1621 else {
1622 _rootAttribute = attrib;
1623 }
1624 attrib->SetName( name );
1625 attrib->_memPool->SetTracked(); // always created and linked.
1626 }
1627 return attrib;
1628}
1629
1630
1631void XMLElement::DeleteAttribute( const char* name )

Callers

nothing calls this directly

Calls 5

SetTrackedMethod · 0.80
NameMethod · 0.45
ItemSizeMethod · 0.45
AllocMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected