MCPcopy Create free account
hub / github.com/crossuo/crossuo / FindOrCreateAttribute

Method FindOrCreateAttribute

external/tinyxml2.cpp:1885–1910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1883
1884
1885XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name )
1886{
1887 XMLAttribute* last = 0;
1888 XMLAttribute* attrib = 0;
1889 for( attrib = _rootAttribute;
1890 attrib;
1891 last = attrib, attrib = attrib->_next ) {
1892 if ( XMLUtil::StringEqual( attrib->Name(), name ) ) {
1893 break;
1894 }
1895 }
1896 if ( !attrib ) {
1897 attrib = CreateAttribute();
1898 TIXMLASSERT( attrib );
1899 if ( last ) {
1900 TIXMLASSERT( last->_next == 0 );
1901 last->_next = attrib;
1902 }
1903 else {
1904 TIXMLASSERT( _rootAttribute == 0 );
1905 _rootAttribute = attrib;
1906 }
1907 attrib->SetName( name );
1908 }
1909 return attrib;
1910}
1911
1912
1913void XMLElement::DeleteAttribute( const char* name )

Callers

nothing calls this directly

Calls 3

StringEqualFunction · 0.85
NameMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected