AttrRecordItem Class Reference

Used to record the state of an AttributeEntry array. More...

#include <filters.h>

Inheritance diagram for AttrRecordItem:

ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 AttrRecordItem ()
 Constructor - initalises member variables.
 ~AttrRecordItem ()
 Destructor - deletes any claimed memory.
BOOL Initialise (AttributeEntry *CurrAttrs)
 Copies the current AttributeValues in the AttributeEntry array so the current state can be restored at a later date.
BOOL Restore (AttributeEntry *CurrAttrs)
 Copies the stored attribute state back into the current attribute array.

Protected Attributes

AttributeEntryRecordedAttrs

Private Member Functions

 CC_DECLARE_MEMDUMP (AttrRecordItem)

Friends

class AttrRecordList

Detailed Description

Used to record the state of an AttributeEntry array.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/12/95
See also:
AttrRecordList

Definition at line 384 of file filters.h.


Constructor & Destructor Documentation

AttrRecordItem::AttrRecordItem  ) 
 

Constructor - initalises member variables.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/12/95

Definition at line 6673 of file filters.cpp.

06674 {
06675     RecordedAttrs = NULL;
06676 }

AttrRecordItem::~AttrRecordItem  ) 
 

Destructor - deletes any claimed memory.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/12/95

Definition at line 6686 of file filters.cpp.

06687 {
06688     // Free the AttributeEntry array
06689     if (RecordedAttrs != NULL)
06690         CCFree(RecordedAttrs);
06691 }


Member Function Documentation

AttrRecordItem::CC_DECLARE_MEMDUMP AttrRecordItem   )  [private]
 

BOOL AttrRecordItem::Initialise AttributeEntry pCurrAttrs  ) 
 

Copies the current AttributeValues in the AttributeEntry array so the current state can be restored at a later date.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/12/95
Parameters:
pCurrAttrs - an AttributeEntry array [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 6705 of file filters.cpp.

06706 {
06707     const INT32 NumAttrs = AttributeManager::GetNumAttributes();
06708 
06709     // Claim memory for copy of AttributeEntry array
06710     RecordedAttrs = (AttributeEntry*)CCMalloc(NumAttrs*sizeof(AttributeEntry));
06711     if (RecordedAttrs==NULL)
06712         return FALSE;
06713 
06714     // store the temp values
06715     for (INT32 i=0; i<NumAttrs; i++)
06716     {
06717         // Get the runtime class info on this object and create another object of that type
06718         CCRuntimeClass *pCCRuntimeClass = pCurrAttrs[i].pAttr->GetRuntimeClass();
06719         AttributeValue *pNewAttr = (AttributeValue *) pCCRuntimeClass->CreateObject();
06720         if (pNewAttr == NULL)
06721             return FALSE;
06722 
06723         // Object created ok - get the object to copy its contents across.
06724         pNewAttr->SimpleCopy(pCurrAttrs[i].pAttr);
06725         RecordedAttrs[i].pAttr = pNewAttr;
06726     }
06727 
06728     return TRUE;
06729 }

BOOL AttrRecordItem::Restore AttributeEntry pCurrAttrs  ) 
 

Copies the stored attribute state back into the current attribute array.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/12/95
Parameters:
pCurrAttrs - an AttributeEntry array [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for success/failure

Definition at line 6742 of file filters.cpp.

06743 {
06744     const INT32 NumAttrs = AttributeManager::GetNumAttributes();
06745 
06746     for (INT32 i=0; i<NumAttrs; i++)
06747     {
06748         if (RecordedAttrs[i].pAttr != NULL)
06749         {
06750             pCurrAttrs[i].pAttr->SimpleCopy(RecordedAttrs[i].pAttr);
06751             delete RecordedAttrs[i].pAttr;
06752             RecordedAttrs[i].pAttr = NULL;
06753         }
06754     }
06755 
06756     return TRUE;
06757 }


Friends And Related Function Documentation

friend class AttrRecordList [friend]
 

Definition at line 387 of file filters.h.


Member Data Documentation

AttributeEntry* AttrRecordItem::RecordedAttrs [protected]
 

Definition at line 397 of file filters.h.


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