MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / FindOrCreateAttribute

Method FindOrCreateAttribute

externals/tinyxml2/tinyxml2.cpp:1912–1937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1910
1911
1912XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name )
1913{
1914 XMLAttribute* last = 0;
1915 XMLAttribute* attrib = 0;
1916 for( attrib = _rootAttribute;
1917 attrib;
1918 last = attrib, attrib = attrib->_next ) {
1919 if ( XMLUtil::StringEqual( attrib->Name(), name ) ) {
1920 break;
1921 }
1922 }
1923 if ( !attrib ) {
1924 attrib = CreateAttribute();
1925 TIXMLASSERT( attrib );
1926 if ( last ) {
1927 TIXMLASSERT( last->_next == 0 );
1928 last->_next = attrib;
1929 }
1930 else {
1931 TIXMLASSERT( _rootAttribute == 0 );
1932 _rootAttribute = attrib;
1933 }
1934 attrib->SetName( name );
1935 }
1936 return attrib;
1937}
1938
1939
1940void XMLElement::DeleteAttribute( const char* name )

Callers

nothing calls this directly

Calls 3

StringEqualFunction · 0.85
NameMethod · 0.80
SetNameMethod · 0.80

Tested by

no test coverage detected