GeneralRecordHandler Class Reference

This is the general record handler. It handles all the general record types, such as the End Of File, file header, etc. More...

#include <cxfile.h>

Inheritance diagram for GeneralRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

virtual UINT32GetTagList ()
virtual BOOL HandleRecord (CXaraFileRecord *pCXaraFileRecord)
virtual void IncProgressBarCount (UINT32 n)

Private Member Functions

 CC_DECLARE_DYNAMIC (GeneralRecordHandler)
BOOL HandleFileHeader (CXaraFileRecord *pCXaraFileRecord)
 Handles the file header record.
BOOL HandleAtomicTagsRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles the atomic tags record.
BOOL HandleEssentialTagsRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles the essential tags record.
BOOL HandleTagDescriptionRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles the tag description record.
BOOL HandleTagNudgeSizeRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles the nudge size description record.

Detailed Description

This is the general record handler. It handles all the general record types, such as the End Of File, file header, etc.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/96

Definition at line 436 of file cxfile.h.


Member Function Documentation

GeneralRecordHandler::CC_DECLARE_DYNAMIC GeneralRecordHandler   )  [private]
 

UINT32 * GeneralRecordHandler::GetTagList  )  [virtual]
 

Implements CXaraFileRecordHandler.

Definition at line 2436 of file cxfile.cpp.

02437 {
02438     static UINT32 TagList[] = { TAG_ENDOFFILE,
02439                                 TAG_FILEHEADER,
02440 #if !defined(EXCLUDE_FROM_XARLIB)
02441                                 TAG_UP,
02442                                 TAG_DOWN,
02443                                 TAG_TAGDESCRIPTION,
02444                                 TAG_DOCUMENTNUDGE,
02445 #endif
02446                                 TAG_ATOMICTAGS,
02447                                 TAG_ESSENTIALTAGS,
02448                                 CXFRH_TAG_LIST_END};
02449     return (UINT32*)&TagList;
02450 }

BOOL GeneralRecordHandler::HandleAtomicTagsRecord CXaraFileRecord pCXaraFileRecord  )  [private]
 

Handles the atomic tags record.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/96
Parameters:
pCXaraFileRecord = ptr to a record [INPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2562 of file cxfile.cpp.

02563 {
02564     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
02565     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_ATOMICTAGS,FALSE,"I don't handle this tag type");
02566 
02567     BOOL ok = TRUE;
02568 
02569     UINT32 Size = pCXaraFileRecord->GetSize();
02570     UINT32 Tag;
02571 
02572     // Create an atomic tag item for each atomic tag in the record
02573 
02574     for (UINT32 i = 0;ok && i < Size; i+=sizeof(UINT32))
02575     {
02576         AtomicTagListItem* pItem = NULL;
02577 
02578         ok = pCXaraFileRecord->ReadUINT32(&Tag);
02579         if (ok) pItem = new AtomicTagListItem(Tag);
02580         if (ok) ok = (pItem != NULL);
02581         if (ok) AddAtomicTag(pItem);
02582     }
02583 
02584     return ok;
02585 }

BOOL GeneralRecordHandler::HandleEssentialTagsRecord CXaraFileRecord pCXaraFileRecord  )  [private]
 

Handles the essential tags record.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/96
Parameters:
pCXaraFileRecord = ptr to a record [INPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2601 of file cxfile.cpp.

02602 {
02603     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
02604     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_ESSENTIALTAGS,FALSE,"I don't handle this tag type");
02605 
02606     BOOL ok = TRUE;
02607 
02608     UINT32 Size = pCXaraFileRecord->GetSize();
02609     UINT32 Tag;
02610 
02611     // Create an essential tag item for each essential tag in the record
02612 
02613     for (UINT32 i = 0;ok && i < Size; i+=sizeof(UINT32))
02614     {
02615         EssentialTagListItem* pItem = NULL;
02616 
02617         ok = pCXaraFileRecord->ReadUINT32(&Tag);
02618         if (ok) pItem = new EssentialTagListItem(Tag);
02619         if (ok) ok = (pItem != NULL);
02620         if (ok) AddEssentialTag(pItem);
02621     }
02622 
02623     return ok;
02624 }

BOOL GeneralRecordHandler::HandleFileHeader CXaraFileRecord pCXaraFileRecord  )  [private]
 

Handles the file header record.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/6/96
Parameters:
pCXaraFileRecord = ptr to a record [INPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2520 of file cxfile.cpp.

02521 {
02522     BOOL ok = TRUE;
02523     BYTE Buffer[100];
02524     BYTE FileType[4];
02525     UINT32 n;
02526     UINT32 PreCompFlags;
02527     UINT32 FileSize;
02528 
02529     if (ok) ok = pCXaraFileRecord->ReadBuffer(FileType,3);          // File type (ensuring only 3 chars are read)
02530     if (ok) ok = pCXaraFileRecord->ReadUINT32(&FileSize);           // File size
02531     if (ok) ok = pCXaraFileRecord->ReadUINT32(&n);                  // Native/Web link ID
02532     if (ok) ok = pCXaraFileRecord->ReadUINT32(&PreCompFlags);       // Precompression flags
02533     if (ok) ok = pCXaraFileRecord->ReadASCII((TCHAR*)Buffer,100);   // Producer
02534     if (ok) ok = pCXaraFileRecord->ReadASCII((TCHAR*)Buffer,100);   // Producer version
02535     if (ok) ok = pCXaraFileRecord->ReadASCII((TCHAR*)Buffer,100);   // Producer build
02536 
02537 #if !defined(EXCLUDE_FROM_XARLIB)
02538     SetTotalProgressBarCount(FileSize);
02539 
02540     SetImportFileType((char*)FileType);
02541 
02542     ok = SetPreCompression(PreCompFlags);
02543 #endif
02544     return ok;
02545 }

BOOL GeneralRecordHandler::HandleRecord CXaraFileRecord pCXaraFileRecord  )  [virtual]
 

