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

#include <elm/data/Tree.h>

+ Inheritance diagram for Tree< T >:

Classes

class  Iter
 

Public Member Functions

 Tree (const T &value)
 
const T & data (void) const
 
T & data (void)
 
const Treechildren (void) const
 
Treechildren (void)
 
const Treesibling (void) const
 
Treesibling (void)
 
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

template<class T>
class elm::Tree< T >

This class implements a minimal tree whose children are linked with a simple link list. It provides facilities to store a value on the tree and to access either children, or closer sibling.

Parameters
TType of stored values.

Constructor & Destructor Documentation

◆ Tree()

Tree ( const T &  value)
inline

Build a new empty tree storing the given value.

Parameters
valueValue to store in the tree.

Member Function Documentation

◆ add()

void add ( Tree< T > *  child)
inline

References Tree::add().

◆ addAll()

void addAll ( const TT &  coll)
inline

References Tree::addAll().

◆ addSibling()

void addSibling ( Tree< T > *  newSibling)
inline

References Tree::addSibling().

◆ appendChild()

void appendChild ( Tree< T > *  child)
inline

References Tree::appendChild().

◆ children() [1/2]

Tree< T > * children ( void  )
inline

Get list of children of the tree, that is, the first child.

Returns
First children.

References Tree::children().

◆ children() [2/2]

const Tree< T > * children ( void  ) const
inline

Get list of children of the tree, that is, the first child.

Returns
First children.

References Tree::children().

◆ clear()

void clear ( void  )
inline

References Tree::clear().

◆ contains()

bool contains ( Tree< T > *  tree) const
inline

References Tree< T >::hasChild().

◆ count()

int count ( void  ) const
inline

References Tree::count().

◆ data() [1/2]

T & data ( void  )
inline

Get assignable reference on the value stored in the tree.

Returns
Stored value reference.

◆ data() [2/2]

const T & data ( void  ) const
inline

Get the value stored in the tree.

Returns
Stored value.

◆ hasChild()

bool hasChild ( Tree< T > *  tree) const
inline

References Tree::hasChild().

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

◆ isEmpty()

bool isEmpty ( void  ) const
inline

References Tree::isEmpty().

◆ operator bool()

operator bool ( void  ) const
inline

References Tree::isEmpty().

◆ prependChild()

void prependChild ( Tree< T > *  child)
inline

References Tree::prependChild().

◆ remove() [1/2]

void remove ( const Iter iter)
inline

◆ remove() [2/2]

void remove ( Tree< T > *  child)
inline

References Tree::remove().

◆ removeAll()

void removeAll ( const TT &  coll)
inline

References Tree::removeAll().

◆ removeChild()

void removeChild ( Tree< T > *  child)
inline

References Tree::removeChild().

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

◆ sibling() [1/2]

Tree< T > * sibling ( void  )
inline

Get the next sibling of the current tree.

Returns
Next sibling.

References Tree::sibling().

◆ sibling() [2/2]

const Tree< T > * sibling ( void  ) const
inline

Get the next sibling of the current tree.

Returns
Next sibling.

References Tree::sibling().


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