NodeScan Class Reference

Abstract base class for scans over sequences of nodes. More...

#include <ngiter.h>

Inheritance diagram for NodeScan:

BaseSelectScan CreateDisplayScan UndoableNodeScan SelectScan SelectUnionScan AllowOpScan ApplyScan HideScan SelectIntersectScan AllowOpSingleScan ApplySingleScan HidePropScan HideSingleScan ApplyPropScan List of all members.

Public Member Functions

 NodeScan (Source *ps)
 Constructs an NodeScan object.
virtual ~NodeScan ()
 Destroys an NodeScan object.
BOOL Scan ()
 Scans through the 'selected' document's tree extracting Nodes and calling the polymorphic Do function with them.

Protected Member Functions

virtual BOOL Pre ()
 Default override called by NodeScan::Scan prior to scanning the document.
virtual BOOL Do (Node *pNode)=0
virtual BOOL Post ()
 Default override called by NodeScan::Scan prior to scanning the document.

Private Attributes

Sourcem_pSource

Classes

class  Source
 Abstract base class for interfaces to SelRanges, Document trees etc whose nodes can be scanned over. Notes: If your derived class defines data members then remember to define a copy constructor and consider concurrency issues! More...

Detailed Description

Abstract base class for scans over sequences of nodes.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/7/99
See also:
NameGallery; NodeScan::Source

Definition at line 122 of file ngiter.h.


Constructor & Destructor Documentation

NodeScan::NodeScan NodeScan::Source ps  ) 
 

Constructs an NodeScan object.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/7/99
Parameters:
The source of objects over which to scan, eg. theSelectedDocument or [INPUTS] theSelectedObjects.
See also:
NodeScan::Source; DocTreeSource; RangeSource

Definition at line 209 of file ngiter.cpp.

00210   : m_pSource(ps)
00211 {
00212     // Empty.
00213 }

NodeScan::~NodeScan  )  [virtual]
 

Destroys an NodeScan object.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/7/99

Definition at line 225 of file ngiter.cpp.

00226 {
00227     // Empty.
00228 }


Member Function Documentation

virtual BOOL NodeScan::Do Node pNode  )  [protected, pure virtual]
 

Implemented in BaseSelectScan, AllowOpScan, AllowOpSingleScan, ApplyScan, ApplySingleScan, ApplyPropScan, HideScan, HidePropScan, HideSingleScan, and CreateDisplayScan.

BOOL NodeScan::Post  )  [protected, virtual]
 

Default override called by NodeScan::Scan prior to scanning the document.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/7/99
Returns:
TRUE to successfully finish scan, FALSE on error.

Reimplemented in BaseSelectScan, and CreateDisplayScan.

Definition at line 191 of file ngiter.cpp.

00192 {
00193     return TRUE;
00194 }

BOOL NodeScan::Pre  )  [protected, virtual]
 

Default override called by NodeScan::Scan prior to scanning the document.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/7/99
Returns:
TRUE to successfully start scan, FALSE on error.

Reimplemented in BaseSelectScan, and CreateDisplayScan.

Definition at line 175 of file ngiter.cpp.

00176 {
00177     return TRUE;
00178 }

BOOL NodeScan::Scan  ) 
 

Scans through the 'selected' document's tree extracting Nodes and calling the polymorphic Do function with them.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/7/99
Returns:
TRUE if scan terminated successfully, FALSE if the NodeScan cancelled the scan.

Definition at line 146 of file ngiter.cpp.

00147 {
00148     // Call Pre() before the scan.
00149     if (!Pre()) return FALSE;
00150 
00151     // Perform the appropriate type of scan.
00152     for (Node* pNode = m_pSource->GetFirst();
00153          pNode != 0;
00154          pNode = m_pSource->GetNext(pNode))
00155     {
00156         // NB. Post() not called if scan fails.
00157         if (!Do(pNode)) return FALSE;
00158     }
00159 
00160     // Call Post() after a successful scan.
00161     return Post();
00162 }


Member Data Documentation

Source* NodeScan::m_pSource [private]
 

Definition at line 159 of file ngiter.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:10 2007 for Camelot by  doxygen 1.4.4