AttrVariableWidth Class Reference

VariableWidth attribute VariableWidth attributes are very simple, and merely contain a VariableWidthAttrValue, which is the entity which holds all the info and does all the work. More...

#include <strkattr.h>

Inheritance diagram for AttrVariableWidth:

NodeAttribute NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 AttrVariableWidth ()
 Default constructor for AttrVariableWidth.
 AttrVariableWidth (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 Constructs an AttrVariableWidth Attribute.
virtual void Render (RenderRegion *pRender)
 Renders this attribute (by simply calling the Render function of its contained AttributeValue).
virtual void CopyNodeContents (AttrVariableWidth *NodeCopy)
 Copies the node's contents to the node pointed to by NodeCopy.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
virtual INT32 operator== (const NodeAttribute &NodeAttrib)
 Comparison operator - determines if the AttributeValues of both objects are ==.
virtual NodeSimpleCopy ()
 This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
virtual UINT32 GetAttrNameID (void)
 Retrieves a string resource ID describing this attribute.
virtual AttrIndex GetAttributeIndex ()
virtual void GetDebugDetails (StringBase *Str)
 Produces debug details about this node.
virtual UINT32 GetNodeSize () const
 For finding the size of the node, in bytes.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes out a record that represents the node, to either Native or Web file format.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
virtual AttributeValueGetAttributeValue ()
BOOL DoBecomeA (BecomeA *pBecomeA, Node *pParent)
BOOL HasActiveValueFunction ()
 To find out if this attribute is actually going to do anything or not.

Protected Attributes

VariableWidthAttrValue Value

Friends

class PathProcessorStroke

Detailed Description

VariableWidth attribute VariableWidth attributes are very simple, and merely contain a VariableWidthAttrValue, which is the entity which holds all the info and does all the work.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/1/97

Definition at line 326 of file strkattr.h.


Constructor & Destructor Documentation

AttrVariableWidth::AttrVariableWidth  ) 
 

Default constructor for AttrVariableWidth.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/1/97

Definition at line 1028 of file strkattr.cpp.

01029 {
01030 }

AttrVariableWidth::AttrVariableWidth Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

Constructs an AttrVariableWidth Attribute.

Definition at line 1049 of file strkattr.cpp.

01055                 : NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)
01056 {
01057 }


Member Function Documentation

void AttrVariableWidth::CopyNodeContents AttrVariableWidth NodeCopy  )  [virtual]
 

Copies the node's contents to the node pointed to by NodeCopy.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/1/97
Parameters:
NodeCopy - returned containing a copy of this node [OUTPUTS]

Definition at line 1093 of file strkattr.cpp.

01094 {
01095     // Let the base class do its bit
01096     NodeAttribute::CopyNodeContents(NodeCopy);
01097 
01098     // And then copy our Value
01099     *(NodeCopy->GetAttributeValue()) = *(GetAttributeValue());
01100 }

BOOL AttrVariableWidth::DoBecomeA BecomeA pBecomeA,
Node pParent
 

virtual AttrIndex AttrVariableWidth::GetAttributeIndex  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 348 of file strkattr.h.

00348 { return ATTR_VARWIDTH; }

virtual AttributeValue* AttrVariableWidth::GetAttributeValue  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 355 of file strkattr.h.

00355 { return(&Value); };

UINT32 AttrVariableWidth::GetAttrNameID void   )  [virtual]
 

Retrieves a string resource ID describing this attribute.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Returns:
Attribute description string-resource ID

Reimplemented from NodeAttribute.

Definition at line 1201 of file strkattr.cpp.

01202 {
01203     return(_R(IDS_ATTRVARWIDTH));
01204 }

void AttrVariableWidth::GetDebugDetails StringBase Str  )  [virtual]
 

Produces debug details about this node.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Parameters:
On return, Str is filled in with details on this node [OUTPUTS]

Reimplemented from NodeRenderable.

Definition at line 1221 of file strkattr.cpp.

01222 {
01223 #ifdef _DEBUG
01224     NodeAttribute::GetDebugDetails(Str);
01225 
01226     String_256 TempStr;
01227     TempStr._MakeMsg( _T("\r\nVariable width of type:\r\n") );
01228     *Str += TempStr;
01229 
01230     if (Value.GetWidthFunction() != NULL)
01231     {
01232         TempStr._MakeMsg( _T("  #1%s\r\n"),
01233                             Value.GetWidthFunction()->GetRuntimeClass()->GetClassName() );
01234     }
01235     else
01236         TempStr._MakeMsg( _T("  old-style constant width\r\n") );
01237 
01238     *Str += TempStr;
01239 #endif
01240 }

UINT32 AttrVariableWidth::GetNodeSize  )  const [virtual]
 

For finding the size of the node, in bytes.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Returns:
The size of this node, in bytes

Reimplemented from Node.

Definition at line 1257 of file strkattr.cpp.

01258 {
01259     return(sizeof(AttrVariableWidth));
01260 }

BOOL AttrVariableWidth::HasActiveValueFunction  ) 
 

To find out if this attribute is actually going to do anything or not.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/11/2000
Returns:
True if our attr value has a value function, false if not

Definition at line 1277 of file strkattr.cpp.

01278 {
01279     return (Value.GetWidthFunction() != NULL);
01280 }

INT32 AttrVariableWidth::operator== const NodeAttribute NodeAttrib  )  [virtual]
 