Implements CXaraFileRecordHandler.

Definition at line 2452 of file cxfile.cpp.

02453 {
02454     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
02455 
02456     BOOL ok = TRUE;
02457 
02458     switch (pCXaraFileRecord->GetTag())
02459     {
02460         case TAG_FILEHEADER :
02461             ok = HandleFileHeader(pCXaraFileRecord);
02462             break;
02463 
02464         case TAG_ENDOFFILE:
02465 #if !defined(EXCLUDE_FROM_XARLIB)
02466             EndOfFile();
02467 #else
02468             m_pCXFile->SetEndOfFile();
02469 #endif
02470             break;
02471 
02472 #if !defined(EXCLUDE_FROM_XARLIB)
02473         case TAG_UP:
02474             ok = DecInsertLevel();
02475             break;
02476 
02477         case TAG_DOWN:
02478             ok = IncInsertLevel();
02479             break;
02480 
02481         case TAG_TAGDESCRIPTION:
02482             ok = HandleTagDescriptionRecord(pCXaraFileRecord);
02483             break;
02484 
02485         case TAG_DOCUMENTNUDGE:
02486             ok = HandleTagNudgeSizeRecord(pCXaraFileRecord);
02487             break;
02488 #endif
02489         case TAG_ATOMICTAGS:
02490             ok = HandleAtomicTagsRecord(pCXaraFileRecord);
02491             break;
02492 
02493         case TAG_ESSENTIALTAGS:
02494             ok = HandleEssentialTagsRecord(pCXaraFileRecord);
02495             break;
02496 
02497         default:
02498             ok = FALSE;
02499             ERROR3_PF(("I don't handle records with the tag (%d)\n",pCXaraFileRecord->GetTag()));
02500             break;
02501     }
02502 
02503     return ok;
02504 }

BOOL GeneralRecordHandler::HandleTagDescriptionRecord CXaraFileRecord pCXaraFileRecord  )  [private]
 

Handles the tag description record.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/96
Parameters:
pCXaraFileRecord = ptr to a record [INPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2642 of file cxfile.cpp.

02643 {
02644     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
02645     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_TAGDESCRIPTION,FALSE,"I don't handle this tag type");
02646 
02647     BOOL ok = TRUE;
02648 
02649     UINT32 NumTags;
02650     UINT32 Tag;
02651     String_256* pDesc = NULL;
02652 
02653     ok = pCXaraFileRecord->ReadUINT32(&NumTags);
02654 
02655     // Create a tag description item for each tag description in the record
02656 
02657     for (UINT32 i = 0;ok && i < NumTags; i++)
02658     {
02659         TagDescriptionListItem* pItem = NULL;
02660 
02661         pDesc = new String_256;
02662         ok = (pDesc != NULL);
02663 
02664         if (ok) ok = pCXaraFileRecord->ReadUINT32(&Tag);
02665         if (ok) ok = pCXaraFileRecord->ReadUnicode(pDesc);//*pDesc,pDesc->MaxLength());
02666         if (ok) pItem = new TagDescriptionListItem(Tag,pDesc);
02667         if (ok) ok = (pItem != NULL);
02668         if (ok) ok = AddTagDescription(pItem);
02669 
02670         if (!ok && pItem != NULL)
02671         {
02672             delete pItem;
02673             pItem = NULL;
02674         }
02675     }
02676 
02677     return ok;
02678 }

BOOL GeneralRecordHandler::HandleTagNudgeSizeRecord CXaraFileRecord pCXaraFileRecord  )  [private]
 

Handles the nudge size description record.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/2000
Parameters:
pCXaraFileRecord = ptr to a record [INPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2696 of file cxfile.cpp.

02697 {
02698     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
02699     ERROR2IF(pCXaraFileRecord->GetTag() != TAG_DOCUMENTNUDGE,FALSE,"I don't handle this tag type");
02700 
02701     BOOL ok = TRUE;
02702 
02703     INT32 val = (INT32) 2835;       //DEFAULT_NUDGE_SIZE;   I'm not moving this just so it will be consistent
02704     
02705     ok = pCXaraFileRecord->ReadINT32 (&val);
02706 
02707     ok = SetDocumentNudgeSize ((UINT32) val);
02708 
02709     return ok;
02710 }

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

Reimplemented from CamelotRecordHandler.

Definition at line 444 of file cxfile.h.

00444 {};


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