CrystalSpace

Public API Reference

csTreeNode Class Reference

A generic tree class. More...

#include <csutil/tree.h>

Inheritance diagram for csTreeNode:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void AddChild (csTreeNode *child)
 Add a child node.
csTreeNodeBSF (bool(*TreeFunc)(csTreeNode *node, void *param, bool stopOnSuccess), bool(*SelBranch)(csTreeNode *node), void *param, bool stopOnSuccess)
 Execute a function on this node and its children.
 csTreeNode (csTreeNode *theParent=0)
 Create node, optionally as a child of theParent.
csTreeNodeDSF (bool(*TreeFunc)(csTreeNode *node, void *param, bool stopOnSuccess), bool(*SelBranch)(csTreeNode *node), void *param, bool stopOnSuccess)
 Execute a function on this node and its children.
bool IsLeaf ()
 Returns true if this node has no children.
void RemoveChild (csTreeNode *child)
 Remove a child node.
virtual ~csTreeNode ()

Public Attributes

csArray< csTreeNode * > children
csTreeNodeparent


Detailed Description

A generic tree class.

Definition at line 32 of file tree.h.


Constructor & Destructor Documentation

csTreeNode::csTreeNode ( csTreeNode theParent = 0  )  [inline]

Create node, optionally as a child of theParent.

Definition at line 51 of file tree.h.

References children, parent, and csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::Push().


Member Function Documentation

void csTreeNode::AddChild ( csTreeNode child  )  [inline]

Add a child node.

Definition at line 47 of file tree.h.

References children, parent, and csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::Push().

csTreeNode* csTreeNode::BSF ( bool(*)(csTreeNode *node, void *param, bool stopOnSuccess)  TreeFunc,
bool(*)(csTreeNode *node)  SelBranch,
void *  param,
bool  stopOnSuccess 
) [inline]

Execute a function on this node and its children.

Do this in "BreadthSearchFirst" order, that is check first all direct children before diving into subchildren. Returns the last node where TreeFunc resulted in TRUE. If stopOnSuccess is true, then execution is stoped after first successful execution of TreeFunc. SelBranch lets you decide which children to select for further investugation. 0 means all children.

Definition at line 104 of file tree.h.

References children, csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::DeleteAll(), csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::DeleteIndex(), csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::GetSize(), IsLeaf(), and csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::Push().

csTreeNode* csTreeNode::DSF ( bool(*)(csTreeNode *node, void *param, bool stopOnSuccess)  TreeFunc,
bool(*)(csTreeNode *node)  SelBranch,
void *  param,
bool  stopOnSuccess 
) [inline]

Execute a function on this node and its children.

Do this in "DepthSearchFirst" order, that is check a childs children before testing the next direct child. Returns the last node where TreeFunc resulted in TRUE. If stopOnSuccess is true, then execution is stoped after first successful execution of TreeFunc. SelBranch lets you decide which children to select for further investigation. 0 means all children.

Definition at line 73 of file tree.h.

References children, and csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::GetSize().

bool csTreeNode::IsLeaf (  )  [inline]

Returns true if this node has no children.

Definition at line 36 of file tree.h.

References children, and csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >::GetSize().

Referenced by BSF().

void csTreeNode::RemoveChild ( csTreeNode child  )  [inline]


The documentation for this class was generated from the following file:
Generated for Crystal Space 1.2.1 by doxygen 1.5.3