MCPcopy Create free account
hub / github.com/ajkhoury/ReClassEx / FindOrCreateAttribute

Method FindOrCreateAttribute

ReClass/tinyxml2.cpp:1760–1785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1758
1759
1760XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name )
1761{
1762 XMLAttribute* last = 0;
1763 XMLAttribute* attrib = 0;
1764 for( attrib = _rootAttribute;
1765 attrib;
1766 last = attrib, attrib = attrib->_next ) {
1767 if ( XMLUtil::StringEqual( attrib->Name(), name ) ) {
1768 break;
1769 }
1770 }
1771 if ( !attrib ) {
1772 attrib = CreateAttribute();
1773 TIXMLASSERT( attrib );
1774 if ( last ) {
1775 TIXMLASSERT( last->_next == 0 );
1776 last->_next = attrib;
1777 }
1778 else {
1779 TIXMLASSERT( _rootAttribute == 0 );
1780 _rootAttribute = attrib;
1781 }
1782 attrib->SetName( name );
1783 }
1784 return attrib;
1785}
1786
1787
1788void XMLElement::DeleteAttribute( const char* name )

Callers

nothing calls this directly

Calls 3

StringEqualFunction · 0.85
NameMethod · 0.80
SetNameMethod · 0.45

Tested by

no test coverage detected