- Implemented ::removeAllBranches.
This commit is contained in:
Paul Beckingham 2014-06-14 14:19:49 -04:00
parent fb4bf3efba
commit 1b8671b58e
2 changed files with 14 additions and 0 deletions

View file

@ -91,6 +91,19 @@ void Tree::removeBranch (Tree* branch)
} }
} }
////////////////////////////////////////////////////////////////////////////////
void Tree::removeAllBranches ()
{
for (std::vector <Tree*>::iterator i = _branches.begin ();
i != _branches.end ();
++i)
{
delete *i;
}
_branches.clear ();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Tree::replaceBranch (Tree* from, Tree* to) void Tree::replaceBranch (Tree* from, Tree* to)
{ {

View file

@ -43,6 +43,7 @@ public:
Tree* addBranch (Tree*); Tree* addBranch (Tree*);
void removeBranch (Tree*); void removeBranch (Tree*);
void removeAllBranches ();
void replaceBranch (Tree*, Tree*); void replaceBranch (Tree*, Tree*);
void attribute (const std::string&, const std::string&); void attribute (const std::string&, const std::string&);