NodeSetProperty Class Reference

Child node of NodeSetSentinel that stores individual property records for a set of objects (SGNameItem). More...

#include <ngsentry.h>

Inheritance diagram for NodeSetProperty:

Node CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeSetProperty ()
 Default constructor for a NodeSetProperty, a container node for a group of properties for a named set.
 NodeSetProperty (const StringBase &strName)
 Constructor for a NodeSetProperty, a container of properties associated with particular SGNameItems.
virtual ~NodeSetProperty ()
 Destroys a NodeSetProperty.
const StringBaseGetName () const
virtual SGNamePropSetProperty (SGNameProp *pNewProp)
 See Node::GetNodeSize.
SGNamePropGetProperty (INT32 nIndex) const
BOOL CreateDefaults ()
 Create default properties of every type for this set.
BOOL CopyProperties (NodeSetProperty *pOther)
 Copy the given NodeSetProperty's SGNameProps into this.
virtual NodeSimpleCopy ()
 See Node::SimpleCopy.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.

Public Attributes

BOOL m_Imported

Protected Member Functions

virtual UINT32 GetNodeSize () const
 See Node::GetNodeSize.
void CopyNodeContents (NodeSetProperty *pCopy)
 See Node::SimpleCopy.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *)
 Writes out a SetProperty record.
virtual BOOL CanWriteChildrenWeb (BaseCamelotFilter *)
 Prevents children of the sentinel being written out in the web format.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *)
 Web files don't write out SetSentinel records. This code assumes the document will only contain one SetSentinel.
virtual BOOL WriteBeginChildRecordsWeb (BaseCamelotFilter *)
 Begins the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the DOWN record does not get written.
virtual BOOL WriteEndChildRecordsWeb (BaseCamelotFilter *)
 Ends the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the UP record does not get written.

Private Member Functions

 CC_DECLARE_DYNAMIC (NodeSetProperty)

Private Attributes

StringBase m_strName
SGNamePropm_pProp [SGNameProp::nPropertyCount]

Detailed Description

Child node of NodeSetSentinel that stores individual property records for a set of objects (SGNameItem).

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/9/99
See also:
SGNameProp; SGNameItem; Node; NodeSetSentinel; NameGallery

Definition at line 125 of file ngsentry.h.


Constructor & Destructor Documentation

NodeSetProperty::NodeSetProperty  ) 
 

Default constructor for a NodeSetProperty, a container node for a group of properties for a named set.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
strName --- name of the set to hold properties for [INPUTS]
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Definition at line 152 of file ngsentry.cpp.

00153 {
00154     memset(m_pProp, 0, sizeof(m_pProp));
00155     m_Imported = FALSE;
00156 }

NodeSetProperty::NodeSetProperty const StringBase strName  ) 
 

Constructor for a NodeSetProperty, a container of properties associated with particular SGNameItems.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
(See Node::Node) [INPUTS] strName --- the name of the set to hold properties for
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Definition at line 172 of file ngsentry.cpp.

00173 {
00174     memset(m_pProp, 0, sizeof(m_pProp));
00175     m_strName.Alloc(strName.Length() + 1);
00176     m_strName = strName;
00177     m_Imported = FALSE;
00178 }

NodeSetProperty::~NodeSetProperty  )  [virtual]
 

Destroys a NodeSetProperty.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Definition at line 191 of file ngsentry.cpp.

00192 {
00193     // If we still have valid pointers to properties then take responsibility for
00194     // deallocating them.
00195     for (SGNameProp** ppProp = &m_pProp[SGNameProp::nPropertyCount];
00196          --ppProp >= &m_pProp[0]; /* empty */ )
00197             if (*ppProp != 0)
00198             {
00199                 delete *ppProp;
00200                 *ppProp = 0;
00201             }
00202 }


Member Function Documentation

BOOL NodeSetProperty::CanWriteChildrenWeb BaseCamelotFilter  )  [protected, virtual]
 

Prevents children of the sentinel being written out in the web format.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
FALSE.

Reimplemented from Node.

Definition at line 446 of file ngsentry.cpp.

00447 {
00448     return FALSE;
00449 }

