![]() |
graph
5.0.5
Graph: generic attributed relational graphs
|
#include <graph/tree/base.h>
Public Types | |
typedef std::list< BaseTree * >::iterator | iterator |
typedef std::list< BaseTree * >::const_iterator | const_iterator |
typedef std::list< BaseTree * >::reverse_iterator | reverse_iterator |
typedef std::list< BaseTree * >::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
BaseTree (bool allowsChildren=true) | |
Constructor. More... | |
virtual | ~BaseTree () |
const std::list< BaseTree * > & | children () const |
bool | getAllowsChildren () const |
Returns true if the receiver allows children. More... | |
BaseTree * | getChildAt (unsigned childIndex) const |
Returns the child BaseTree pointer at index childIndex . More... | |
int | getIndex (BaseTree *node) const |
Returns the index of node in the receivers children. More... | |
BaseTree * | getParent () const |
Returns the parent BaseTree of the receiver. More... | |
BaseTree * | getTopParent () |
Returns the top-level parent BaseTree of the receiver. More... | |
const BaseTree * | getTopParent () const |
Returns the top-level parent of the receiver (const version) More... | |
bool | isLeaf () const |
Returns true if the receiver is a leaf (terminal node) More... | |
void | insert (BaseTree *child, int index=-1) |
Adds child to the receiver at index (default: end) More... | |
void | remove (unsigned index) |
Removes the child at index index from the receiver. More... | |
void | remove (BaseTree *node) |
Removes node from the receiver. More... | |
void | removeFromParent () |
Removes the receiver from its parent. More... | |
void | setParent (BaseTree *newParent) |
Sets the parent of the receiver to newParent . More... | |
void | clear () |
Deletes all children from the tree. More... | |
List functions | |
virtual size_t | size () const __attribute__((__deprecated__("use childrenSize() for the number of children"))) |
deprecated - use childrenSize() for the number of children. More... | |
virtual size_t | childrenSize () const |
Returns the number of children BaseTree the receiver contains. More... | |
const_iterator | begin () const |
const_iterator | end () const |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
BaseTree element.
This class has to be derived to contain anything. The default BaseTree class only has the tree structure, which can be used alone.
A tree is a tree node like any other, therefore only one class is provided.
typedef std::list<BaseTree *>::const_iterator BaseTree::const_iterator |
typedef std::list<BaseTree *>::const_reverse_iterator BaseTree::const_reverse_iterator |
typedef std::list<BaseTree *>::iterator BaseTree::iterator |
typedef std::list<BaseTree *>::reverse_iterator BaseTree::reverse_iterator |
|
inline |
|
virtual |
|
inline |
Definition at line 173 of file base.h.
Referenced by Tree::Tree().
const std::list<BaseTree *>& BaseTree::children | ( | ) | const |
|
inlinevirtual |
void BaseTree::clear | ( | ) |
Deletes all children from the tree.
|
inline |
Definition at line 179 of file base.h.
Referenced by Tree::Tree().
|
inline |
|
inline |
int BaseTree::getIndex | ( | BaseTree * | node | ) | const |
Returns the index of node
in the receivers children.
|
inline |
const BaseTree* BaseTree::getTopParent | ( | ) | const |
Returns the top-level parent of the receiver (const version)
void BaseTree::insert | ( | BaseTree * | child, |
int | index = -1 |
||
) |
Adds child
to the receiver at index
(default: end)
|
inline |
|
inline |
void BaseTree::remove | ( | unsigned | index | ) |
Removes the child at index index
from the receiver.
void BaseTree::remove | ( | BaseTree * | node | ) |
Removes node
from the receiver.
|
inline |
|
inline |
|
inline |
|
inlinevirtual |