Code::Blocks
SVN r11506
|
SearchTreeIterator lets us iterate through the nodes of a BasicSearchTree. More...
#include <searchtree.h>
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 nSearchTreeNode & | operator* () const |
overload the *() operator, get the node index pointed by the iterator More... | |
const BasicSearchTreeIterator & | operator++ () |
go to next node More... | |
const BasicSearchTreeIterator & | operator-- () |
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... | |
BasicSearchTree * | m_Tree |
whether the iterator reaches end of tree More... | |
size_t | m_LastTreeSize |
pointer to tree instance More... | |
SearchTreeNode * | m_LastAddedNode |
For checking validity. More... | |
SearchTreeIterator lets us iterate through the nodes of a BasicSearchTree.
Definition at line 57 of file searchtree.h.
BasicSearchTreeIterator::BasicSearchTreeIterator | ( | ) |
default constructor
Definition at line 15 of file searchtree.cpp.
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.
|
inlinevirtual |
destructor
Definition at line 67 of file searchtree.h.
References FindNext(), FindPrev(), and IsValid().
|
inline |
reach the end of the tree
Definition at line 95 of file searchtree.h.
References IsValid(), and m_Eof.
Referenced by BasicSearchTree::FindMatches().
bool BasicSearchTreeIterator::FindNext | ( | bool | includechildren = true | ) |
Definition at line 93 of file searchtree.cpp.
References FindNextSibling(), BasicSearchTree::GetNode(), IsValid(), SearchTreeNode::m_Children, m_CurNode, m_Eof, SearchTreeNode::m_Parent, and m_Tree.
Referenced by BasicSearchTree::FindMatches(), operator++(), and ~BasicSearchTreeIterator().
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--().
bool BasicSearchTreeIterator::FindPrev | ( | bool | includechildren = true | ) |
Definition at line 46 of file searchtree.cpp.
References FindPrevSibling(), BasicSearchTree::GetNode(), IsValid(), SearchTreeNode::m_Children, m_CurNode, m_Eof, SearchTreeNode::m_Parent, and m_Tree.
Referenced by operator--(), and ~BasicSearchTreeIterator().
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--().
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--().
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().
|
inline |
overload the *() operator, get the node index pointed by the iterator
Definition at line 77 of file searchtree.h.
References m_CurNode.
|
inline |
|
inline |
go to previous node
Definition at line 83 of file searchtree.h.
References FindNextSibling(), FindPrev(), FindPrevSibling(), and FindSibling().
|
protected |
Definition at line 98 of file searchtree.h.
Referenced by FindNext(), FindNextSibling(), FindPrev(), FindPrevSibling(), FindSibling(), and operator*().
|
protected |
current pointed node index
Definition at line 99 of file searchtree.h.
Referenced by Eof(), FindNext(), FindNextSibling(), FindPrev(), FindPrevSibling(), and FindSibling().
|
protected |
For checking validity.
Definition at line 102 of file searchtree.h.
Referenced by BasicSearchTreeIterator(), and IsValid().
|
protected |
pointer to tree instance
Definition at line 101 of file searchtree.h.
Referenced by BasicSearchTreeIterator(), and IsValid().
|
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().