Code::Blocks  SVN r11506
Public Member Functions | Protected Attributes | List of all members
BasicSearchTreeIterator Class Reference

SearchTreeIterator lets us iterate through the nodes of a BasicSearchTree. More...

#include <searchtree.h>

Collaboration diagram for BasicSearchTreeIterator:

Public Member Functions

 BasicSearchTreeIterator ()
 default constructor More...
 
 BasicSearchTreeIterator (BasicSearchTree *tree)
 constructor More...
 
virtual ~BasicSearchTreeIterator ()
 destructor More...
 
bool IsValid ()
 check to see whether the last newest added node is the last element of the node array More...
 
bool FindPrev (bool includechildren=true)
 
bool FindNext (bool includechildren=true)
 
const nSearchTreeNodeoperator* () const
 overload the *() operator, get the node index pointed by the iterator More...
 
const BasicSearchTreeIteratoroperator++ ()
 go to next node More...
 
const BasicSearchTreeIteratoroperator-- ()
 go to previous node More...
 
bool FindNextSibling ()
 go to the next node under the same parent's link map More...
 
bool FindPrevSibling ()
 go to the previous node under the same parent's link map More...
 
bool FindSibling (wxChar ch)
 check to see a sibling node with the first character 'ch' exists More...
 
bool Eof ()
 reach the end of the tree More...
 

Protected Attributes

nSearchTreeNode m_CurNode
 
bool m_Eof
 current pointed node index More...
 
BasicSearchTreem_Tree
 whether the iterator reaches end of tree More...
 
size_t m_LastTreeSize
 pointer to tree instance More...
 
SearchTreeNodem_LastAddedNode
 For checking validity. More...
 

Detailed Description

SearchTreeIterator lets us iterate through the nodes of a BasicSearchTree.

Definition at line 57 of file searchtree.h.

Constructor & Destructor Documentation

◆ BasicSearchTreeIterator() [1/2]

BasicSearchTreeIterator::BasicSearchTreeIterator ( )

default constructor

Definition at line 15 of file searchtree.cpp.

◆ BasicSearchTreeIterator() [2/2]

BasicSearchTreeIterator::BasicSearchTreeIterator ( BasicSearchTree tree)

constructor

Definition at line 24 of file searchtree.cpp.

References BasicSearchTree::GetNode(), m_LastAddedNode, m_LastTreeSize, BasicSearchTree::m_Nodes, and m_Tree.

◆ ~BasicSearchTreeIterator()

virtual BasicSearchTreeIterator::~BasicSearchTreeIterator ( )
inlinevirtual

destructor

Definition at line 67 of file searchtree.h.

References FindNext(), FindPrev(), and IsValid().

Member Function Documentation

◆ Eof()

bool BasicSearchTreeIterator::Eof ( )
inline

reach the end of the tree

Definition at line 95 of file searchtree.h.

References IsValid(), and m_Eof.

Referenced by BasicSearchTree::FindMatches().

◆ FindNext()

bool BasicSearchTreeIterator::FindNext ( bool  includechildren = true)

◆ FindNextSibling()

bool BasicSearchTreeIterator::FindNextSibling ( )

go to the next node under the same parent's link map

Definition at line 139 of file searchtree.cpp.

References SearchTreeNode::GetChar(), BasicSearchTree::GetNode(), SearchTreeNode::GetParent(), IsValid(), SearchTreeNode::m_Children, m_CurNode, m_Eof, and m_Tree.

Referenced by FindNext(), and operator--().

◆ FindPrev()

bool BasicSearchTreeIterator::FindPrev ( bool  includechildren = true)

◆ FindPrevSibling()

bool BasicSearchTreeIterator::FindPrevSibling ( )

go to the previous node under the same parent's link map

Definition at line 168 of file searchtree.cpp.

References SearchTreeNode::GetChar(), BasicSearchTree::GetNode(), SearchTreeNode::GetParent(), IsValid(), SearchTreeNode::m_Children, m_CurNode, m_Eof, and m_Tree.

Referenced by FindPrev(), and operator--().

◆ FindSibling()

bool BasicSearchTreeIterator::FindSibling ( wxChar  ch)

check to see a sibling node with the first character 'ch' exists

Definition at line 199 of file searchtree.cpp.

References BasicSearchTree::GetNode(), SearchTreeNode::GetParent(), IsValid(), SearchTreeNode::m_Children, m_CurNode, m_Eof, and m_Tree.

Referenced by operator--().

◆ IsValid()

bool BasicSearchTreeIterator::IsValid ( )

check to see whether the last newest added node is the last element of the node array

Definition at line 39 of file searchtree.cpp.

References m_LastAddedNode, m_LastTreeSize, BasicSearchTree::m_Nodes, and m_Tree.

Referenced by Eof(), FindNext(), FindNextSibling(), FindPrev(), FindPrevSibling(), FindSibling(), and ~BasicSearchTreeIterator().

◆ operator*()

const nSearchTreeNode& BasicSearchTreeIterator::operator* ( ) const
inline

overload the *() operator, get the node index pointed by the iterator

Definition at line 77 of file searchtree.h.

References m_CurNode.

◆ operator++()

const BasicSearchTreeIterator& BasicSearchTreeIterator::operator++ ( )
inline

go to next node

Definition at line 80 of file searchtree.h.

References FindNext().

◆ operator--()

const BasicSearchTreeIterator& BasicSearchTreeIterator::operator-- ( )
inline

go to previous node

Definition at line 83 of file searchtree.h.

References FindNextSibling(), FindPrev(), FindPrevSibling(), and FindSibling().

Member Data Documentation

◆ m_CurNode

nSearchTreeNode BasicSearchTreeIterator::m_CurNode
protected

◆ m_Eof

bool BasicSearchTreeIterator::m_Eof
protected

current pointed node index

Definition at line 99 of file searchtree.h.

Referenced by Eof(), FindNext(), FindNextSibling(), FindPrev(), FindPrevSibling(), and FindSibling().

◆ m_LastAddedNode

SearchTreeNode* BasicSearchTreeIterator::m_LastAddedNode
protected

For checking validity.

Definition at line 102 of file searchtree.h.

Referenced by BasicSearchTreeIterator(), and IsValid().

◆ m_LastTreeSize

size_t BasicSearchTreeIterator::m_LastTreeSize
protected

pointer to tree instance

Definition at line 101 of file searchtree.h.

Referenced by BasicSearchTreeIterator(), and IsValid().

◆ m_Tree

BasicSearchTree* BasicSearchTreeIterator::m_Tree
protected

whether the iterator reaches end of tree

Definition at line 100 of file searchtree.h.

Referenced by BasicSearchTreeIterator(), FindNext(), FindNextSibling(), FindPrev(), FindPrevSibling(), FindSibling(), and IsValid().


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