| 1757 | |
| 1758 | |
| 1759 | XMLAttribute* XMLElement::FindOrCreateAttribute(const char* name) |
| 1760 | { |
| 1761 | XMLAttribute* last = 0; |
| 1762 | XMLAttribute* attrib = 0; |
| 1763 | for (attrib = _rootAttribute; |
| 1764 | attrib; |
| 1765 | last = attrib, attrib = attrib->_next) { |
| 1766 | if (XMLUtil::StringEqual(attrib->Name(), name)) { |
| 1767 | break; |
| 1768 | } |
| 1769 | } |
| 1770 | if (!attrib) { |
| 1771 | attrib = CreateAttribute(); |
| 1772 | TIXMLASSERT(attrib); |
| 1773 | if (last) { |
| 1774 | TIXMLASSERT(last->_next == 0); |
| 1775 | last->_next = attrib; |
| 1776 | } |
| 1777 | else { |
| 1778 | TIXMLASSERT(_rootAttribute == 0); |
| 1779 | _rootAttribute = attrib; |
| 1780 | } |
| 1781 | attrib->SetName(name); |
| 1782 | } |
| 1783 | return attrib; |
| 1784 | } |
| 1785 | |
| 1786 | |
| 1787 | void XMLElement::DeleteAttribute(const char* name) |
nothing calls this directly
no test coverage detected