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