template<class T> class tree

A generic tree container.

Public Methods

[more]void set_root(const T& root_data)
Sets the root of the tree to the given item.
[more]bool has_root() const
Returns true if this tree has a root
[more]T& get_root()
Returns a reference to the root of this tree
[more]T get_root() const
Returns a reference to the root of this tree
[more]unsigned int size() const
Returns the number of items in the tree
[more]iterator begin()
Returns a basic iterator to the beginning of the tree
[more]iterator end()
Returns a basic iterator to the end of the tree
[more]layer_iterator layer_begin()
Returns a layer iterator to the beginning of the tree
[more]layer_iterator layer_end()
Returns a layer iterator to the end of the tree
[more]reverse_iterator rbegin()
Returns a reverse basic iterator to the end of the list
[more]reverse_iterator rend()
Returns a reverse basic iterator to the beginning of the list
[more]reverse_layer_iterator rlayer_begin()
Returns a reverse layer iterator to the end of the list
[more]reverse_layer_iterator rlayer_end()
Returns a reverse layer iterator to the beginning of the list
[more]iterator_range get_child_range(const iterator& parent_iter)
Returns an iterator range which refers to all of the children of the item at the given parent iterator
[more]reverse_iterator_range get_reverse_child_range(const iterator& parent_iter)
Returns a reverse iterator range which refers to all of the children of the item at the given parent iterator
[more]layer_iterator_range get_child_layer_range(const iterator& parent_iter)
Returns a layer iterator range which refers to all of the children of the item at the given parent iterator
[more]reverse_layer_iterator_range get_reverse_child_layer_range(const iterator& parent_iter)
Returns a reverse layer iterator range which refers to all of the children of the item at the given parent iterator
[more]void clear()
Destroys all the elements in the tree
[more]iterator find_item(const T& item)
Returns an iterator that refers to the given item in the list.
[more]void insert_first(iterator parent, const T& item)
Insert the item as a child of the node refered to by the parent iterator.
[more]void insert_first(const T& parent, const T& item)
Insert the item as a child of the node refered to the item parent.
[more]void insert_last(iterator parent, const T& item)
Insert the item as a child of the node refered to by the parent iterator.
[more]void insert_last(const T& parent, const T& item)
Insert the item as a child of the node refered to the item parent.
[more]void erase(iterator iter)
Removes an item from the list
[more]void move_backward(iterator self_iter)
Moves an element towards the back of the child order
[more]void move_to_back(iterator self_iter)
Moves an element to the back of the child order
[more]void move_forward(iterator self_iter)
Moves an element toward the front of the child order
[more]void move_to_front(iterator self_iter)
Moves an element to the front of the child order

Public Members

class iterator
The basic tree iterator type.
class layer_iterator
A special iterator that mimics the interface of the standard iterator but the increment and decrement operators move by sibling.
[more]typedef range<iterator> iterator_range
A range of basic iterators
[more]typedef range<layer_iterator> layer_iterator_range
A range of layer iterators
[more]typedef range<reverse_iterator> reverse_iterator_range
A range of reverse basic iterators
[more]typedef range<reverse_layer_iterator> reverse_layer_iterator_range
A range of reverse layer iterators


Documentation

A generic tree container. Allows you to build a tree were each node can have any number of children. It is stored in parent-before-child order and also allows iterating in a layered fashion from sibling to sibling.
ovoid set_root(const T& root_data)
Sets the root of the tree to the given item. A tree cannot be used until it has a root.

obool has_root() const
Returns true if this tree has a root

oT& get_root()
Returns a reference to the root of this tree

oT get_root() const
Returns a reference to the root of this tree

ounsigned int size() const
Returns the number of items in the tree

otypedef range<iterator> iterator_range
A range of basic iterators

otypedef range<layer_iterator> layer_iterator_range
A range of layer iterators

otypedef range<reverse_iterator> reverse_iterator_range
A range of reverse basic iterators

otypedef range<reverse_layer_iterator> reverse_layer_iterator_range
A range of reverse layer iterators

oiterator begin()
Returns a basic iterator to the beginning of the tree

oiterator end()
Returns a basic iterator to the end of the tree

olayer_iterator layer_begin()
Returns a layer iterator to the beginning of the tree

olayer_iterator layer_end()
Returns a layer iterator to the end of the tree

oreverse_iterator rbegin()
Returns a reverse basic iterator to the end of the list

oreverse_iterator rend()
Returns a reverse basic iterator to the beginning of the list

oreverse_layer_iterator rlayer_begin()
Returns a reverse layer iterator to the end of the list

oreverse_layer_iterator rlayer_end()
Returns a reverse layer iterator to the beginning of the list

oiterator_range get_child_range(const iterator& parent_iter)
Returns an iterator range which refers to all of the children of the item at the given parent iterator

oreverse_iterator_range get_reverse_child_range(const iterator& parent_iter)
Returns a reverse iterator range which refers to all of the children of the item at the given parent iterator

olayer_iterator_range get_child_layer_range(const iterator& parent_iter)
Returns a layer iterator range which refers to all of the children of the item at the given parent iterator

oreverse_layer_iterator_range get_reverse_child_layer_range(const iterator& parent_iter)
Returns a reverse layer iterator range which refers to all of the children of the item at the given parent iterator

ovoid clear()
Destroys all the elements in the tree

oiterator find_item(const T& item)
Returns an iterator that refers to the given item in the list. If the item is not present in the list it will return end().

ovoid insert_first(iterator parent, const T& item)
Insert the item as a child of the node refered to by the parent iterator. It will be inserted as the first child to this parent.

See Also:
insert_last

ovoid insert_first(const T& parent, const T& item)
Insert the item as a child of the node refered to the item parent. It will be inserted as the first child to this parent.

See Also:
insert_last

ovoid insert_last(iterator parent, const T& item)
Insert the item as a child of the node refered to by the parent iterator. It will be inserted as the last child to this parent.

See Also:
insert_first

ovoid insert_last(const T& parent, const T& item)
Insert the item as a child of the node refered to the item parent. It will be inserted as the last child to this parent.

See Also:
insert_first

ovoid erase(iterator iter)
Removes an item from the list

ovoid move_backward(iterator self_iter)
Moves an element towards the back of the child order

ovoid move_to_back(iterator self_iter)
Moves an element to the back of the child order

ovoid move_forward(iterator self_iter)
Moves an element toward the front of the child order

ovoid move_to_front(iterator self_iter)
Moves an element to the front of the child order


This class has no child classes.
Friends:
class iterator

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.