CommonAttrMultiSet Class Reference

A CommonAttributeSet. See Range::FindCommonAttributes. More...

#include <attraggl.h>

Inheritance diagram for CommonAttrMultiSet:

CommonAttrMap CMap< const StringBase *, const StringBase *, MultiCommonAttrItem *, MultiCommonAttrItem * > List of all members.

Public Member Functions

virtual ~CommonAttrMultiSet ()
 The MultiCommonAttrItems in the set need to be deleted when the set is destroyed. This destructor ensures they are.
void ClearResults ()
 This function initialises the CommonAttrMultiSet ready for finding common attributes Each MultiCommonAttrItem in the set has its Status set to ATTR_NONE and its pAttr set to NULL. You will probably never need to call this function as Range::FindCommonAttributes makes a call to it prior to looking for common attributes.
virtual BOOL AddTypeToSet (AttributeIdentifier AttrType, NodeAttribute *const pAttr)
 Call this function to build up a subset of attribute types to find common attribute values for. It creates an MultiCommonAttrItem and adds it to the set.
MultiCommonAttrItemFindAttrItem (AttributeIdentifier AttrType)
 To find an item in the CommonAttrMultiSet.
MultiCommonAttrItemFindFirst () const
MultiCommonAttrItemFindNext (const MultiCommonAttrItem *const pPrevious) const

Private Attributes

List m_CommonAttrList

Detailed Description

A CommonAttributeSet. See Range::FindCommonAttributes.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> (from Simon)
Date:
13/9/95
See also:
MultiCommonAttrItem

Definition at line 517 of file attraggl.h.


Constructor & Destructor Documentation

CommonAttrMultiSet::~CommonAttrMultiSet  )  [virtual]
 

The MultiCommonAttrItems in the set need to be deleted when the set is destroyed. This destructor ensures they are.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/06/97

Definition at line 565 of file attraggl.cpp.

00566 {
00567     m_CommonAttrList.DeleteAll();
00568 }


Member Function Documentation

BOOL CommonAttrMultiSet::AddTypeToSet AttributeIdentifier  AttrType,
NodeAttribute *const   pAttr
[virtual]
 

Call this function to build up a subset of attribute types to find common attribute values for. It creates an MultiCommonAttrItem and adds it to the set.

Parameters:
AttrType,: The type to add to the set [INPUTS]
Returns:
FALSE if we run out of memory

Definition at line 586 of file attraggl.cpp.

00588 {
00589     ENSURE_NOT_NULL(pAttr);
00590     ERROR3IF(FindAttrItem(AttrType), "Trying to add a duplicate item to a CommonAttrMultiSet"); 
00591 
00592     BOOL Ok = TRUE;
00593 
00594     MultiCommonAttrItem* pCommonAttrItem = new MultiCommonAttrItem(AttrType, pAttr);
00595     if (pCommonAttrItem == NULL)
00596     {
00597         // Oh no we've run out of memory
00598         Ok = FALSE; 
00599     }
00600     if (Ok)
00601     {
00602         try
00603         {
00604             SetAt(&AttrType, pCommonAttrItem);
00605         }
00606         catch(...)
00607         {
00608             Ok = FALSE;
00609         }
00610     }
00611 
00612     if (Ok)
00613     {
00614         m_CommonAttrList.AddTail(pCommonAttrItem);
00615     }
00616 
00617     if (!Ok)
00618     {
00619         delete pCommonAttrItem;
00620         pCommonAttrItem = NULL;
00621     }
00622 
00623     return Ok;
00624 }

void CommonAttrMultiSet::ClearResults  ) 
 

This function initialises the CommonAttrMultiSet ready for finding common attributes Each MultiCommonAttrItem in the set has its Status set to ATTR_NONE and its pAttr set to NULL. You will probably never need to call this function as Range::FindCommonAttributes makes a call to it prior to looking for common attributes.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/95
Returns:
Errors: The CommonAttrMultiSet must not be empty The AttrType field in each MultiCommonAttrItem must be a valid attribute type
See also:
Range::FindCommonAttributes

Definition at line 692 of file attraggl.cpp.

00693 {
00694     MultiCommonAttrItem* pAttrItem = FindFirst();
00695     while (pAttrItem)
00696     {
00697         ERROR3IF(!pAttrItem->GetAttrID(), "CommonAttrMultiSet contains invalid attr type"); 
00698         pAttrItem->ClearResults(); 
00699 
00700         pAttrItem = FindNext(pAttrItem);
00701     }
00702 }

MultiCommonAttrItem * CommonAttrMultiSet::FindAttrItem AttributeIdentifier  AttrType  ) 
 

To find an item in the CommonAttrMultiSet.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/9/95
Parameters:
AttrType,: The attribute type to search for [INPUTS]
Returns:
A pointer to the MultiCommonAttrItem with type AttrType. NULL if the item does not exist.

Definition at line 659 of file attraggl.cpp.

00660 {
00661     MultiCommonAttrItem* pAttrItem = NULL;
00662 
00663     if (!Lookup(&AttrType, pAttrItem))
00664     {
00665         pAttrItem = NULL;
00666     }
00667 
00668     return pAttrItem;
00669 }

MultiCommonAttrItem * CommonAttrMultiSet::FindFirst  )  const
 

Definition at line 628 of file attraggl.cpp.

00629 {
00630     MultiCommonAttrItem* pFoundItem = (MultiCommonAttrItem*)m_CommonAttrList.GetHead();
00631     ENSURE_KIND(pFoundItem, MultiCommonAttrItem);
00632     
00633     return pFoundItem;
00634 }

MultiCommonAttrItem * CommonAttrMultiSet::FindNext const MultiCommonAttrItem *const   pPrevious  )  const
 

Definition at line 637 of file attraggl.cpp.

00638 {
00639     MultiCommonAttrItem* pFoundItem = (MultiCommonAttrItem*)m_CommonAttrList.GetNext(pPrevious);
00640     ENSURE_KIND(pFoundItem, MultiCommonAttrItem);
00641     
00642     return pFoundItem;
00643 }


Member Data Documentation

List CommonAttrMultiSet::m_CommonAttrList [private]
 

Definition at line 534 of file attraggl.h.


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