/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_filter.hxx" #include #include //----------------------------------DXFLType----------------------------------- DXFLType::DXFLType() { pSucc=NULL; sName[0]=0; nFlags=0; sDescription[0]=0; nDashCount=0; } void DXFLType::Read(DXFGroupReader & rDGR) { long nDashIndex=-1; while (rDGR.Read()!=0) { switch (rDGR.GetG()) { case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break; case 70: nFlags=rDGR.GetI(); break; case 3: strncpy( sDescription, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break; case 73: if (nDashIndex!=-1) { rDGR.SetError(); return; } nDashCount=rDGR.GetI(); if (nDashCount>DXF_MAX_DASH_COUNT) nDashCount=DXF_MAX_DASH_COUNT; nDashIndex=0; break; case 40: fPatternLength=rDGR.GetF(); break; case 49: if (nDashCount==-1) { rDGR.SetError(); return; } if (nDashIndexpSucc); ppLa=&pLayers; while(*ppLa!=NULL) ppLa=&((*ppLa)->pSucc); ppSt=&pStyles; while(*ppSt!=NULL) ppSt=&((*ppSt)->pSucc); ppVP=&pVPorts; while(*ppVP!=NULL) ppVP=&((*ppVP)->pSucc); for (;;) { while (rDGR.GetG()!=0) rDGR.Read(); if (strcmp(rDGR.GetS(),"EOF")==0 || strcmp(rDGR.GetS(),"ENDSEC")==0) break; else if (strcmp(rDGR.GetS(),"LTYPE")==0) { pLT=new DXFLType; pLT->Read(rDGR); *ppLT=pLT; ppLT=&(pLT->pSucc); } else if (strcmp(rDGR.GetS(),"LAYER")==0) { pLa=new DXFLayer; pLa->Read(rDGR); *ppLa=pLa; ppLa=&(pLa->pSucc); } else if (strcmp(rDGR.GetS(),"STYLE")==0) { pSt=new DXFStyle; pSt->Read(rDGR); *ppSt=pSt; ppSt=&(pSt->pSucc); } else if (strcmp(rDGR.GetS(),"VPORT")==0) { pVP=new DXFVPort; pVP->Read(rDGR); *ppVP=pVP; ppVP=&(pVP->pSucc); } else rDGR.Read(); } } void DXFTables::Clear() { DXFLType * pLT; DXFLayer * pLa; DXFStyle * pSt; DXFVPort * pVP; while (pStyles!=NULL) { pSt=pStyles; pStyles=pSt->pSucc; delete pSt; } while (pLayers!=NULL) { pLa=pLayers; pLayers=pLa->pSucc; delete pLa; } while (pLTypes!=NULL) { pLT=pLTypes; pLTypes=pLT->pSucc; delete pLT; } while (pVPorts!=NULL) { pVP=pVPorts; pVPorts=pVP->pSucc; delete pVP; } } DXFLType * DXFTables::SearchLType(const char * pName) const { DXFLType * p; for (p=pLTypes; p!=NULL; p=p->pSucc) { if (strcmp(pName,p->sName)==0) break; } return p; } DXFLayer * DXFTables::SearchLayer(const char * pName) const { DXFLayer * p; for (p=pLayers; p!=NULL; p=p->pSucc) { if (strcmp(pName,p->sName)==0) break; } return p; } DXFVPort * DXFTables::SearchVPort(const char * pName) const { DXFVPort * p; for (p=pVPorts; p!=NULL; p=p->pSucc) { if (strcmp(pName,p->sName)==0) break; } return p; }