26 #ifndef __TERRALIB_COMMON_INTERNAL_COUNTEDTREEITEM_H
27 #define __TERRALIB_COMMON_INTERNAL_COUNTEDTREEITEM_H
37 #include <boost/intrusive_ptr.hpp>
66 typedef std::list<TreeItemPtr>::iterator
iterator;
176 std::list<TreeItemPtr>
remove(std::size_t i, std::size_t count);
A counted class keeps track of how many abstract instances are pointing to it.
A counted class keeps track of how many abstract instances are pointing to it.
This abstract class describes a basic item to be organized in a tree-oriented way.
void getDescendantsCount(std::size_t &count) const
It returns the number of nodes that descends from this node.
bool isSibling(const TreeItem *item) const
It checks if the given layer is sibling of this one.
TreeItem * getParent() const
It returns a pointer to the parent of this node.
void disconnect()
It disconnects this item from its parent, if it has one.
void swap(const TreeItemPtr &firstChild, const TreeItemPtr &secondChild)
It swaps the position of the given children.
bool hasChildren() const
It returns true if the item has descendants.
const_iterator begin() const
It returns the constant iterator associated to the first child of this item.
TreeItem * m_parent
A pointer to the parent node.
TreeItemPtr replace(std::size_t i, const TreeItemPtr &childItem)
It replaces the child item at the given position by the new one. The replaced item will be disconnect...
const_iterator end() const
It returns the constant iterator that refers to one past the end of the children of this item.
void setParent(TreeItem *parent)
It sets the parent of this item to the specified one. Don't use this method if you are not sure how t...
const TreeItemPtr & operator[](std::size_t i) const
It returns the n-th child.
std::list< TreeItemPtr > remove(std::size_t i, std::size_t count)
It removes from the given position a certain number of items as children of this item....
std::size_t getIndex() const
It returns the index of this item in the list of children of its parent item.
const std::list< TreeItemPtr > & getChildren() const
It returns the children of this tree item.
void insert(std::size_t i, const TreeItemPtr &childItem)
It inserts an item in the informed position.
void swap(const TreeItemPtr &sibling)
It swaps this item with its sibling in their parent node.
std::list< TreeItemPtr >::const_iterator const_iterator
std::list< TreeItemPtr > m_children
Pointers to the items that are children.
std::list< TreeItemPtr >::iterator iterator
TreeItem(TreeItem *parent=0)
It initializes a new item having a parent.
void add(const TreeItemPtr &childItem)
It adds (appends) the item to the end of the children's list.
const TreeItemPtr & getChild(std::size_t i) const
It returns the n-th child.
std::size_t getChildrenCount() const
It returns the number of children of this node.
iterator begin()
It returns the iterator associated to the first child of this item.
TreeItemPtr remove(std::size_t i)
It removes the i-th child.
virtual ~TreeItem()
Virtual destructor.
TreeItem(const TreeItemPtr &parent)
It initializes a new item having a parent.
iterator end()
It returns the iterator that refers to one past the children of this item.
static const std::size_t npos
A value to indicate no match.
boost::intrusive_ptr< TreeItem > TreeItemPtr
#define TECOMMONEXPORT
You can use this macro in order to export/import classes and functions from this module.
Proxy configuration file for TerraView (see terraview_config.h).