FontComponentList Class Reference

List header object for the list of font information held by FontComponent objects. More...

#include <fontcomp.h>

Inheritance diagram for FontComponentList:

List CCObject SimpleCCObject List of all members.

Public Member Functions

 FontComponentList ()
 Constructor See Also: class FontComponent.
 ~FontComponentList ()
 Destructor See Also: class FontComponent.
BOOL ExportStart ()
 Gives objects of this type a chance to prepare for an export operation. See Also: class FontComponent.
BOOL ExportEnd (BOOL Success)
 Gives objects if this class a chance to recover from an export operation, tidying up if neccessary. See Also: class FontComponent.
FontComponentListItemExportFind (WORD FontHandle, BOOL IsBold, BOOL IsItalic)
 Searches the list of FontComponentListItem's for a match See Also: class FontComponentListItem.
BOOL ImportStart ()
 Allows objects of this class a chance to initialise before an import operation See Also: class FontComponent.
BOOL ImportEnd (BOOL Success)
 Allows objects of this class a chance to recover from an import operation See Also: class FontComponent.
FontComponentListItemImportFind (INT32 RecordNumber)
 Searches the list for a matching FontComponentListItem. See Also: class FontComponentListItem, class FontComponent.

Private Member Functions

 CC_DECLARE_DYNAMIC (FontComponentList)
FontComponentListItemExportFindAux (FontComponentListItem *pItem, WORD FontHandle, BOOL IsBold, BOOL IsItalic)
 Searches the list of FontComponentListItems for match See Also: class FontComponentListItem, class FontComponent.
FontComponentListItemImportFindAux (FontComponentListItem *pItem, INT32 RecordNumber)
 Searches the list for a matching FontComponentListItem See Also: class FontComponentListItem, class FontComponent.

Private Attributes

BOOL ExportInitialised
BOOL ImportInitialised

Detailed Description

List header object for the list of font information held by FontComponent objects.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/08/06 Base Class: public List
See also:
class FontComponentListItem, class FontComponent

Definition at line 191 of file fontcomp.h.


Constructor & Destructor Documentation

FontComponentList::FontComponentList  ) 
 

Constructor See Also: class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 370 of file fontcomp.cpp.

00371 {
00372     ExportInitialised=FALSE;
00373     ImportInitialised=FALSE;
00374 }

FontComponentList::~FontComponentList  ) 
 

Destructor See Also: class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 389 of file fontcomp.cpp.

00390 {
00391     ERROR3IF(ExportInitialised==TRUE, "Deconstructor called when ExportInitialised==TRUE");
00392     ERROR3IF(ImportInitialised==TRUE, "Deconstructor called when ImportInitialised==TRUE");
00393     
00394     DeleteAll();
00395 }


Member Function Documentation

FontComponentList::CC_DECLARE_DYNAMIC FontComponentList   )  [private]
 

BOOL FontComponentList::ExportEnd BOOL  Success  ) 
 