Comparison operator - determines if the AttributeValues of both objects are ==.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/7/97
Parameters:
NodeAttrib - The node to compare this node to [INPUTS]
Returns:
TRUE if the nodes are considered equal

Reimplemented from NodeAttribute.

Definition at line 1141 of file strkattr.cpp.

01142 {
01143     // First check they are of the same type
01144     if (((NodeAttribute*)&NodeAttrib)->GetAttributeType() != GetAttributeType())
01145         return FALSE;
01146 
01147     // Make a more sensible pointer
01148     AttrVariableWidth *Attr = (AttrVariableWidth *) &NodeAttrib;
01149 
01150     // Now let the AttributeValues compare themselves
01151     return( *((VariableWidthAttrValue *) Attr->GetAttributeValue())  ==
01152             *((VariableWidthAttrValue *) GetAttributeValue()) );
01153 }

void AttrVariableWidth::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

Reimplemented from NodeRenderable.

Definition at line 1116 of file strkattr.cpp.

01117 {
01118     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
01119     ENSURE(IS_A(pNodeCopy, AttrVariableWidth), "PolyCopyNodeContents given wrong dest node type");
01120 
01121     if (IS_A(pNodeCopy, AttrVariableWidth))
01122         CopyNodeContents((AttrVariableWidth*)pNodeCopy);
01123 }

void AttrVariableWidth::Render RenderRegion pRender  )  [virtual]
 

Renders this attribute (by simply calling the Render function of its contained AttributeValue).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/1/97

Reimplemented from NodeAttribute.

Definition at line 1073 of file strkattr.cpp.

01074 {
01075     GetAttributeValue()->Render(pRender);
01076 }

Node * AttrVariableWidth::SimpleCopy void   )  [virtual]
 

This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Returns:
A copy of the node, or NULL if memory runs out

Reimplemented from NodeAttribute.

Definition at line 1171 of file strkattr.cpp.

01172 {
01173     AttrVariableWidth* NodeCopy = new AttrVariableWidth;
01174     if (NodeCopy == NULL)
01175         return(NULL);
01176 
01177     // Call the base class
01178     NodeAttribute::CopyNodeContents(NodeCopy);
01179 
01180     // And call our AttributeValue to copy itself too
01181     NodeCopy->GetAttributeValue()->SimpleCopy(GetAttributeValue());
01182     
01183     return(NodeCopy);
01184 }

BOOL AttrVariableWidth::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Reimplemented from Node.

Definition at line 1319 of file strkattr.cpp.

01320 {
01321 #ifdef DO_EXPORT
01322     ERROR3IF(pFilter == NULL, "Illegal NULL param");
01323 
01324     BOOL ok = TRUE;
01325     VariableWidthID PredefinedFunctionID = Value.GetWidthFunctionID();
01326 
01327     if (PredefinedFunctionID == VarWidth_NotPredefined)
01328     {
01329         ValueFunction *pFunction = Value.GetWidthFunction();
01330         if (pFunction != NULL)
01331         {
01332             CamelotFileRecord *pRec = pFunction->WriteFileRecord(TAG_VARIABLEWIDTHTABLE, 0, pFilter);
01333             if (pRec != NULL)
01334             {
01335                 pFilter->Write(pRec);
01336                 delete pRec;
01337                 pRec = NULL;
01338             }
01339             else
01340                 ok = FALSE;
01341         }
01342         else
01343         {
01344             // The default attribute (for simple old-style lines) has no ValueFunction
01345             CamelotFileRecord Rec(pFilter, TAG_VARIABLEWIDTHFUNC, TAG_VARIABLEWIDTHFUNC_SIZE);
01346             if (ok) ok = Rec.Init();
01347             if (ok) ok = Rec.WriteUINT32((UINT32) 0);
01348             if (ok) ok = pFilter->Write(&Rec);
01349         }
01350     }
01351     else
01352     {
01353         CamelotFileRecord Rec(pFilter, TAG_VARIABLEWIDTHFUNC, TAG_VARIABLEWIDTHFUNC_SIZE);
01354 
01355         if (ok) ok = Rec.Init();
01356         if (ok) ok = Rec.WriteUINT32((UINT32) PredefinedFunctionID);
01357         if (ok) ok = pFilter->Write(&Rec);
01358     }
01359 
01360     if (!ok)
01361         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
01362 
01363     return(ok);
01364 #else
01365     return FALSE;
01366 #endif
01367 }

BOOL AttrVariableWidth::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes out a record that represents the node, to either Native or Web file format.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Parameters:
pFilter - filter to write to [INPUTS]
Returns:
TRUE if the Node has written out a record to the filter
This function is called before any of the AttrVariableWidth's children are written to the filter.

If the AttrVariableWidth writes out a record successfully to the file, it will return TRUE.

If the AttrVariableWidth chooses not to write itself to the filter (e.g. because it is not appropriate for this filter), then this function will return FALSE.

Notes: Simple

See also:
Node::WritePreChildrenNative; Node::WritePreChildrenWeb; StrokeAttrRecordHandler::HandleRecord

Reimplemented from Node.

Definition at line 1314 of file strkattr.cpp.

01315 {
01316     return(WritePreChildrenNative(pFilter));
01317 }


Friends And Related Function Documentation

friend class PathProcessorStroke [friend]
 

Definition at line 331 of file strkattr.h.


Member Data Documentation

VariableWidthAttrValue AttrVariableWidth::Value [protected]
 

Definition at line 361 of file strkattr.h.


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