MCPcopy Create free account
hub / github.com/NanoMichael/MicroTeX / FindOrCreateAttribute

Method FindOrCreateAttribute

src/xml/tinyxml2.cpp:1331–1354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1329
1330
1331XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name ) {
1332 XMLAttribute* last = 0;
1333 XMLAttribute* attrib = 0;
1334 for( attrib = _rootAttribute;
1335 attrib;
1336 last = attrib, attrib = attrib->_next ) {
1337 if ( XMLUtil::StringEqual( attrib->Name(), name ) ) {
1338 break;
1339 }
1340 }
1341 if ( !attrib ) {
1342 TIXMLASSERT( sizeof( XMLAttribute ) == _document->_attributePool.ItemSize() );
1343 attrib = new (_document->_attributePool.Alloc() ) XMLAttribute();
1344 attrib->_memPool = &_document->_attributePool;
1345 if ( last ) {
1346 last->_next = attrib;
1347 } else {
1348 _rootAttribute = attrib;
1349 }
1350 attrib->SetName( name );
1351 attrib->_memPool->SetTracked(); // always created and linked.
1352 }
1353 return attrib;
1354}
1355
1356
1357void XMLElement::DeleteAttribute( const char* name ) {

Callers

nothing calls this directly

Calls 5

NameMethod · 0.80
ItemSizeMethod · 0.80
AllocMethod · 0.80
SetNameMethod · 0.80
SetTrackedMethod · 0.80

Tested by

no test coverage detected