nss: upgrade to release 3.73
[LibreOffice.git] / filter / source / graphicfilter / idxf / dxfblkrd.cxx
blob9597fdca95a45e6e04bfd1f1aee754c804f4d75a
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 "dxfblkrd.hxx"
24 //---------------- DXFBlock --------------------------------------------------
27 DXFBlock::DXFBlock()
28 : pSucc(nullptr)
29 , nFlags(0)
34 DXFBlock::~DXFBlock()
39 void DXFBlock::Read(DXFGroupReader & rDGR)
41 m_sName = "";
42 m_sAlsoName = "";
43 aBasePoint.fx=0.0;
44 aBasePoint.fy=0.0;
45 aBasePoint.fz=0.0;
46 nFlags=0;
47 m_sXRef = "";
49 while (rDGR.Read()!=0)
51 switch (rDGR.GetG())
53 case 2: m_sName = rDGR.GetS(); break;
54 case 3: m_sAlsoName = rDGR.GetS(); break;
55 case 70: nFlags=rDGR.GetI(); break;
56 case 10: aBasePoint.fx=rDGR.GetF(); break;
57 case 20: aBasePoint.fy=rDGR.GetF(); break;
58 case 30: aBasePoint.fz=rDGR.GetF(); break;
59 case 1: m_sXRef = rDGR.GetS(); break;
62 DXFEntities::Read(rDGR);
66 //---------------- DXFBlocks -------------------------------------------------
69 DXFBlocks::DXFBlocks()
71 pFirst=nullptr;
75 DXFBlocks::~DXFBlocks()
77 Clear();
81 void DXFBlocks::Read(DXFGroupReader & rDGR)
83 DXFBlock * pB, * * ppSucc;
85 ppSucc=&pFirst;
86 while (*ppSucc!=nullptr) ppSucc=&((*ppSucc)->pSucc);
88 for (;;) {
89 while (rDGR.GetG()!=0) rDGR.Read();
90 if (rDGR.GetS() == "ENDSEC" ||
91 rDGR.GetS() == "EOF") break;
92 if (rDGR.GetS() == "BLOCK") {
93 pB=new DXFBlock;
94 pB->Read(rDGR);
95 *ppSucc=pB;
96 ppSucc=&(pB->pSucc);
98 else rDGR.Read();
103 DXFBlock * DXFBlocks::Search(OString const& rName) const
105 DXFBlock * pB;
106 for (pB=pFirst; pB!=nullptr; pB=pB->pSucc) {
107 if (rName == pB->m_sName) break;
109 return pB;
113 void DXFBlocks::Clear()
115 DXFBlock * ptmp;
117 while (pFirst!=nullptr) {
118 ptmp=pFirst;
119 pFirst=ptmp->pSucc;
120 delete ptmp;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */