| 2037 | } |
| 2038 | |
| 2039 | void XMLDocument::Clear() |
| 2040 | { |
| 2041 | DeleteChildren(); |
| 2042 | while( _unlinked.Size()) { |
| 2043 | DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete. |
| 2044 | } |
| 2045 | |
| 2046 | #ifdef TINYXML2_DEBUG |
| 2047 | const bool hadError = Error(); |
| 2048 | #endif |
| 2049 | ClearError(); |
| 2050 | |
| 2051 | delete [] _charBuffer; |
| 2052 | _charBuffer = 0; |
| 2053 | _parsingDepth = 0; |
| 2054 | |
| 2055 | #if 0 |
| 2056 | _textPool.Trace( "text" ); |
| 2057 | _elementPool.Trace( "element" ); |
| 2058 | _commentPool.Trace( "comment" ); |
| 2059 | _attributePool.Trace( "attribute" ); |
| 2060 | #endif |
| 2061 | |
| 2062 | #ifdef TINYXML2_DEBUG |
| 2063 | if ( !hadError ) { |
| 2064 | TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); |
| 2065 | TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); |
| 2066 | TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); |
| 2067 | TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); |
| 2068 | } |
| 2069 | #endif |
| 2070 | } |
| 2071 | |
| 2072 | |
| 2073 | void XMLDocument::DeepCopy(XMLDocument* target) const |
no test coverage detected