Gives objects if this class a chance to recover from an export operation, tidying up if neccessary. See Also: class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
Success - succcess status of the export operation [INPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 443 of file fontcomp.cpp.

00444 {
00445     //ERROR2IF(ExportInitialised==FALSE, FALSE, "ExportEnd called when ExportInitialised==FALSE.");
00446     // If we error about the ExportInitialised then we assume that the StartExport has been called.
00447     // This may not be the case if we are in clean up mode. So just handle it!
00448 
00449     if (Success==FALSE && ExportInitialised)
00450     {
00451         // export operation was unsuccessful, so need to delete all the entries in the list
00452         // made during the export. this is easy; since the mRecentlyCreated member of all the
00453         // elements in the list was set to FALSE before the export any element with an non-FALSE
00454         // mRecentlyCreated member.
00455 
00456         FontComponentListItem *pItem = (FontComponentListItem *) GetHead();
00457         FontComponentListItem *qItem;
00458 
00459         while (pItem!=NULL)
00460         {
00461             qItem = pItem;
00462             pItem = (FontComponentListItem *) GetNext(qItem);
00463 
00464             if (qItem->mRecentlyCreated==TRUE)
00465             {
00466                 RemoveItem(qItem);
00467                 delete qItem;
00468             }
00469         }
00470     }
00471     //else // Removed due to the change to the if statement above
00472     //{
00473     //  // oh well, the export operation was successful, so do nothing
00474     //}
00475 
00476     ExportInitialised=FALSE;
00477     return TRUE;
00478 }

FontComponentListItem * FontComponentList::ExportFind WORD  FontHandle,
BOOL  IsBold,
BOOL  IsItalic
 

Searches the list of FontComponentListItem's for a match See Also: class FontComponentListItem.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
FontHandle : font handle to search for [INPUTS] IsBold : bold flag to search for IsItalic : italic flag to search for
Returns:
Pointer to the matching FontComponentListItem if found, or NULL

Definition at line 495 of file fontcomp.cpp.

00496 {
00497     ERROR2IF(ExportInitialised==FALSE, FALSE, "ExportFind called when ExportInitialised==FALSE.");
00498 
00499     // auxillary functions, searches using tail recursion. the msvc compiler should
00500     // optimise this quite well - at least, it should
00501     return ExportFindAux((FontComponentListItem *) GetHead(), FontHandle, IsBold, IsItalic);
00502 }

FontComponentListItem * FontComponentList::ExportFindAux FontComponentListItem pItem,
WORD  FontHandle,
BOOL  IsBold,
BOOL  IsItalic
[private]
 

Searches the list of FontComponentListItems for match See Also: class FontComponentListItem, class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
pItem : current FontComponentListItem of interest [INPUTS] FontHandle : font handle to search for IsBold : bold flag to search for IsItalic : italic flag to search for
Returns:
Pointer to a matching FontComponentListItem, or null if not found

Definition at line 520 of file fontcomp.cpp.

00521 {
00522     ERROR2IF(ExportInitialised==FALSE, FALSE, "ExportFindAux called when ExportInitialised==FALSE.");
00523     ERROR2IF(FontHandle==ILLEGALFHANDLE, FALSE, "ExportFindAux called with an illegal font handle.");
00524 
00525     if (pItem==NULL)
00526     {
00527         return NULL;
00528     }
00529     else if (pItem->mFontHandle==FontHandle && pItem->mIsBold==IsBold && pItem->mIsItalic==IsItalic)
00530     {
00531         return pItem;
00532     }
00533     else
00534     {
00535         // tail recursion ;)
00536         return ExportFindAux((FontComponentListItem *) GetNext(pItem), FontHandle, IsBold, IsItalic);
00537     }
00538 }

BOOL FontComponentList::ExportStart  ) 
 

Gives objects of this type a chance to prepare for an export operation. See Also: class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
- [INPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 410 of file fontcomp.cpp.

00411 {
00412     ERROR2IF(ExportInitialised!=FALSE, FALSE, "ExportStart called when ExportInitialised!=FALSE.");
00413 
00414     FontComponentListItem *pItem = (FontComponentListItem *) GetHead();
00415 
00416     // need to set the mRecentlyCreated and mRecordNumber member of all the elements in the list to NULL
00417     while (pItem!=NULL)
00418     {
00419         pItem->mRecentlyCreated = FALSE;
00420         pItem->mRecordNumber = 0;
00421         pItem = (FontComponentListItem *) GetNext(pItem);
00422     }
00423 
00424     ExportInitialised = TRUE;
00425 
00426     return TRUE;
00427 }

BOOL FontComponentList::ImportEnd BOOL  Success  ) 
 

