![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/inhstruct/Tree.h>
Inheritance diagram for Tree:Classes | |
| class | Iter |
Public Member Functions | |
| Tree (void) | |
| Tree * | children (void) const |
| Tree * | sibling (void) const |
| bool | hasChild (Tree *tree) const |
| bool | contains (Tree *tree) const |
| int | count (void) const |
| bool | isEmpty (void) const |
| operator bool (void) const | |
| void | prependChild (Tree *child) |
| void | appendChild (Tree *child) |
| void | addSibling (Tree *newSibling) |
| void | add (Tree *child) |
| template<class TT > | |
| void | addAll (const TT &coll) |
| void | removeChild (Tree *child) |
| void | remove (Tree *child) |
| void | remove (const Iter &iter) |
| template<class TT > | |
| void | removeAll (const TT &coll) |
| void | clear (void) |
This class provides a simple generic implementation of trees storing children in a simple list.
| T | Type of the top of the user Tree. |
Same as prepend().
References Tree::prependChild().
Referenced by Tree< T >::add(), and Tree::addAll().
|
inline |
Add a collcection of children to the tree.
| coll | Collection to add (must implements elm::concept::Collection). |
References Tree::add(), and elm::iter().
Referenced by Tree< T >::addAll().
Referenced by Tree< T >::addSibling().
Add a child at the end of the children list.
| child | Child to add. |
Referenced by Tree< T >::appendChild().
Remove all children of the tree.
Referenced by Tree< T >::clear().
Same as hasChild().
References Tree::hasChild().
| int count | ( | void | ) | const |
Test if the given tree is a child of the current one.
| True | if it is a child, false else. |
Referenced by Tree::contains(), and Tree< T >::hasChild().
Test if the tree has no children.
Referenced by Tree< T >::isEmpty(), Tree< T >::operator bool(), and Tree::operator bool().
Same as !isEmpty().
References Tree::isEmpty().
|
inline |
Add a child at the start of the children list.
| child | Child to add. |
Referenced by Tree::add(), and Tree< T >::prependChild().
References Tree::removeChild().
Same as removeChild().
References Tree::removeChild().
Referenced by Tree< T >::remove(), and Tree::removeAll().
|
inline |
Remove a collection of children.
| coll | Collection to remove. Must implement elm::concept::Collection. |
References elm::iter(), and Tree::remove().
Referenced by Tree< T >::removeAll().
Remove a child from the list.
| child | Child to remove. |
Referenced by Tree::remove(), and Tree< T >::removeChild().
Get the next sibling.
Referenced by Tree::Iter::next(), and Tree< T >::sibling().