NodeSetProperty::CC_DECLARE_DYNAMIC NodeSetProperty   )  [private]
 

void NodeSetProperty::CopyNodeContents NodeSetProperty pCopy  )  [protected]
 

See Node::SimpleCopy.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Definition at line 340 of file ngsentry.cpp.

00341 {
00342     ERROR3IF(pCopy == 0, "NodeSetProperty::CopyNodeContents: null input");
00343     Node::CopyNodeContents(pCopy);
00344 
00345     // Copy the name of the set.
00346     pCopy->m_strName.Alloc(m_strName.Length() + 1);
00347     pCopy->m_strName = m_strName;
00348 
00349     // Create copies in the heap of this node's contained properties.
00350     for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++)
00351     {
00352         if (m_pProp[i] == 0)
00353             pCopy->m_pProp[i] = 0;
00354         else
00355         {
00356             // TODO: verify that this is the out of memory convention for this func.
00357             pCopy->m_pProp[i] = m_pProp[i]->Clone();
00358             if (pCopy->m_pProp[i] == 0)
00359             {
00360                 ERROR1RAW(_R(IDE_NOMORE_MEMORY));
00361                 return;
00362             }
00363         }
00364     }
00365 }

BOOL NodeSetProperty::CopyProperties NodeSetProperty pOther  ) 
 

Copy the given NodeSetProperty's SGNameProps into this.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
pOther --- where to copy properties from [INPUTS]
Returns:
FALSE if out of memory.
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Definition at line 270 of file ngsentry.cpp.

00271 {
00272     // Replace properties in this with clones of the other's.
00273     for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++)
00274     {
00275         SGNameProp* pNewProp;
00276         if (pOther->m_pProp[i] == 0)
00277             pNewProp = 0;
00278         else
00279         {
00280             pNewProp = pOther->m_pProp[i]->Clone();
00281             ERRORIF(pNewProp == 0, _R(IDE_NOMORE_MEMORY), FALSE);
00282         }
00283 
00284         delete m_pProp[i];
00285         m_pProp[i] = pNewProp;
00286     }
00287 
00288     return TRUE;
00289 }

BOOL NodeSetProperty::CreateDefaults  ) 
 

Create default properties of every type for this set.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Returns:
FALSE if out of memory.
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Definition at line 244 of file ngsentry.cpp.

00245 {
00246     // Create a new default property of every type and delete any old ones.
00247     for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++)
00248     {
00249         if (m_pProp[i] != 0) delete m_pProp[i];
00250         m_pProp[i] = SGNameProp::CreateDefault(m_strName, i);
00251         if (m_pProp[i] == 0) return FALSE;
00252     }
00253 
00254     return TRUE;
00255 }

const StringBase& NodeSetProperty::GetName void   )  const [inline]
 

Definition at line 135 of file ngsentry.h.

00136             { return m_strName; }

UINT32 NodeSetProperty::GetNodeSize  )  const [protected, virtual]
 

See Node::GetNodeSize.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Reimplemented from Node.

Definition at line 302 of file ngsentry.cpp.

00303 {
00304     return sizeof(*this);
00305 }

SGNameProp* NodeSetProperty::GetProperty INT32  nIndex  )  const [inline]
 

Definition at line 140 of file ngsentry.h.

00141             { return m_pProp[nIndex]; }

void NodeSetProperty::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Definition at line 380 of file ngsentry.cpp.

00381 {
00382     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00383     ENSURE(IS_A(pNodeCopy, NodeSetProperty), "PolyCopyNodeContents given wrong dest node type");
00384 
00385     if (IS_A(pNodeCopy, NodeSetProperty))
00386         CopyNodeContents((NodeSetProperty*)pNodeCopy);
00387 }

SGNameProp * NodeSetProperty::SetProperty SGNameProp pNewProp  )  [virtual]
 

See Node::GetNodeSize.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
Parameters:
pNewProp --- the new property this node should hold. [INPUTS]
Returns:
The old property.
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery

Definition at line 217 of file ngsentry.cpp.

