MCPcopy Create free account
hub / github.com/MediaArea/MediaInfoLib / FindOrCreateAttribute

Method FindOrCreateAttribute

Source/ThirdParty/tinyxml2/tinyxml2.cpp:1758–1783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

StringEqualFunction · 0.85
SetNameMethod · 0.80
NameMethod · 0.45

Tested by

no test coverage detected