StripSubTreeRecordHandler Class Reference

This is the class is used to strip a subtree of records from the file. More...

#include <cxfrech.h>

Inheritance diagram for StripSubTreeRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 StripSubTreeRecordHandler ()
 Default constructor.
virtual UINT32GetTagList ()
 Provides the record handler system with a list of records handled by this handler.
virtual BOOL HandleRecord (CXaraFileRecord *pCXaraFileRecord)
 The main record handling function.
virtual BOOL IsTagInList (UINT32 Tag)
 This decides whether the given Tag should be handled by the sub tree stripper or not.
virtual BOOL BeginImport ()
 Informs the record handler that importing is about to begin.
virtual void IncProgressBarCount (UINT32 n)
virtual void StripSubTreeOn ()
virtual void StripSubTreeOff ()
virtual BOOL IsStripSubTreeOn ()

Private Member Functions

 CC_DECLARE_DYNAMIC (StripSubTreeRecordHandler)

Private Attributes

BOOL StripSubTree
UINT32 LevelCounter

Detailed Description

This is the class is used to strip a subtree of records from the file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/8/96
It works counting the number of TAG_DOWN & TAG_UP records it gets.

If the next record it gets is a TAG_DOWN, it increments the tree level counter. If the next record it gets is a TAG_UP, it decrements the tree level counter. If the next record is neither a TAG_UP or TAG_DOWN, and the level counter > 0, it is thrown away If the next record is neither a TAG_UP or TAG_DOWN, and the level counter == 0, it is passed on to it's proper handler

Definition at line 348 of file cxfrech.h.


Constructor & Destructor Documentation

StripSubTreeRecordHandler::StripSubTreeRecordHandler  ) 
 

Default constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/8/96
Parameters:
- [INPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1633 of file cxfrech.cpp.

01634 {
01635     StripSubTreeOff();
01636     LevelCounter = 0;
01637 }


Member Function Documentation

BOOL StripSubTreeRecordHandler::BeginImport  )  [virtual]
 

Informs the record handler that importing is about to begin.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/8/96
Parameters:
- [INPUTS]
Returns:
TRUE if OK, FALSE otherwise

Errors: -

See also:
-

Reimplemented from CXaraFileRecordHandler.

Definition at line 1654 of file cxfrech.cpp.

01655 {
01656     StripSubTreeOff();
01657     LevelCounter = 0;
01658 
01659     return TRUE;
01660 }

StripSubTreeRecordHandler::CC_DECLARE_DYNAMIC StripSubTreeRecordHandler   )  [private]
 

UINT32 * StripSubTreeRecordHandler::GetTagList  )  [virtual]
 

Provides the record handler system with a list of records handled by this handler.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/8/96
Parameters:
- [INPUTS]
Returns:
Ptr to a list of tag values, terminated by CXFRH_TAG_LIST_END
See also:
-

Implements CXaraFileRecordHandler.

Definition at line 1676 of file cxfrech.cpp.

01677 {
01678     static UINT32 TagList[] = {CXFRH_TAG_LIST_END};
01679 
01680     return (UINT32*)&TagList;
01681 }

BOOL StripSubTreeRecordHandler::HandleRecord CXaraFileRecord pCXaraFileRecord  )  [virtual]
 

The main record handling function.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/8/96
Parameters:
pCXaraFileRecord = ptr to the record to handle [INPUTS]
Returns:
TRUE if handled ok, FALSE otherwise
See also:
-

Implements CXaraFileRecordHandler.

Definition at line 1696 of file cxfrech.cpp.

01697 {
01698     ERROR3IF(!IsStripSubTreeOn(),"This should never be called if it's not stripping a subtree");
01699     if (!IsStripSubTreeOn())
01700         return TRUE;
01701 
01702     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
01703 
01704     switch (pCXaraFileRecord->GetTag())
01705     {
01706         case TAG_UP:
01707             if (LevelCounter > 0)
01708                 LevelCounter--;
01709 
01710             if (LevelCounter == 0)
01711                 StripSubTreeOff();
01712             break;
01713 
01714         case TAG_DOWN:
01715             LevelCounter++;
01716             break;
01717     }
01718 
01719     return TRUE;
01720 }

virtual void StripSubTreeRecordHandler::IncProgressBarCount UINT32  n  )  [inline, virtual]
 

Reimplemented from CamelotRecordHandler.

Definition at line 360 of file cxfrech.h.

00360 {};

virtual BOOL StripSubTreeRecordHandler::IsStripSubTreeOn  )  [inline, virtual]
 

Definition at line 364 of file cxfrech.h.

00364 { return StripSubTree; }

BOOL StripSubTreeRecordHandler::IsTagInList UINT32  Tag  )  [virtual]
 

This decides whether the given Tag should be handled by the sub tree stripper or not.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/8/96
Parameters:
Tag = tag value of a record [INPUTS]
Returns:
TRUE if it's to be handled by this handler FALSE otherwise
See also:
-

Reimplemented from CXaraFileRecordHandler.

Definition at line 1737 of file cxfrech.cpp.

01738 {
01739     // If the stripper is not turned on, there's no point in trying
01740     if (!IsStripSubTreeOn())
01741         return FALSE;
01742 
01743     // If the next tag is not a down node (i.e. it's not the start of a sub-tree)
01744     // and the level counter is 0 (i.e. we're not in the depths of a sub-tree either)
01745     // then we should return FALSE & turn the stripper off
01746     if (Tag != TAG_DOWN && LevelCounter == 0)
01747     {
01748         StripSubTreeOff();
01749         return FALSE;
01750     }
01751 
01752     return TRUE;
01753 }

virtual void StripSubTreeRecordHandler::StripSubTreeOff  )  [inline, virtual]
 

Definition at line 363 of file cxfrech.h.

00363 { StripSubTree = FALSE; }

virtual void StripSubTreeRecordHandler::StripSubTreeOn  )  [inline, virtual]
 

Definition at line 362 of file cxfrech.h.

00362 { StripSubTree = TRUE; }


Member Data Documentation

UINT32 StripSubTreeRecordHandler::LevelCounter [private]
 

Definition at line 368 of file cxfrech.h.

BOOL StripSubTreeRecordHandler::StripSubTree [private]
 

Definition at line 367 of file cxfrech.h.


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