MCPcopy Create free account
hub / github.com/avast/retdec / FindOrCreateAttribute

Method FindOrCreateAttribute

deps/tinyxml2/tinyxml2.cpp:1838–1863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1836
1837
1838XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name )
1839{
1840 XMLAttribute* last = 0;
1841 XMLAttribute* attrib = 0;
1842 for( attrib = _rootAttribute;
1843 attrib;
1844 last = attrib, attrib = attrib->_next ) {
1845 if ( XMLUtil::StringEqual( attrib->Name(), name ) ) {
1846 break;
1847 }
1848 }
1849 if ( !attrib ) {
1850 attrib = CreateAttribute();
1851 TIXMLASSERT( attrib );
1852 if ( last ) {
1853 TIXMLASSERT( last->_next == 0 );
1854 last->_next = attrib;
1855 }
1856 else {
1857 TIXMLASSERT( _rootAttribute == 0 );
1858 _rootAttribute = attrib;
1859 }
1860 attrib->SetName( name );
1861 }
1862 return attrib;
1863}
1864
1865
1866void XMLElement::DeleteAttribute( const char* name )

Callers

nothing calls this directly

Calls 3

SetNameMethod · 0.80
StringEqualFunction · 0.50
NameMethod · 0.45

Tested by

no test coverage detected