Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Tree Class Reference

#include <elm/inhstruct/Tree.h>

+ Inheritance diagram for Tree:

Classes

class  Iter
 

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 Iter &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

◆ Tree()

Tree ( void  )
inline

Build an empty tree.

Member Function Documentation

◆ add()

void add ( Tree child)
inline

Same as prepend().

References Tree::prependChild().

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

◆ addAll()

void addAll ( const TT &  coll)
inline

Add a collcection of children to the tree.

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

References Tree::add(), and elm::iter().

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

◆ addSibling()

void addSibling ( Tree newSibling)
inline

Referenced by Tree< T >::addSibling().

◆ appendChild()

void appendChild ( Tree child)

Add a child at the end of the children list.

Parameters
childChild to add.

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

◆ children()

Tree * children ( void  ) const
inline

Get the first child.

Returns
First child.

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

◆ clear()

void clear ( void  )
inline

Remove all children of the tree.

Referenced by Tree< T >::clear().

◆ contains()

bool contains ( Tree tree) const
inline

Same as hasChild().

References Tree::hasChild().

◆ count()

int count ( void  ) const

Count the children of the tree.

Returns
Children count.

Referenced by Tree< T >::count().

◆ hasChild()

bool hasChild ( Tree tree) const
inline

Test if the given tree is a child of the current one.

Parameters
Trueif it is a child, false else.

Referenced by Tree::contains(), and Tree< T >::hasChild().

◆ isEmpty()

bool isEmpty ( void  ) const
inline

Test if the tree has no children.

Returns
True if there is no children, false else.

Referenced by Tree< T >::isEmpty(), Tree::operator bool(), and Tree< T >::operator bool().

◆ operator bool()

operator bool ( void  ) const
inline

Same as !isEmpty().

References Tree::isEmpty().

◆ prependChild()

prependChild ( Tree child)
inline

Add a child at the start of the children list.

Parameters
childChild to add.

Referenced by Tree::add(), and Tree< T >::prependChild().

◆ remove() [1/2]

void remove ( const Iter iter)
inline

References Tree::removeChild().

◆ remove() [2/2]

void remove ( Tree child)
inline

Same as removeChild().

References Tree::removeChild().

Referenced by Tree< T >::remove(), and Tree::removeAll().

◆ removeAll()

void removeAll ( const TT &  coll)
inline

Remove a collection of children.

Parameters
collCollection to remove. Must implement elm::concept::Collection.

References elm::iter(), and Tree::remove().

Referenced by Tree< T >::removeAll().

◆ removeChild()

void removeChild ( Tree child)

Remove a child from the list.

Parameters
childChild to remove.

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

◆ sibling()

Tree * sibling ( void  ) const
inline

Get the next sibling.

Returns
Next sibling.

Referenced by Tree::Iter::next(), and Tree< T >::sibling().


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