| 2190 | } |
| 2191 | |
| 2192 | void XMLDocument::Clear() |
| 2193 | { |
| 2194 | DeleteChildren(); |
| 2195 | while( _unlinked.Size()) { |
| 2196 | DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete. |
| 2197 | } |
| 2198 | |
| 2199 | #ifdef TINYXML2_DEBUG |
| 2200 | const bool hadError = Error(); |
| 2201 | #endif |
| 2202 | ClearError(); |
| 2203 | |
| 2204 | delete [] _charBuffer; |
| 2205 | _charBuffer = 0; |
| 2206 | _parsingDepth = 0; |
| 2207 | |
| 2208 | #if 0 |
| 2209 | _textPool.Trace( "text" ); |
| 2210 | _elementPool.Trace( "element" ); |
| 2211 | _commentPool.Trace( "comment" ); |
| 2212 | _attributePool.Trace( "attribute" ); |
| 2213 | #endif |
| 2214 | |
| 2215 | #ifdef TINYXML2_DEBUG |
| 2216 | if ( !hadError ) { |
| 2217 | TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); |
| 2218 | TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); |
| 2219 | TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); |
| 2220 | TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); |
| 2221 | } |
| 2222 | #endif |
| 2223 | } |
| 2224 | |
| 2225 | |
| 2226 | void XMLDocument::DeepCopy(XMLDocument* target) const |
no test coverage detected