bump product version to 4.1.6.2
[LibreOffice.git] / filter / source / graphicfilter / idxf / dxfblkrd.cxx
blobbb52fe42aebefc7b401cc2567b9885226774fd66
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <string.h>
22 #include <dxfblkrd.hxx>
25 //----------------------------------------------------------------------------
26 //---------------- DXFBlock --------------------------------------------------
27 //----------------------------------------------------------------------------
30 DXFBlock::DXFBlock()
32 pSucc=NULL;
36 DXFBlock::~DXFBlock()
41 void DXFBlock::Read(DXFGroupReader & rDGR)
43 m_sName = "";
44 m_sAlsoName = "";
45 aBasePoint.fx=0.0;
46 aBasePoint.fy=0.0;
47 aBasePoint.fz=0.0;
48 nFlags=0;
49 m_sXRef = "";
51 while (rDGR.Read()!=0)
53 switch (rDGR.GetG())
55 case 2: m_sName = OString(rDGR.GetS()); break;
56 case 3: m_sAlsoName = OString(rDGR.GetS()); break;
57 case 70: nFlags=rDGR.GetI(); break;
58 case 10: aBasePoint.fx=rDGR.GetF(); break;
59 case 20: aBasePoint.fy=rDGR.GetF(); break;
60 case 30: aBasePoint.fz=rDGR.GetF(); break;
61 case 1: m_sXRef = OString(rDGR.GetS()); break;
64 DXFEntities::Read(rDGR);
68 //----------------------------------------------------------------------------
69 //---------------- DXFBlocks -------------------------------------------------
70 //----------------------------------------------------------------------------
73 DXFBlocks::DXFBlocks()
75 pFirst=NULL;
79 DXFBlocks::~DXFBlocks()
81 Clear();
85 void DXFBlocks::Read(DXFGroupReader & rDGR)
87 DXFBlock * pB, * * ppSucc;
89 ppSucc=&pFirst;
90 while (*ppSucc!=NULL) ppSucc=&((*ppSucc)->pSucc);
92 for (;;) {
93 while (rDGR.GetG()!=0) rDGR.Read();
94 if (strcmp(rDGR.GetS(),"ENDSEC")==0 ||
95 strcmp(rDGR.GetS(),"EOF")==0) break;
96 if (strcmp(rDGR.GetS(),"BLOCK")==0) {
97 pB=new DXFBlock;
98 pB->Read(rDGR);
99 *ppSucc=pB;
100 ppSucc=&(pB->pSucc);
102 else rDGR.Read();
107 DXFBlock * DXFBlocks::Search(OString const& rName) const
109 DXFBlock * pB;
110 for (pB=pFirst; pB!=NULL; pB=pB->pSucc) {
111 if (rName == pB->m_sName) break;
113 return pB;
117 void DXFBlocks::Clear()
119 DXFBlock * ptmp;
121 while (pFirst!=NULL) {
122 ptmp=pFirst;
123 pFirst=ptmp->pSucc;
124 delete ptmp;
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */