SGPropertyNode: add removeAllChildren() method
This commit is contained in:
@@ -1075,6 +1075,21 @@ SGPropertyNode::removeChildren (const char * name, bool keep)
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SGPropertyNode::removeAllChildren()
|
||||||
|
{
|
||||||
|
for(unsigned i = 0; i < _children.size(); ++i)
|
||||||
|
{
|
||||||
|
SGPropertyNode_ptr& node = _children[i];
|
||||||
|
node->_parent = 0;
|
||||||
|
node->setAttribute(REMOVED, true);
|
||||||
|
node->clearValue();
|
||||||
|
fireChildRemoved(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
_children.clear();
|
||||||
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
SGPropertyNode::getDisplayName (bool simplify) const
|
SGPropertyNode::getDisplayName (bool simplify) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -910,6 +910,7 @@ public:
|
|||||||
simgear::PropertyList getChildren (const std::string& name) const
|
simgear::PropertyList getChildren (const std::string& name) const
|
||||||
{ return getChildren(name.c_str()); }
|
{ return getChildren(name.c_str()); }
|
||||||
|
|
||||||
|
// TODO do we need the removeXXX methods to return the deleted nodes?
|
||||||
/**
|
/**
|
||||||
* Remove child by position.
|
* Remove child by position.
|
||||||
*/
|
*/
|
||||||
@@ -941,6 +942,11 @@ public:
|
|||||||
bool keep = true)
|
bool keep = true)
|
||||||
{ return removeChildren(name.c_str(), keep); }
|
{ return removeChildren(name.c_str(), keep); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all children (does not change the value of the node)
|
||||||
|
*/
|
||||||
|
void removeAllChildren();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Alias support.
|
// Alias support.
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user