Looking over the code this would be all that is required I believe to add this feature.
/// Create a empty handle
TiXmlHandle() {this->node = 0;}
/** Sets the node of the handle.
This sets the node of the handle to "node" and can be null pointer.
*/
TiXmlHandle SetNode(TiXmlNode* node) {this->node = node;}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was looking at the TiXmlHandle and see there isn't really a way to declare one handle and reuse it by giving it a new node to wrap.
Would adding a empty constructor with a function like SetNode(TiXmlNode* innode) we of interest to others.
heres some code demostrating what i'd like to be able to do.
node = thehand.FirstChild("SoundFile");
if(node == NULL) return(false);
TiXmlNode*child;
while(node != NULL) {
thehand.SetNode(node);
child = thehand.FirstChild("path").FirstChild().Text();
if(child == NULL)
// complain
node = node->NextSibling();
}
anyways that should give an idea of why it'd be nice to resue the handle.
Looking over the code this would be all that is required I believe to add this feature.
/// Create a empty handle
TiXmlHandle() {this->node = 0;}
/** Sets the node of the handle.
This sets the node of the handle to "node" and can be null pointer.
*/
TiXmlHandle SetNode(TiXmlNode* node) {this->node = node;}
opps my goof SetNode should be:
TiXmlHandle SetNode(TiXmlNode* node) {this->node = node; return(*this);}
TiXmlHandles are trivial in terms of data - just a pointer. Creating new ones on the stack is fast and cheap.
theHandle = TiXmlHandle( newNode )
is probably the best way to do a "SetNode()"
lee