Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/inhstruct/Tree.h>
Classes | |
class | Iterator |
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 Iterator &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. |
elm::inhstruct::Tree::Tree | ( | void | ) |
Build an empty tree.
void elm::inhstruct::Tree::add | ( | Tree * | child | ) |
Same as prepend().
References prependChild().
Referenced by elm::genstruct::Tree< T >::add(), and addAll().
void elm::inhstruct::Tree::addAll | ( | const TT & | coll | ) |
Add a collcection of children to the tree.
coll | Collection to add (must implements elm::concept::Collection). |
References add().
Referenced by elm::genstruct::Tree< T >::addAll().
void elm::inhstruct::Tree::addSibling | ( | Tree * | newSibling | ) |
Referenced by elm::genstruct::Tree< T >::addSibling().
void elm::inhstruct::Tree::appendChild | ( | Tree * | child | ) |
Add a child at the end of the children list.
child | Child to add. |
Referenced by elm::genstruct::Tree< T >::appendChild().
Tree * elm::inhstruct::Tree::children | ( | void | ) | const |
void elm::inhstruct::Tree::clear | ( | void | ) |
Remove all children of the tree.
Referenced by elm::genstruct::Tree< T >::clear().
bool elm::inhstruct::Tree::contains | ( | Tree * | tree | ) | const |
Same as hasChild().
References hasChild().
int elm::inhstruct::Tree::count | ( | void | ) | const |
Count the children of the tree.
Referenced by elm::genstruct::Tree< T >::count().
bool elm::inhstruct::Tree::hasChild | ( | Tree * | tree | ) | const |
Test if the given tree is a child of the current one.
True | if it is a child, false else. |
Referenced by contains(), and elm::genstruct::Tree< T >::hasChild().
bool elm::inhstruct::Tree::isEmpty | ( | void | ) | const |
Test if the tree has no children.
Referenced by elm::genstruct::Tree< T >::isEmpty(), operator bool(), and elm::genstruct::Tree< T >::operator bool().
elm::inhstruct::Tree::operator bool | ( | void | ) | const |
Same as !isEmpty().
References isEmpty().
elm::inhstruct::Tree::prependChild | ( | Tree * | child | ) |
Add a child at the start of the children list.
child | Child to add. |
Referenced by add(), and elm::genstruct::Tree< T >::prependChild().
void elm::inhstruct::Tree::remove | ( | Tree * | child | ) |
void elm::inhstruct::Tree::remove | ( | const Iterator & | iter | ) |
Remove a child pointed by an iterator.
iter | Iterator pointing to the child. |
References removeChild().
void elm::inhstruct::Tree::removeAll | ( | const TT & | coll | ) |
Remove a collection of children.
coll | Collection to remove. Must implement elm::concept::Collection. |
Referenced by elm::genstruct::Tree< T >::removeAll().
void elm::inhstruct::Tree::removeChild | ( | Tree * | child | ) |
Remove a child from the list.
child | Child to remove. |
Referenced by remove(), and elm::genstruct::Tree< T >::removeChild().
Tree * elm::inhstruct::Tree::sibling | ( | void | ) | const |
Get the next sibling.
Referenced by elm::inhstruct::Tree::Iterator::next(), and elm::genstruct::Tree< T >::sibling().