00218 {
00219     ERROR3IF(pNewProp == 0, "NodeSetProperty::SetProperty: null input");
00220 
00221     INT32 i = pNewProp->GetIndex();
00222     ERROR3IF(i < 0 || i >= SGNameProp::nPropertyCount,
00223                 "NodeSetProperty::SetProperty: out of range");
00224 
00225     SGNameProp* pOld = m_pProp[i];
00226     m_pProp[i] = pNewProp;
00227 
00228     m_Imported = FALSE;
00229     return pOld;
00230 }

Node * NodeSetProperty::SimpleCopy void   )  [virtual]
 

See Node::SimpleCopy.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/99
See also:
SGNameProp; Node; NodeSetSentinel; NameGallery Notes: If you add any data members to class NodeSetProperty, then you should define a (non-virtual) CopyNodeContents function and call that to do the copy.

Reimplemented from Node.

Definition at line 321 of file ngsentry.cpp.

00322 {
00323     NodeSetProperty* pCopy = new NodeSetProperty;
00324     ERRORIF(pCopy == 0, _R(IDE_NOMORE_MEMORY), 0);
00325     CopyNodeContents(pCopy);
00326     return pCopy;
00327 }

BOOL NodeSetProperty::WriteBeginChildRecordsWeb BaseCamelotFilter  )  [protected, virtual]
 

Begins the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the DOWN record does not get written.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE.

Reimplemented from Node.

Definition at line 484 of file ngsentry.cpp.

00485 {
00486     return TRUE;
00487 }

BOOL NodeSetProperty::WriteEndChildRecordsWeb BaseCamelotFilter  )  [protected, virtual]
 

Ends the child record sequence for SetSentinel in the web format. Web export doesn't write out SetSentinel records or children of the sentinel, so this overrides the default behaviour in Node by ensuring the UP record does not get written.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE.

Reimplemented from Node.

Definition at line 504 of file ngsentry.cpp.

00505 {
00506     return TRUE;
00507 }

BOOL NodeSetProperty::WritePreChildrenNative BaseCamelotFilter pFilter  )  [protected, virtual]
 

Writes out a SetProperty record.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
TRUE if the node has written out a record to the filter, FALSE otherwise.

Reimplemented from Node.

Definition at line 401 of file ngsentry.cpp.

00402 {
00403 #ifdef DO_EXPORT
00404     // Write out the SetProperty record header.
00405     CXaraFileRecord rec(TAG_SETPROPERTY, TAG_SETPROPERTY_SIZE);
00406     if (!rec.Init() ||
00407         !rec.WriteUnicode(m_strName) ||
00408         !rec.WriteINT16((INT16) SGNameProp::nPropertyCount))
00409     {
00410         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00411         return FALSE;
00412     }
00413 
00414     // Write out each property in ascending index order.
00415     for (INT32 i = 0; i < SGNameProp::nPropertyCount; i++)
00416     {
00417         ERROR3IF(m_pProp[i] == NULL, "NodeSetProperty::WritePreChildrenNative: no property");
00418         if (!rec.WriteINT16((INT16) i) || !m_pProp[i]->Write(&rec))
00419         {
00420             pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00421             return FALSE;           
00422         }
00423     }
00424     
00425     // We've built up a record, now write it out.
00426     UINT32 r = pFilter->Write(&rec);
00427     if (r == 0) pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00428     return (BOOL) r;
00429 #else
00430     return FALSE;
00431 #endif
00432 }

BOOL NodeSetProperty::WritePreChildrenWeb BaseCamelotFilter  )  [protected, virtual]
 

Web files don't write out SetSentinel records. This code assumes the document will only contain one SetSentinel.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pFilter --- filter to write to [INPUTS]
Returns:
FALSE.

Reimplemented from Node.

Definition at line 464 of file ngsentry.cpp.

00465 {
00466     return FALSE;
00467 }


Member Data Documentation

BOOL NodeSetProperty::m_Imported
 

Definition at line 173 of file ngsentry.h.

SGNameProp* NodeSetProperty::m_pProp[SGNameProp::nPropertyCount] [private]
 

Definition at line 169 of file ngsentry.h.

StringBase NodeSetProperty::m_strName [private]
 

Definition at line 168 of file ngsentry.h.


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