Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::inhstruct::Tree Class Reference

#include <elm/inhstruct/Tree.h>

+ Inheritance diagram for elm::inhstruct::Tree:

Classes

class  Iterator
 

Public Member Functions

 Tree (void)
 
Treechildren (void) const
 
Treesibling (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)
 

Detailed Description

This class provides a simple generic implementation of trees storing children in a simple list.

{Implemented concepts}:
Parameters
TType of the top of the user Tree.

Constructor & Destructor Documentation

elm::inhstruct::Tree::Tree ( void  )

Build an empty tree.

Member Function Documentation

void elm::inhstruct::Tree::add ( Tree child)

Same as prepend().

References prependChild().

Referenced by elm::genstruct::Tree< T >::add(), and addAll().

template<class TT >
void elm::inhstruct::Tree::addAll ( const TT &  coll)

Add a collcection of children to the tree.

Parameters
collCollection to add (must implements elm::concept::Collection).

References add().

Referenced by elm::genstruct::Tree< T >::addAll().

void elm::inhstruct::Tree::addSibling ( Tree newSibling)
void elm::inhstruct::Tree::appendChild ( Tree child)

Add a child at the end of the children list.

Parameters
childChild to add.

Referenced by elm::genstruct::Tree< T >::appendChild().

Tree * elm::inhstruct::Tree::children ( void  ) const

Get the first child.

Returns
First child.

Referenced by elm::genstruct::Tree< T >::children().

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.

Returns
Children count.

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.

Parameters
Trueif 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.

Returns
True if there is no children, false else.

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.

Parameters
childChild 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.

Parameters
iterIterator pointing to the child.

References removeChild().

template<class TT >
void elm::inhstruct::Tree::removeAll ( const TT &  coll)

Remove a collection of children.

Parameters
collCollection 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.

Parameters
childChild to remove.

Referenced by remove(), and elm::genstruct::Tree< T >::removeChild().

Tree * elm::inhstruct::Tree::sibling ( void  ) const

Get the next sibling.

Returns
Next sibling.

Referenced by elm::inhstruct::Tree::Iterator::next(), and elm::genstruct::Tree< T >::sibling().


The documentation for this class was generated from the following files: