| 2222 | } |
| 2223 | |
| 2224 | void XMLDocument::Clear() |
| 2225 | { |
| 2226 | DeleteChildren(); |
| 2227 | while( _unlinked.Size()) { |
| 2228 | DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete. |
| 2229 | } |
| 2230 | |
| 2231 | #ifdef TINYXML2_DEBUG |
| 2232 | const bool hadError = Error(); |
| 2233 | #endif |
| 2234 | ClearError(); |
| 2235 | |
| 2236 | delete [] _charBuffer; |
| 2237 | _charBuffer = 0; |
| 2238 | _parsingDepth = 0; |
| 2239 | |
| 2240 | #if 0 |
| 2241 | _textPool.Trace( "text" ); |
| 2242 | _elementPool.Trace( "element" ); |
| 2243 | _commentPool.Trace( "comment" ); |
| 2244 | _attributePool.Trace( "attribute" ); |
| 2245 | #endif |
| 2246 | |
| 2247 | #ifdef TINYXML2_DEBUG |
| 2248 | if ( !hadError ) { |
| 2249 | TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); |
| 2250 | TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); |
| 2251 | TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); |
| 2252 | TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); |
| 2253 | } |
| 2254 | #endif |
| 2255 | } |
| 2256 | |
| 2257 | |
| 2258 | void XMLDocument::DeepCopy(XMLDocument* target) const |