allow removing without deleting (detaching)
This commit is contained in:
@@ -103,12 +103,13 @@ XNode *XNode::AppendChild( XNode *node )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// detach node and delete object
|
// detach node and delete object
|
||||||
bool XNode::RemoveChild( XNode *node )
|
bool XNode::RemoveChild( XNode *node, bool bDelete )
|
||||||
{
|
{
|
||||||
FOREACHMM( RString, XNode*, m_childs, p )
|
FOREACHMM( RString, XNode*, m_childs, p )
|
||||||
{
|
{
|
||||||
if( p->second == node )
|
if( p->second == node )
|
||||||
{
|
{
|
||||||
|
if( bDelete )
|
||||||
SAFE_DELETE( p->second );
|
SAFE_DELETE( p->second );
|
||||||
m_childs.erase( p );
|
m_childs.erase( p );
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -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, 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( const RString &sName ) { XNode *p=new XNode(sName); return AppendChild(p); }
|
||||||
XNode *AppendChild( XNode *node );
|
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, const RString &sValue = RString() );
|
||||||
void AppendAttr( const RString &sName, float value );
|
void AppendAttr( const RString &sName, float value );
|
||||||
|
|||||||
Reference in New Issue
Block a user