graph 6.0.0
Graph: generic attributed relational graphs
Tree Class Reference

Attributed tree element. More...

#include <graph/tree/tree.h>

Inheritance diagram for Tree:
Collaboration diagram for Tree:

Public Member Functions

 Tree (bool allowChildren=true, const std::string &str="")
 
virtual ~Tree ()
 
- Public Member Functions inherited from carto::SyntaxedObject< PropertySet >
 SyntaxedObject (const std::string &s)
 
 SyntaxedObject (const SyntaxedObject &x)
 
 SyntaxedObject (const SyntaxedObject< PropertySet > &x)
 
 SyntaxedObject (const std::string &s)
 
 SyntaxedObject (const SyntaxedObject &x)
 
 SyntaxedObject (const SyntaxedObject< PropertySet > &x)
 
- Public Member Functions inherited from BaseTree
 BaseTree (bool allowsChildren=true)
 Constructor.
 
virtual ~BaseTree ()
 
const std::list< BaseTree * > & children () const
 
bool getAllowsChildren () const
 Returns true if the receiver allows children.
 
BaseTreegetChildAt (unsigned childIndex) const
 Returns the child BaseTree pointer at index childIndex.
 
int getIndex (BaseTree *node) const
 Returns the index of node in the receivers children.
 
BaseTreegetParent () const
 Returns the parent BaseTree of the receiver.
 
BaseTreegetTopParent ()
 Returns the top-level parent BaseTree of the receiver.
 
const BaseTreegetTopParent () const
 Returns the top-level parent of the receiver (const version)
 
bool isLeaf () const
 Returns true if the receiver is a leaf (terminal node)
 
void insert (BaseTree *child, int index=-1)
 Adds child to the receiver at index (default: end)
 
void remove (unsigned index)
 Removes the child at index index from the receiver.
 
void remove (BaseTree *node)
 Removes node from the receiver.
 
void removeFromParent ()
 Removes the receiver from its parent.
 
void setParent (BaseTree *newParent)
 Sets the parent of the receiver to newParent.
 
void clear ()
 Deletes all children from the tree.
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 

Visitor pattern

virtual void accept (TreeVisitor &visitor)
 
virtual void const_accept (ConstTreeVisitor &visitor) const
 
virtual bool check (const carto::SyntaxSet &syntax, std::set< std::string > &missing) const
 
std::set< Tree * > getElementsWith (const std::string &, bool recurse=true) const
 
template<class T>
std::set< Tree * > getElementsWith (const std::string &, const T &, bool recurse=true) const
 
virtual size_t size () const __attribute__((__deprecated__))
 deprecated
 
virtual size_t childrenSize () const
 Returns the number of children BaseTree the receiver contains.
 

Additional Inherited Members

- Public Types inherited from carto::SyntaxedObject< PropertySet >
typedef internal::SyntaxedObjectSwitch< T, SUPERSUBCLASS(Interface, T)>::ContentType ContentType
 
- Public Types inherited from BaseTree
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
 

Detailed Description

Attributed tree element.

Definition at line 60 of file tree.h.

Constructor & Destructor Documentation

◆ Tree()

Tree::Tree ( bool allowChildren = true,
const std::string & str = "" )
inline

Definition at line 102 of file tree.h.

References BaseTree::BaseTree().

Referenced by childrenSize().

◆ ~Tree()

virtual Tree::~Tree ( )
virtual

Member Function Documentation

◆ accept()

virtual void Tree::accept ( TreeVisitor & visitor)
virtual

◆ check()

virtual bool Tree::check ( const carto::SyntaxSet & syntax,
std::set< std::string > & missing ) const
virtual

◆ childrenSize()

virtual size_t Tree::childrenSize ( ) const
virtual

Returns the number of children BaseTree the receiver contains.

Reimplemented from BaseTree.

References Tree().

◆ const_accept()

virtual void Tree::const_accept ( ConstTreeVisitor & visitor) const
virtual

◆ getElementsWith() [1/2]

std::set< Tree * > Tree::getElementsWith ( const std::string & ,
bool recurse = true ) const

References getElementsWith().

Referenced by getElementsWith().

◆ getElementsWith() [2/2]

template<class T>
std::set< Tree * > Tree::getElementsWith ( const std::string & s,
const T & t,
bool recurse = true ) const
inline

Definition at line 138 of file tree.h.

◆ size()

virtual size_t Tree::size ( ) const
virtual

deprecated

Reimplemented from BaseTree.


The documentation for this class was generated from the following file: