allow removing without deleting (detaching)

This commit is contained in:
Glenn Maynard
2006-10-02 06:36:07 +00:00
parent 6db05d676a
commit 30d8823a44
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -103,13 +103,14 @@ XNode *XNode::AppendChild( XNode *node )
}
// detach node and delete object
bool XNode::RemoveChild( XNode *node )
bool XNode::RemoveChild( XNode *node, bool bDelete )
{
FOREACHMM( RString, XNode*, m_childs, p )
{
if( p->second == node )
{
SAFE_DELETE( p->second );
if( bDelete )
SAFE_DELETE( p->second );
m_childs.erase( p );
return true;
}
+1 -1
View File
@@ -81,7 +81,7 @@ public:
XNode *AppendChild( const RString &sName, T value ) { XNode *p=new XNode(sName); p->SetValue(value); return AppendChild(p); }
XNode *AppendChild( const RString &sName ) { XNode *p=new XNode(sName); return AppendChild(p); }
XNode *AppendChild( XNode *node );
bool RemoveChild( XNode *node );
bool RemoveChild( XNode *node, bool bDelete = true );
void AppendAttr( const RString &sName, const RString &sValue = RString() );
void AppendAttr( const RString &sName, float value );