diff --git a/src/Tree.cpp b/src/Tree.cpp index 332455052..6d60d2627 100644 --- a/src/Tree.cpp +++ b/src/Tree.cpp @@ -91,6 +91,19 @@ void Tree::removeBranch (Tree* branch) } } +//////////////////////////////////////////////////////////////////////////////// +void Tree::removeAllBranches () +{ + for (std::vector ::iterator i = _branches.begin (); + i != _branches.end (); + ++i) + { + delete *i; + } + + _branches.clear (); +} + //////////////////////////////////////////////////////////////////////////////// void Tree::replaceBranch (Tree* from, Tree* to) { diff --git a/src/Tree.h b/src/Tree.h index 43205743e..aadcf2082 100644 --- a/src/Tree.h +++ b/src/Tree.h @@ -43,6 +43,7 @@ public: Tree* addBranch (Tree*); void removeBranch (Tree*); + void removeAllBranches (); void replaceBranch (Tree*, Tree*); void attribute (const std::string&, const std::string&);