Allows objects of this class a chance to recover from an import operation See Also: class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
Success - success status of the import operation [INPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 586 of file fontcomp.cpp.

00587 {
00588     //ERROR2IF(ImportInitialised==FALSE, FALSE, "ImportEnd called when ImportInitialised==FALSE.");
00589     // If we error about the ImportInitialised then we assume that the StartExport has been called.
00590     // This may not be the case if we are in clean up mode. So just handle it!
00591 
00592     if (Success==FALSE && ImportInitialised)
00593     {
00594         // import operation was not successful, so we need to delete any elements in the list
00595         // created during the import. this is easy since all the elements in the list had
00596         // their mRecentlyCreated member set to FALSE before the import - any new elements will
00597         // have mRecentlyCreated==TRUE (thanks to the FontComponentListItem constructor).
00598 
00599         FontComponentListItem *pItem = (FontComponentListItem *) GetHead();
00600         FontComponentListItem *qItem = NULL;
00601 
00602         while (pItem!=NULL)
00603         {
00604             qItem = pItem;
00605             pItem = (FontComponentListItem *) GetNext(qItem);
00606 
00607             if (qItem->mRecentlyCreated==TRUE)
00608             {
00609                 RemoveItem(qItem);
00610                 delete qItem;
00611             }
00612         }
00613     }
00614     //else // Removed due to the change to the if statement above
00615     //{
00616     //  // import operation was successful, so just return.
00617     //}
00618 
00619     ImportInitialised=FALSE;
00620     return TRUE;
00621 }

FontComponentListItem * FontComponentList::ImportFind INT32  RecordNumber  ) 
 

Searches the list for a matching FontComponentListItem. See Also: class FontComponentListItem, class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
RecordNumber - record number to search for [INPUTS]
Returns:
pointer to the matching FontComponentListItem, or NULL if not found.

Definition at line 636 of file fontcomp.cpp.

00637 {
00638     ERROR2IF(ImportInitialised==FALSE, FALSE, "ImportFind callled when ImportInitialied==FALSE.");
00639 
00640     return ImportFindAux((FontComponentListItem *) GetHead(), RecordNumber);
00641 }

FontComponentListItem * FontComponentList::ImportFindAux FontComponentListItem pItem,
INT32  RecordNumber
[private]
 

Searches the list for a matching FontComponentListItem See Also: class FontComponentListItem, class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
pItem - current FontComponentListItem of interest [INPUTS] RecordNumber - record number to search for
Returns:
pointer to the matching FontComponentListItem or NULL if not found

Definition at line 657 of file fontcomp.cpp.

00658 {
00659     ERROR2IF(ImportInitialised==FALSE, FALSE, "ImportFindAux called when ImportInitialised==FALSE.");
00660 
00661     if (pItem==NULL)
00662     {
00663         return NULL;
00664     }
00665     else if (pItem->mRecordNumber==RecordNumber)
00666     {
00667         return pItem;
00668     }
00669     else
00670     {
00671         // tail recursion ;)
00672         return ImportFindAux((FontComponentListItem *) GetNext(pItem), RecordNumber);
00673     }
00674 }

BOOL FontComponentList::ImportStart  ) 
 

Allows objects of this class a chance to initialise before an import operation See Also: class FontComponent.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/96
Parameters:
- [INPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 553 of file fontcomp.cpp.

00554 {
00555     ERROR2IF(ImportInitialised!=FALSE, FALSE, "ImportStart called when ImportInitialised!=FALSE");
00556 
00557     FontComponentListItem *pItem = (FontComponentListItem *) GetHead();
00558 
00559     // need to set the mRecentlyCreated and mRecordNumber members of all the elements in the list
00560     // to FALSE and NULL respectively.
00561     while (pItem!=NULL)
00562     {
00563         pItem->mRecentlyCreated=FALSE;
00564         pItem->mRecordNumber = 0;
00565         pItem = (FontComponentListItem *) GetNext(pItem);
00566     }
00567 
00568     ImportInitialised=TRUE;
00569 
00570     return TRUE;
00571 }


Member Data Documentation

BOOL FontComponentList::ExportInitialised [private]
 

Definition at line 207 of file fontcomp.h.

BOOL FontComponentList::ImportInitialised [private]
 

Definition at line 216 of file fontcomp.h.


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