DSRTreeNodeCursor Class Reference

Class implementing a tree node cursor. More...

Inheritance diagram for DSRTreeNodeCursor:

DSRTree DSRDocumentTree List of all members.

Public Member Functions

 DSRTreeNodeCursor ()
 default constructor
 DSRTreeNodeCursor (const DSRTreeNodeCursor &cursor)
 copy constructor
 DSRTreeNodeCursor (DSRTreeNode *node)
 constructor
virtual ~DSRTreeNodeCursor ()
 destructor
DSRTreeNodeCursoroperator= (const DSRTreeNodeCursor &cursor)
 assignment operator
DSRTreeNodeCursoroperator= (DSRTreeNode *node)
 assignment operator
virtual void clear ()
 clear all member variables
virtual OFBool isValid () const
 check whether cursor currently points to a valid node
DSRTreeNodegetNode () const
 get pointer to current node
const DSRTreeNodegetParentNode ()
 get pointer to parent node.
const DSRTreeNodegetNextNode () const
 get pointer to next node.
size_t gotoPrevious ()
 goto previous node on the same level
size_t gotoNext ()
 goto next node on the same level
size_t goUp ()
 goto parent node (one level up)
size_t goDown ()
 goto first child node (one level down)
size_t iterate (const OFBool searchIntoSub=OFTrue)
 iterate over all nodes.
size_t gotoNode (const size_t searchID)
 set cursor to specified node.
size_t gotoNode (const OFString &position, const char separator= '.')
 set cursor to specified node.
size_t getNodeID () const
 get current node ID.
size_t getLevel () const
 get current level.
const OFStringgetPosition (OFString &position, const char separator= '.') const
 get position string of the current node.

Protected Member Functions

void clearNodeCursorStack ()
 clear the internal node cursor stack
size_t setCursor (DSRTreeNode *node)
 set cursor to specified node.

Protected Attributes

DSRTreeNodeNodeCursor
 pointer current node
OFStack< DSRTreeNodePointerNodeCursorStack
 stack of node pointers. Used to store the cursor position of upper levels.
size_t Position
 current position within the current level
OFList< size_t > PositionList
 list of position counters in upper levels

Detailed Description

Class implementing a tree node cursor.

Definition at line 62 of file dsrtncsr.h.


Constructor & Destructor Documentation

DSRTreeNodeCursor::DSRTreeNodeCursor ( const DSRTreeNodeCursor cursor  ) 

copy constructor

Parameters:
cursor object to be copied

DSRTreeNodeCursor::DSRTreeNodeCursor ( DSRTreeNode node  ) 

constructor

Parameters:
node pointer tree node used to initialize the cursor (set to this node)


Member Function Documentation

DSRTreeNodeCursor& DSRTreeNodeCursor::operator= ( const DSRTreeNodeCursor cursor  ) 

assignment operator

Parameters:
cursor object to be copied
Returns:
reference to modified cursor (this object)

DSRTreeNodeCursor& DSRTreeNodeCursor::operator= ( DSRTreeNode node  ) 

assignment operator

Parameters:
node node to which the cursor should be set
Returns:
reference to modified cursor (this object)

virtual OFBool DSRTreeNodeCursor::isValid (  )  const [virtual]

check whether cursor currently points to a valid node

Returns:
OFTrue if valid, OFFalse otherwise

Reimplemented in DSRDocumentTree.

DSRTreeNode* DSRTreeNodeCursor::getNode (  )  const [inline]

get pointer to current node

Returns:
pointer to current node (might be NULL)

Definition at line 109 of file dsrtncsr.h.

References NodeCursor.

const DSRTreeNode* DSRTreeNodeCursor::getParentNode (  ) 

get pointer to parent node.

Used to have a lookup to the parent node without changing the cursor.

Returns:
pointer to parent node (if any), NULL otherwise

const DSRTreeNode* DSRTreeNodeCursor::getNextNode (  )  const

get pointer to next node.

Used to have a lookup to the next node without changing the cursor.

Returns:
pointer to next node (if any), NULL otherwise

size_t DSRTreeNodeCursor::gotoPrevious (  ) 

goto previous node on the same level

Returns:
ID of the previous node if successful, 0 otherwise

size_t DSRTreeNodeCursor::gotoNext (  ) 

goto next node on the same level

Returns:
ID of the next node if successful, 0 otherwise

size_t DSRTreeNodeCursor::goUp (  ) 

goto parent node (one level up)

Returns:
ID of the parent node if successful, 0 otherwise

size_t DSRTreeNodeCursor::goDown (  ) 

goto first child node (one level down)

Returns:
ID of the first child node if successful, 0 otherwise

size_t DSRTreeNodeCursor::iterate ( const OFBool  searchIntoSub = OFTrue  ) 

iterate over all nodes.

Starts from current position!

Parameters:
searchIntoSub flag indicating whether to search into sub-trees ("deep search") or on the current level only
Returns:
ID of the next node if successful, 0 otherwise

size_t DSRTreeNodeCursor::gotoNode ( const size_t  searchID  ) 

set cursor to specified node.

Starts from current position!

Parameters:
searchID ID of the node to set the cursor to
Returns:
ID of the new current node if successful, 0 otherwise

size_t DSRTreeNodeCursor::gotoNode ( const OFString position,
const char  separator = '.' 
)

set cursor to specified node.

Starts from current position!

Parameters:
position position string of the node to set the cursor to. (the format is e.g. "1.2.3" for the third child of the second child of the first node - see getPosition()).
separator character used to separate the figures (default: '.')
Returns:
ID of the new current node if successful, 0 otherwise

size_t DSRTreeNodeCursor::getNodeID (  )  const

get current node ID.

The node ID uniquely identifies a content item in the document tree. Most of the navigation methods above do return this ID too.

Returns:
ID of the current node if valid, 0 otherwise

size_t DSRTreeNodeCursor::getLevel (  )  const

get current level.

The level starts with 1 for the root node, then 2 for its child nodes, etc.

Returns:
number of the current level if valid, 0 otherwise

const OFString& DSRTreeNodeCursor::getPosition ( OFString position,
const char  separator = '.' 
) const

get position string of the current node.

Specifies the position of each node by means of a dot separated string of position counters. The first figure of this string specifies the position within the first level (e.g. "1"), the second one the position in the second level (e.g. "2"), the third one the position in the third level (e.g. "3"), etc. A position string of "1.2.3" would, therefore, point to the third child of the second child of the first node.

Parameters:
position variable where the position string should be stored
separator character used to separate the figures (default: '.')
Returns:
reference to the resulting position string (empty if invalid)

size_t DSRTreeNodeCursor::setCursor ( DSRTreeNode node  )  [protected]

set cursor to specified node.

Clears the internal position list/stack and sets the position counter to 1.

Parameters:
node node to which the cursor should be set
Returns:
ID of the new current node if successful, 0 otherwise


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


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1