| 2162 | } |
| 2163 | |
| 2164 | void XMLDocument::Clear() |
| 2165 | { |
| 2166 | DeleteChildren(); |
| 2167 | while( _unlinked.Size()) { |
| 2168 | DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete. |
| 2169 | } |
| 2170 | |
| 2171 | #ifdef TINYXML2_DEBUG |
| 2172 | const bool hadError = Error(); |
| 2173 | #endif |
| 2174 | ClearError(); |
| 2175 | |
| 2176 | delete [] _charBuffer; |
| 2177 | _charBuffer = 0; |
| 2178 | _parsingDepth = 0; |
| 2179 | |
| 2180 | #if 0 |
| 2181 | _textPool.Trace( "text" ); |
| 2182 | _elementPool.Trace( "element" ); |
| 2183 | _commentPool.Trace( "comment" ); |
| 2184 | _attributePool.Trace( "attribute" ); |
| 2185 | #endif |
| 2186 | |
| 2187 | #ifdef TINYXML2_DEBUG |
| 2188 | if ( !hadError ) { |
| 2189 | TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); |
| 2190 | TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); |
| 2191 | TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); |
| 2192 | TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); |
| 2193 | } |
| 2194 | #endif |
| 2195 | } |
| 2196 | |
| 2197 | |
| 2198 | void XMLDocument::DeepCopy(XMLDocument* target) const |
no test coverage detected