template<class T> class tree
A generic tree container.
Public Methods
-
void set_root(const T& root_data)
- Sets the root of the tree to the given item.
-
bool has_root() const
- Returns true if this tree has a root
-
T& get_root()
- Returns a reference to the root of this tree
-
T get_root() const
- Returns a reference to the root of this tree
-
unsigned int size() const
- Returns the number of items in the tree
-
iterator begin()
- Returns a basic iterator to the beginning of the tree
-
iterator end()
- Returns a basic iterator to the end of the tree
-
layer_iterator layer_begin()
- Returns a layer iterator to the beginning of the tree
-
layer_iterator layer_end()
- Returns a layer iterator to the end of the tree
-
reverse_iterator rbegin()
- Returns a reverse basic iterator to the end of the list
-
reverse_iterator rend()
- Returns a reverse basic iterator to the beginning of the list
-
reverse_layer_iterator rlayer_begin()
- Returns a reverse layer iterator to the end of the list
-
reverse_layer_iterator rlayer_end()
- Returns a reverse layer iterator to the beginning of the list
-
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
-
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
-
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
-
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
-
void clear()
- Destroys all the elements in the tree
-
iterator find_item(const T& item)
- Returns an iterator that refers to the given item in the list.
-
void insert_first(iterator parent, const T& item)
- Insert the item as a child of the node refered to by the parent iterator.
-
void insert_first(const T& parent, const T& item)
- Insert the item as a child of the node refered to the item parent.
-
void insert_last(iterator parent, const T& item)
- Insert the item as a child of the node refered to by the parent iterator.
-
void insert_last(const T& parent, const T& item)
- Insert the item as a child of the node refered to the item parent.
-
void erase(iterator iter)
- Removes an item from the list
-
void move_backward(iterator self_iter)
- Moves an element towards the back of the child order
-
void move_to_back(iterator self_iter)
- Moves an element to the back of the child order
-
void move_forward(iterator self_iter)
- Moves an element toward the front of the child order
-
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.
-
typedef range<iterator> iterator_range
- A range of basic iterators
-
typedef range<layer_iterator> layer_iterator_range
- A range of layer iterators
-
typedef range<reverse_iterator> reverse_iterator_range
- A range of reverse basic iterators
-
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.
- void 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.
- bool has_root() const
- Returns true if this tree has a root
- T& get_root()
- Returns a reference to the root of this tree
- T get_root() const
- Returns a reference to the root of this tree
- unsigned int size() const
- Returns the number of items in the tree
- typedef range<iterator> iterator_range
- A range of basic iterators
- typedef range<layer_iterator> layer_iterator_range
- A range of layer iterators
- typedef range<reverse_iterator> reverse_iterator_range
- A range of reverse basic iterators
- typedef range<reverse_layer_iterator> reverse_layer_iterator_range
- A range of reverse layer iterators
- iterator begin()
- Returns a basic iterator to the beginning of the tree
- iterator end()
- Returns a basic iterator to the end of the tree
- layer_iterator layer_begin()
- Returns a layer iterator to the beginning of the tree
- layer_iterator layer_end()
- Returns a layer iterator to the end of the tree
- reverse_iterator rbegin()
- Returns a reverse basic iterator to the end of the list
- reverse_iterator rend()
- Returns a reverse basic iterator to the beginning of the list
- reverse_layer_iterator rlayer_begin()
- Returns a reverse layer iterator to the end of the list
- reverse_layer_iterator rlayer_end()
- Returns a reverse layer iterator to the beginning of the list
- 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
- 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
- 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
- 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
- void clear()
- Destroys all the elements in the tree
- iterator 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().
- void 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
- void 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
- void 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
- void 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
- void erase(iterator iter)
- Removes an item from the list
- void move_backward(iterator self_iter)
- Moves an element towards the back of the child order
- void move_to_back(iterator self_iter)
- Moves an element to the back of the child order
- void move_forward(iterator self_iter)
- Moves an element toward the front of the child order
- void 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++.