dimeTableEntry *
dimeLayerTable::copy(dimeModel * const model) const
{
  dimeMemHandler *memh = model->getMemHandler();
  dimeLayerTable *l = new(memh) dimeLayerTable;
  l->colorNumber = this->colorNumber;
  if (this->layerName) {
    DXF_STRCPY(memh, l->layerName, this->layerName);
  }
  if (this->layerInfo) {
    l->layerInfo = (dimeLayer*)model->addLayer(this->layerInfo->getLayerName(), 
                                               DXFABS(this->colorNumber));
  }
  if (!copyRecords(l, model)) {
    // check if allocated on heap.
    if (!memh) delete l;
    l = NULL;
  }
  return l;
}
Exemple #2
0
bool Table::backup(Table& source)
{
	bool bResult = false;

	if (exists())
		remove();

	if (create())
	{
		if (source.open())
		{
			if (copyRecords(source))
			{
				if (source.totalRecordCount() == totalRecordCount())
					bResult = true;
			}
		}
	}

	return bResult;
}