MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / FindOrCreateAttribute

Method FindOrCreateAttribute

native/thirdpart/tinyxml2/tinyxml2.cpp:1880–1905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1878
1879
1880XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name )
1881{
1882 XMLAttribute* last = 0;
1883 XMLAttribute* attrib = 0;
1884 for( attrib = _rootAttribute;
1885 attrib;
1886 last = attrib, attrib = attrib->_next ) {
1887 if ( XMLUtil::StringEqual( attrib->Name(), name ) ) {
1888 break;
1889 }
1890 }
1891 if ( !attrib ) {
1892 attrib = CreateAttribute();
1893 TIXMLASSERT( attrib );
1894 if ( last ) {
1895 TIXMLASSERT( last->_next == 0 );
1896 last->_next = attrib;
1897 }
1898 else {
1899 TIXMLASSERT( _rootAttribute == 0 );
1900 _rootAttribute = attrib;
1901 }
1902 attrib->SetName( name );
1903 }
1904 return attrib;
1905}
1906
1907
1908void 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