#include <TreeItem.h>

Public Member Functions | |
| TreeItem (const PAYLOAD &val, TreeItem< PAYLOAD > *parent=0) | |
| virtual | ~TreeItem () |
| const PAYLOAD & | value () const |
| void | setValue (PAYLOAD newValue) |
| TreeItem< PAYLOAD > * | parent () const |
| TreeItem< PAYLOAD > * | next () const |
| TreeItem< PAYLOAD > * | firstChild () const |
| void | setParent (TreeItem< PAYLOAD > *newParent) |
| void | setNext (TreeItem< PAYLOAD > *newNext) |
| void | setFirstChild (TreeItem< PAYLOAD > *newFirstChild) |
| void | addChild (TreeItem< PAYLOAD > *newChild) |
| bool | isChildOf (const TreeItem< PAYLOAD > *maybeParent) const |
Protected Member Functions | |
| TreeItem (PAYLOAD val, bool autoAddChild, TreeItem< PAYLOAD > *parent=0) | |
Protected Attributes | |
| PAYLOAD | _value |
| TreeItem< PAYLOAD > * | _parent |
| TreeItem< PAYLOAD > * | _next |
| TreeItem< PAYLOAD > * | _firstChild |
Private Member Functions | |
| TreeItem (const TreeItem< PAYLOAD > &) | |
| TreeItem< PAYLOAD > & | operator= (const TreeItem< PAYLOAD > &) |
Class 'PAYLOAD' needs to provide operator=().
| TreeItem< PAYLOAD >::TreeItem | ( | const PAYLOAD & | val, | |
| TreeItem< PAYLOAD > * | parent = 0 | |||
| ) | [inline] |
Constructor. Creates a new tree item with value "val" and inserts it (without maintaining any meaningful sort order!) into the children list of "parent".
| TreeItem< PAYLOAD >::TreeItem | ( | PAYLOAD | val, | |
| bool | autoAddChild, | |||
| TreeItem< PAYLOAD > * | parent = 0 | |||
| ) | [inline, protected] |
Constructor to be called for derived classes: Decide whether or not to automatically insert this item into the parent's children list. Useful for derived classes that want to maintain a specific sort order among children.
| TreeItem< PAYLOAD >::TreeItem | ( | const TreeItem< PAYLOAD > & | ) | [inline, private] |
Private (i.e. disabled) copy constructor and operator=()
Destructor. Takes care of children - they will be deleted along with this item.
| TreeItem<PAYLOAD>& TreeItem< PAYLOAD >::operator= | ( | const TreeItem< PAYLOAD > & | ) | [inline, private] |
| const PAYLOAD& TreeItem< PAYLOAD >::value | ( | ) | const [inline] |
Returns this item's value, the "payload".
References TreeItem< PAYLOAD >::_value.
Referenced by findDirectChild(), and SortedTreeItem< PAYLOAD >::insertChildSorted().
| void TreeItem< PAYLOAD >::setValue | ( | PAYLOAD | newValue | ) | [inline] |
Set this item's value, the "payload".
If the sort order among children of one level is important, overwrite this method and change the sort order according to the new value. The template class itself never calls this.
References TreeItem< PAYLOAD >::_value.
Returns this item's parent or 0 if there is none.
Reimplemented in SortedTreeItem< PAYLOAD >.
References TreeItem< PAYLOAD >::_parent.
Referenced by TreeItem< PAYLOAD >::isChildOf().
Returns this item's next sibling or 0 if there is none.
Reimplemented in SortedTreeItem< PAYLOAD >.
References TreeItem< PAYLOAD >::_next.
Referenced by findDirectChild(), and SortedTreeItem< PAYLOAD >::insertChildSorted().
Returns this item's first child or 0 if there is none.
Reimplemented in SortedTreeItem< PAYLOAD >.
References TreeItem< PAYLOAD >::_firstChild.
Referenced by TreeItem< PAYLOAD >::addChild(), and findDirectChild().
| void TreeItem< PAYLOAD >::setParent | ( | TreeItem< PAYLOAD > * | newParent | ) | [inline] |
Sets this item's parent.
References TreeItem< PAYLOAD >::_parent.
| void TreeItem< PAYLOAD >::setNext | ( | TreeItem< PAYLOAD > * | newNext | ) | [inline] |
Sets this item's next sibling.
References TreeItem< PAYLOAD >::_next.
Referenced by TreeItem< PAYLOAD >::addChild(), and SortedTreeItem< PAYLOAD >::insertChildSorted().
| void TreeItem< PAYLOAD >::setFirstChild | ( | TreeItem< PAYLOAD > * | newFirstChild | ) | [inline] |
Sets this item's first child.
References TreeItem< PAYLOAD >::_firstChild.
Referenced by TreeItem< PAYLOAD >::addChild(), and SortedTreeItem< PAYLOAD >::insertChildSorted().
| void TreeItem< PAYLOAD >::addChild | ( | TreeItem< PAYLOAD > * | newChild | ) | [inline] |
Add a child to the internal children list - usually called from within the child's default constructor.
This default method does not maintain any meaningful sorting order - derived classes that require this might want to use the other constructor (with 'autoAddChild' set to 'false') take care of child insertion themselves.
References TreeItem< PAYLOAD >::firstChild(), TreeItem< PAYLOAD >::setFirstChild(), and TreeItem< PAYLOAD >::setNext().
| bool TreeItem< PAYLOAD >::isChildOf | ( | const TreeItem< PAYLOAD > * | maybeParent | ) | const [inline] |
Check if this item is direct or indirect child of 'maybeParent' - or even the same.
References TreeItem< PAYLOAD >::parent().
Referenced by TreeItem< PAYLOAD >::setValue(), and TreeItem< PAYLOAD >::value().
Referenced by SortedTreeItem< PAYLOAD >::next(), TreeItem< PAYLOAD >::next(), and TreeItem< PAYLOAD >::setNext().
TreeItem<PAYLOAD>* TreeItem< PAYLOAD >::_firstChild [protected] |
1.5.6