THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 10:17, xxxxxxxx wrote:
Notes:
- polyArray is a private class member to IPPFigure.
- IPPFIGURE_POLYCOUNT is a LONG resource storing the number of polyArray elements.
// NodeData.Init
//*---------------------------------------------------------------------------*
Bool IPPFigure::Init(GeListNode* node)
//*---------------------------------------------------------------------------*
{
polyArray = NULL;
return TRUE;
}
// NodeData.Free
//*---------------------------------------------------------------------------*
void IPPFigure::Free(GeListNode* node)
//*---------------------------------------------------------------------------*
{
GeFree(polyArray);
}
// NodeData.Read: Read data from HyperFile
//*---------------------------------------------------------------------------*
Bool IPPFigure::Read(GeListNode* node, HyperFile* hf, LONG level)
//*---------------------------------------------------------------------------*
{
if (level >= 0)
{
BaseContainer* bc = ((BaseTag* )node)->GetDataInstance();
LONG size = sizeof(CPolygon)*bc->GetLong(IPPFIGURE_POLYCOUNT);
polyArray = (CPolygon* )GeAlloc(size);
if (!polyArray) return ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "IPPFigure.Read.polyArray");
hf->ReadMemory((void** )&polyArray;, &size;);
}
return TRUE;
}
// NodeData.Write: Write data to HyperFile
//*---------------------------------------------------------------------------*
Bool IPPFigure::Write(GeListNode* node, HyperFile* hf)
//*---------------------------------------------------------------------------*
{
// Level 0
if (polyArray) hf->WriteMemory(polyArray, sizeof(CPolygon)*((BaseTag* )node)->GetDataInstance()->GetLong(IPPFIGURE_POLYCOUNT));
// Level 1
return TRUE;
}
// NodeData.CopyTo: Copy data to copied PluginTag
//*---------------------------------------------------------------------------*
Bool IPPFigure::CopyTo(NodeData* dest, GeListNode* snode, GeListNode* dnode, LONG flags, AliasTrans* trn)
//*---------------------------------------------------------------------------*
{
if (polyArray)
{
BaseContainer* bc = ((BaseTag* )snode)->GetDataInstance();
IPPFigure* fdest = (IPPFigure* )dest;
LONG size = sizeof(CPolygon)*bc->GetLong(IPPFIGURE_POLYCOUNT);
fdest->polyArray = (CPolygon* )GeAlloc(size);
if (!fdest->polyArray) return ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "IPPFigure.CopyTo.adest->polyArray");
CopyMem(polyArray, fdest->polyArray, size);
}
return TRUE;
}
That'll get you started. :)