CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csTreeNode Class Reference

A generic tree class. More...

#include <tree.h>

List of all members.

Public Methods

bool IsLeaf ()
 Returns true if this node has no children. More...

void RemoveChild (csTreeNode *child)
 Remove a child node. More...

void AddChild (csTreeNode *child)
 Add a child node. More...

 csTreeNode (csTreeNode *theParent=NULL)
 Create node, optionally as a child of theParent. More...

csTreeNode * DSF (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. More...

csTreeNode * BSF (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. More...


Detailed Description

A generic tree class.

Definition at line 27 of file tree.h.


Constructor & Destructor Documentation

csTreeNode::csTreeNode csTreeNode *    theParent = NULL [inline]
 

Create node, optionally as a child of theParent.

Definition at line 44 of file tree.h.

References children, and csBasicVector::Push.


Member Function Documentation

void csTreeNode::AddChild csTreeNode *    child [inline]
 

Add a child node.

Definition at line 40 of file tree.h.

References parent, and csBasicVector::Push.

csTreeNode* csTreeNode::BSF bool(*    TreeFunc)(csTreeNode *node, void *param, bool stopOnSuccess),
bool(*    SelBranch)(csTreeNode *node),
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. NULL means all children.

Definition at line 89 of file tree.h.

References children, csVector::Delete, csVector::DeleteAll, csBasicVector::Get, IsLeaf, csBasicVector::Length, and csBasicVector::Push.

csTreeNode* csTreeNode::DSF bool(*    TreeFunc)(csTreeNode *node, void *param, bool stopOnSuccess),
bool(*    SelBranch)(csTreeNode *node),
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 investugation. NULL means all children.

Definition at line 63 of file tree.h.

References csBasicVector::Get, and csBasicVector::Length.

bool csTreeNode::IsLeaf   [inline]
 

Returns true if this node has no children.

Definition at line 32 of file tree.h.

References csBasicVector::Length.

Referenced by BSF.

void csTreeNode::RemoveChild csTreeNode *    child [inline]
 

Remove a child node.

Definition at line 36 of file tree.h.

References csVector::Delete, and csBasicVector::Find.


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